void OBJECT_OT_vertex_warp(struct wmOperatorType *ot) { PropertyRNA *prop; /* identifiers */ ot->name = "Warp"; ot->description = "Warp vertices around the cursor"; ot->idname = "OBJECT_OT_vertex_warp"; /* api callbacks */ ot->exec = object_warp_verts_exec; ot->poll = object_warp_verts_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* props */ prop = RNA_def_float(ot->srna, "warp_angle", DEG2RADF(360.0f), -FLT_MAX, FLT_MAX, "Warp Angle", "Amount to warp about the cursor", DEG2RADF(-360.0f), DEG2RADF(360.0f)); RNA_def_property_subtype(prop, PROP_ANGLE); prop = RNA_def_float(ot->srna, "offset_angle", DEG2RADF(0.0f), -FLT_MAX, FLT_MAX, "Offset Angle", "Angle to use as the basis for warping", DEG2RADF(-360.0f), DEG2RADF(360.0f)); RNA_def_property_subtype(prop, PROP_ANGLE); prop = RNA_def_float(ot->srna, "min", -1.0f, -FLT_MAX, FLT_MAX, "Min", "", -100.0, 100.0); prop = RNA_def_float(ot->srna, "max", 1.0f, -FLT_MAX, FLT_MAX, "Max", "", -100.0, 100.0); /* hidden props */ prop = RNA_def_float_matrix(ot->srna, "viewmat", 4, 4, NULL, 0.0f, 0.0f, "Matrix", "", 0.0f, 0.0f); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); prop = RNA_def_float_vector_xyz(ot->srna, "center", 3, NULL, -FLT_MAX, FLT_MAX, "Center", "", -FLT_MAX, FLT_MAX); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); }
void MESH_OT_primitive_cone_add(wmOperatorType *ot) { PropertyRNA *prop; /* identifiers */ ot->name = "Add Cone"; ot->description = "Construct a conic mesh"; ot->idname = "MESH_OT_primitive_cone_add"; /* api callbacks */ ot->invoke = WM_operator_view3d_distance_invoke; ot->exec = add_primitive_cone_exec; ot->poll = ED_operator_scene_editable; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* props */ RNA_def_int(ot->srna, "vertices", 32, 3, INT_MAX, "Vertices", "", 3, 500); prop = RNA_def_float(ot->srna, "radius1", 1.0f, 0.0, FLT_MAX, "Radius 1", "", 0.001, 100.00); RNA_def_property_subtype(prop, PROP_DISTANCE); prop = RNA_def_float(ot->srna, "radius2", 0.0f, 0.0, FLT_MAX, "Radius 2", "", 0.001, 100.00); RNA_def_property_subtype(prop, PROP_DISTANCE); prop = RNA_def_float(ot->srna, "depth", 2.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00); RNA_def_property_subtype(prop, PROP_DISTANCE); RNA_def_enum(ot->srna, "end_fill_type", fill_type_items, 1, "Base Fill Type", ""); ED_object_add_generic_props(ot, true); }
void MESH_OT_primitive_cone_add(wmOperatorType *ot) { PropertyRNA *prop; /* identifiers */ ot->name= "Add Cone"; ot->description= "Construct a conic mesh (ends filled)"; ot->idname= "MESH_OT_primitive_cone_add"; /* api callbacks */ ot->invoke= ED_object_add_generic_invoke; ot->exec= add_primitive_cone_exec; ot->poll= ED_operator_scene_editable; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* props */ RNA_def_int(ot->srna, "vertices", 32, 2, INT_MAX, "Vertices", "", 2, 500); prop = RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00); RNA_def_property_subtype(prop, PROP_DISTANCE); prop = RNA_def_float(ot->srna, "depth", 2.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00); RNA_def_property_subtype(prop, PROP_DISTANCE); RNA_def_boolean(ot->srna, "cap_end", 1, "Cap End", ""); ED_object_add_generic_props(ot, TRUE); }
static void TRANSFORM_OT_tilt(struct wmOperatorType *ot) { PropertyRNA *prop; /* identifiers */ ot->name = "Tilt"; /* optionals - * "Tilt selected vertices" * "Specify an extra axis rotation for selected vertices of 3D curve" */ ot->description = "Tilt selected control vertices of 3D curve"; ot->idname = OP_TILT; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; ot->exec = transform_exec; ot->modal = transform_modal; ot->cancel = transform_cancel; ot->poll = ED_operator_editcurve_3d; prop = RNA_def_float(ot->srna, "value", 0.0, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2); RNA_def_property_subtype(prop, PROP_ANGLE); Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP); }
static void make_prim_radius_prop(wmOperatorType *ot) { PropertyRNA *prop; prop = RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00); RNA_def_property_subtype(prop, PROP_DISTANCE); }
void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot) { PropertyRNA *prop; /* identifiers */ ot->name = "Add UV Sphere"; ot->description = "Construct a UV sphere mesh"; ot->idname = "MESH_OT_primitive_uv_sphere_add"; /* api callbacks */ ot->invoke = WM_operator_view3d_distance_invoke; ot->exec = add_primitive_uvsphere_exec; ot->poll = ED_operator_scene_editable; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* props */ RNA_def_int(ot->srna, "segments", 32, 3, INT_MAX, "Segments", "", 3, 500); RNA_def_int(ot->srna, "ring_count", 16, 3, INT_MAX, "Rings", "", 3, 500); prop = RNA_def_float(ot->srna, "size", 1.0f, 0.0, FLT_MAX, "Size", "", 0.001, 100.00); RNA_def_property_subtype(prop, PROP_DISTANCE); ED_object_add_generic_props(ot, true); }
void MESH_OT_primitive_grid_add(wmOperatorType *ot) { PropertyRNA *prop; /* identifiers */ ot->name= "Add Grid"; ot->description= "Construct a grid mesh"; ot->idname= "MESH_OT_primitive_grid_add"; /* api callbacks */ ot->invoke= ED_object_add_generic_invoke; ot->exec= add_primitive_grid_exec; ot->poll= ED_operator_scene_editable; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* props */ RNA_def_int(ot->srna, "x_subdivisions", 10, 3, INT_MAX, "X Subdivisions", "", 3, 1000); RNA_def_int(ot->srna, "y_subdivisions", 10, 3, INT_MAX, "Y Subdivisions", "", 3, 1000); prop = RNA_def_float(ot->srna, "size", 1.0f, 0.0, FLT_MAX, "Size", "", 0.001, FLT_MAX); RNA_def_property_subtype(prop, PROP_DISTANCE); ED_object_add_generic_props(ot, TRUE); }
static void TRANSFORM_OT_rotate(struct wmOperatorType *ot) { PropertyRNA *prop; /* identifiers */ ot->name = "Rotate"; ot->description = "Rotate selected items"; ot->idname = OP_ROTATION; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; ot->exec = transform_exec; ot->modal = transform_modal; ot->cancel = transform_cancel; ot->poll = ED_operator_screenactive; prop = RNA_def_float(ot->srna, "value", 0.0f, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2); RNA_def_property_subtype(prop, PROP_ANGLE); Transform_Properties(ot, P_AXIS | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_GPENCIL_EDIT); }
static void TRANSFORM_OT_trackball(struct wmOperatorType *ot) { PropertyRNA *prop; /* identifiers */ ot->name = "Trackball"; ot->description = "Trackball style rotation of selected items"; ot->idname = OP_TRACKBALL; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* api callbacks */ ot->invoke = transform_invoke; ot->exec = transform_exec; ot->modal = transform_modal; ot->cancel = transform_cancel; ot->poll = ED_operator_screenactive; /* Maybe we could use float_vector_xyz here too? */ prop = RNA_def_float_vector(ot->srna, "value", 2, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX); RNA_def_property_subtype(prop, PROP_ANGLE); Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_GPENCIL_EDIT); }
/* transfers weight from active to selected */ void OBJECT_OT_data_transfer(wmOperatorType *ot) { PropertyRNA *prop; /* Identifiers.*/ ot->name = "Transfer Mesh Data"; ot->idname = "OBJECT_OT_data_transfer"; ot->description = "Transfer data layer(s) (weights, edge sharp, ...) from active to selected meshes"; /* API callbacks.*/ ot->poll = data_transfer_poll; ot->invoke = WM_menu_invoke; ot->exec = data_transfer_exec; ot->check = data_transfer_check; ot->ui = data_transfer_ui; /* Flags.*/ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* Properties.*/ prop = RNA_def_boolean(ot->srna, "use_reverse_transfer", false, "Reverse Transfer", "Transfer from selected objects to active one"); RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); RNA_def_boolean(ot->srna, "use_freeze", false, "Freeze Operator", "Prevent changes to settings to re-run the operator, " "handy to change several things at once with heavy geometry"); /* Data type to transfer. */ ot->prop = RNA_def_enum(ot->srna, "data_type", DT_layer_items, 0, "Data Type", "Which data to transfer"); RNA_def_boolean(ot->srna, "use_create", true, "Create Data", "Add data layers on destination meshes if needed"); /* Mapping methods. */ RNA_def_enum(ot->srna, "vert_mapping", rna_enum_dt_method_vertex_items, MREMAP_MODE_VERT_NEAREST, "Vertex Mapping", "Method used to map source vertices to destination ones"); RNA_def_enum(ot->srna, "edge_mapping", rna_enum_dt_method_edge_items, MREMAP_MODE_EDGE_NEAREST, "Edge Mapping", "Method used to map source edges to destination ones"); RNA_def_enum(ot->srna, "loop_mapping", rna_enum_dt_method_loop_items, MREMAP_MODE_LOOP_NEAREST_POLYNOR, "Face Corner Mapping", "Method used to map source faces' corners to destination ones"); RNA_def_enum(ot->srna, "poly_mapping", rna_enum_dt_method_poly_items, MREMAP_MODE_POLY_NEAREST, "Face Mapping", "Method used to map source faces to destination ones"); /* Mapping options and filtering. */ RNA_def_boolean(ot->srna, "use_auto_transform", false, "Auto Transform", "Automatically compute transformation to get the best possible match between source and " "destination meshes (WARNING: results will never be as good as manual matching of objects)"); RNA_def_boolean(ot->srna, "use_object_transform", true, "Object Transform", "Evaluate source and destination meshes in global space"); RNA_def_boolean(ot->srna, "use_max_distance", false, "Only Neighbor Geometry", "Source elements must be closer than given distance from destination one"); prop = RNA_def_float(ot->srna, "max_distance", 1.0f, 0.0f, FLT_MAX, "Max Distance", "Maximum allowed distance between source and destination element, for non-topology mappings", 0.0f, 100.0f); RNA_def_property_subtype(prop, PROP_DISTANCE); prop = RNA_def_float(ot->srna, "ray_radius", 0.0f, 0.0f, FLT_MAX, "Ray Radius", "'Width' of rays (especially useful when raycasting against vertices or edges)", 0.0f, 10.0f); RNA_def_property_subtype(prop, PROP_DISTANCE); prop = RNA_def_float(ot->srna, "islands_precision", 0.1f, 0.0f, 10.0f, "Islands Precision", "Factor controlling precision of islands handling (the higher, the better the results)", 0.0f, 1.0f); RNA_def_property_subtype(prop, PROP_FACTOR); /* How to handle multi-layers types of data. */ prop = RNA_def_enum(ot->srna, "layers_select_src", rna_enum_dt_layers_select_src_items, DT_LAYERS_ACTIVE_SRC, "Source Layers Selection", "Which layers to transfer, in case of multi-layers types"); RNA_def_property_enum_funcs_runtime(prop, NULL, NULL, dt_layers_select_itemf); prop = RNA_def_enum(ot->srna, "layers_select_dst", rna_enum_dt_layers_select_dst_items, DT_LAYERS_ACTIVE_DST, "Destination Layers Matching", "How to match source and destination layers"); RNA_def_property_enum_funcs_runtime(prop, NULL, NULL, dt_layers_select_itemf); prop = RNA_def_enum(ot->srna, "mix_mode", rna_enum_dt_mix_mode_items, CDT_MIX_TRANSFER, "Mix Mode", "How to affect destination elements with source values"); RNA_def_property_enum_funcs_runtime(prop, NULL, NULL, dt_mix_mode_itemf); RNA_def_float(ot->srna, "mix_factor", 1.0f, 0.0f, 1.0f, "Mix Factor", "Factor to use when applying data to destination (exact behavior depends on mix mode)", 0.0f, 1.0f); }
static void rna_def_image_preview(BlenderRNA *brna) { StructRNA *srna; FunctionRNA *func; PropertyRNA *prop; srna = RNA_def_struct(brna, "ImagePreview", NULL); RNA_def_struct_sdna(srna, "PreviewImage"); RNA_def_struct_ui_text(srna, "Image Preview", "Preview image and icon"); prop = RNA_def_property(srna, "is_image_custom", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_PREVIEW]", PRV_USER_EDITED); RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_image_custom_set"); RNA_def_property_ui_text(prop, "Custom Image", "True if this preview image has been modified by py script," "and is no more auto-generated by Blender"); prop = RNA_def_int_vector(srna, "image_size", 2, NULL, 0, 0, "Image Size", "Width and height in pixels", 0, 0); RNA_def_property_subtype(prop, PROP_PIXEL); RNA_def_property_int_funcs(prop, "rna_ImagePreview_image_size_get", "rna_ImagePreview_image_size_set", NULL); prop = RNA_def_property(srna, "image_pixels", PROP_INT, PROP_NONE); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_multi_array(prop, 1, NULL); RNA_def_property_ui_text(prop, "Image Pixels", "Image pixels, as bytes (always RGBA 32bits)"); RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_get_length"); RNA_def_property_int_funcs(prop, "rna_ImagePreview_image_pixels_get", "rna_ImagePreview_image_pixels_set", NULL); prop = RNA_def_property(srna, "image_pixels_float", PROP_FLOAT, PROP_NONE); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_multi_array(prop, 1, NULL); RNA_def_property_ui_text(prop, "Float Image Pixels", "Image pixels components, as floats (RGBA concatenated values)"); RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_float_get_length"); RNA_def_property_float_funcs(prop, "rna_ImagePreview_image_pixels_float_get", "rna_ImagePreview_image_pixels_float_set", NULL); prop = RNA_def_property(srna, "is_icon_custom", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_ICON]", PRV_USER_EDITED); RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_icon_custom_set"); RNA_def_property_ui_text(prop, "Custom Icon", "True if this preview icon has been modified by py script," "and is no more auto-generated by Blender"); prop = RNA_def_int_vector(srna, "icon_size", 2, NULL, 0, 0, "Icon Size", "Width and height in pixels", 0, 0); RNA_def_property_subtype(prop, PROP_PIXEL); RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_size_get", "rna_ImagePreview_icon_size_set", NULL); prop = RNA_def_property(srna, "icon_pixels", PROP_INT, PROP_NONE); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_multi_array(prop, 1, NULL); RNA_def_property_ui_text(prop, "Icon Pixels", "Icon pixels, as bytes (always RGBA 32bits)"); RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_get_length"); RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_pixels_get", "rna_ImagePreview_icon_pixels_set", NULL); prop = RNA_def_property(srna, "icon_pixels_float", PROP_FLOAT, PROP_NONE); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_multi_array(prop, 1, NULL); RNA_def_property_ui_text(prop, "Float Icon Pixels", "Icon pixels components, as floats (RGBA concatenated values)"); RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_float_get_length"); RNA_def_property_float_funcs(prop, "rna_ImagePreview_icon_pixels_float_get", "rna_ImagePreview_icon_pixels_float_set", NULL); prop = RNA_def_int(srna, "icon_id", 0, INT_MIN, INT_MAX, "Icon ID", "Unique integer identifying this preview as an icon (zero means invalid)", INT_MIN, INT_MAX); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_id_get", NULL, NULL); func = RNA_def_function(srna, "reload", "rna_ImagePreview_icon_reload"); RNA_def_function_ui_description(func, "Reload the preview from its source path"); }
static void rna_def_image(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; static const EnumPropertyItem prop_type_items[] = { {IMA_TYPE_IMAGE, "IMAGE", 0, "Image", ""}, {IMA_TYPE_MULTILAYER, "MULTILAYER", 0, "Multilayer", ""}, {IMA_TYPE_UV_TEST, "UV_TEST", 0, "UV Test", ""}, {IMA_TYPE_R_RESULT, "RENDER_RESULT", 0, "Render Result", ""}, {IMA_TYPE_COMPOSITE, "COMPOSITING", 0, "Compositing", ""}, {0, NULL, 0, NULL, NULL} }; static const EnumPropertyItem prop_mapping_items[] = { {0, "UV", 0, "UV Coordinates", "Use UV coordinates for mapping the image"}, {IMA_REFLECT, "REFLECTION", 0, "Reflection", "Use reflection mapping for mapping the image"}, {0, NULL, 0, NULL, NULL} }; static const EnumPropertyItem prop_field_order_items[] = { {0, "EVEN", 0, "Upper First", "Upper field first"}, {IMA_STD_FIELD, "ODD", 0, "Lower First", "Lower field first"}, {0, NULL, 0, NULL, NULL} }; static const EnumPropertyItem alpha_mode_items[] = { {IMA_ALPHA_STRAIGHT, "STRAIGHT", 0, "Straight", "Transparent RGB and alpha pixels are unmodified"}, {IMA_ALPHA_PREMUL, "PREMUL", 0, "Premultiplied", "Transparent RGB pixels are multiplied by the alpha channel"}, {0, NULL, 0, NULL, NULL} }; srna = RNA_def_struct(brna, "Image", "ID"); RNA_def_struct_ui_text(srna, "Image", "Image datablock referencing an external or packed image"); RNA_def_struct_ui_icon(srna, ICON_IMAGE_DATA); prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update"); /* eek. this is horrible but needed so we can save to a new name without blanking the data :( */ prop = RNA_def_property(srna, "filepath_raw", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name (without data refreshing)"); prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, image_type_items); RNA_def_property_enum_funcs(prop, "rna_Image_file_format_get", "rna_Image_file_format_set", NULL); RNA_def_property_ui_text(prop, "File Format", "Format used for re-saving this file"); prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, image_source_items); RNA_def_property_enum_funcs(prop, NULL, "rna_Image_source_set", "rna_Image_source_itemf"); RNA_def_property_ui_text(prop, "Source", "Where the image comes from"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Type", "How to generate the image"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "packedfile"); RNA_def_property_ui_text(prop, "Packed File", ""); prop = RNA_def_property(srna, "field_order", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, prop_field_order_items); RNA_def_property_ui_text(prop, "Field Order", "Order of video fields (select which lines are displayed first)"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); /* booleans */ prop = RNA_def_property(srna, "use_fields", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_FIELDS); RNA_def_property_ui_text(prop, "Fields", "Use fields of the image"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_fields_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop = RNA_def_property(srna, "use_view_as_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_VIEW_AS_RENDER); RNA_def_property_ui_text(prop, "View as Render", "Apply render part of display transformation when displaying this image on the screen"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMA_IGNORE_ALPHA); RNA_def_property_ui_text(prop, "Use Alpha", "Use the alpha channel information from the image or make image fully opaque"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_colormanage_update"); prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_Image_dirty_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Dirty", "Image has changed and is not saved"); /* generated image (image_generated_change_cb) */ prop = RNA_def_property(srna, "generated_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "gen_type"); RNA_def_property_enum_items(prop, image_generated_type_items); RNA_def_property_ui_text(prop, "Generated Type", "Generated image type"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop = RNA_def_property(srna, "generated_width", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "gen_x"); RNA_def_property_range(prop, 1, 65536); RNA_def_property_ui_text(prop, "Generated Width", "Generated image width"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop = RNA_def_property(srna, "generated_height", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "gen_y"); RNA_def_property_range(prop, 1, 65536); RNA_def_property_ui_text(prop, "Generated Height", "Generated image height"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop = RNA_def_property(srna, "use_generated_float", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gen_flag", IMA_GEN_FLOAT); RNA_def_property_ui_text(prop, "Float Buffer", "Generate floating point buffer"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* realtime properties */ prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, prop_mapping_items); RNA_def_property_ui_text(prop, "Mapping", "Mapping type to use for this image in the game engine"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "aspx"); RNA_def_property_array(prop, 2); RNA_def_property_range(prop, 0.1f, FLT_MAX); RNA_def_property_ui_range(prop, 0.1f, 5000.f, 1, 2); RNA_def_property_ui_text(prop, "Display Aspect", "Display Aspect for this image, does not affect rendering"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "use_animation", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_TWINANIM); RNA_def_property_ui_text(prop, "Animated", "Use as animated texture in the game engine"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_animated_update"); prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "twsta"); RNA_def_property_range(prop, 0, 128); RNA_def_property_ui_text(prop, "Animation Start", "Start frame of an animated texture"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_animated_update"); prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "twend"); RNA_def_property_range(prop, 0, 128); RNA_def_property_ui_text(prop, "Animation End", "End frame of an animated texture"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_animated_update"); prop = RNA_def_property(srna, "fps", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "animspeed"); RNA_def_property_range(prop, 1, 100); RNA_def_property_ui_text(prop, "Animation Speed", "Speed of the animation in frames per second"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "use_tiles", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_TILES); RNA_def_property_ui_text(prop, "Tiles", "Use of tilemode for faces (default shift-LMB to pick the tile for selected faces)"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "tiles_x", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "xrep"); RNA_def_property_range(prop, 1, 16); RNA_def_property_ui_text(prop, "Tiles X", "Degree of repetition in the X direction"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "tiles_y", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "yrep"); RNA_def_property_range(prop, 1, 16); RNA_def_property_ui_text(prop, "Tiles Y", "Degree of repetition in the Y direction"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "use_clamp_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_CLAMP_U); RNA_def_property_ui_text(prop, "Clamp X", "Disable texture repeating horizontally"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "use_clamp_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_CLAMP_V); RNA_def_property_ui_text(prop, "Clamp Y", "Disable texture repeating vertically"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "bindcode", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "bindcode"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Bindcode", "OpenGL bindcode"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "render_slot", PROP_INT, PROP_UNSIGNED); RNA_def_property_range(prop, 0, IMA_MAX_RENDER_SLOT - 1); RNA_def_property_ui_text(prop, "Render Slot", "The current render slot displayed, only for viewer type images"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); /* * Image.has_data and Image.depth are temporary, * Update import_obj.py when they are replaced (Arystan) */ prop = RNA_def_property(srna, "has_data", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_Image_has_data_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Has data", "True if this image has data"); prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_funcs(prop, "rna_Image_depth_get", NULL, NULL); RNA_def_property_ui_text(prop, "Depth", "Image bit depth"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_int_vector(srna, "size", 2, NULL, 0, 0, "Size", "Width and height in pixels, zero when image data cant be loaded", 0, 0); RNA_def_property_subtype(prop, PROP_PIXEL); RNA_def_property_int_funcs(prop, "rna_Image_size_get", NULL, NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_float_vector(srna, "resolution", 2, NULL, 0, 0, "Resolution", "X/Y pixels per meter", 0, 0); RNA_def_property_float_funcs(prop, "rna_Image_resolution_get", "rna_Image_resolution_set", NULL); prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_funcs(prop, "rna_Image_frame_duration_get", NULL, NULL); RNA_def_property_ui_text(prop, "Duration", "Duration (in frames) of the image (1 when not a video/sequence)"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* NOTE about pixels/channels/is_floa: * this properties describes how image is stored internally (inside of ImBuf), * not how it was saved to disk or how it'll be saved on disk */ prop = RNA_def_property(srna, "pixels", PROP_FLOAT, PROP_NONE); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_multi_array(prop, 1, NULL); RNA_def_property_ui_text(prop, "Pixels", "Image pixels in floating point values"); RNA_def_property_dynamic_array_funcs(prop, "rna_Image_pixels_get_length"); RNA_def_property_float_funcs(prop, "rna_Image_pixels_get", "rna_Image_pixels_set", NULL); prop = RNA_def_property(srna, "channels", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_funcs(prop, "rna_Image_channels_get", NULL, NULL); RNA_def_property_ui_text(prop, "Channels", "Number of channels in pixels buffer"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "is_float", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_Image_is_float_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Is Float", "True if this image is stored in float buffer"); prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "colorspace_settings"); RNA_def_property_struct_type(prop, "ColorManagedInputColorspaceSettings"); RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings"); prop = RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, alpha_mode_items); RNA_def_property_ui_text(prop, "Alpha Mode", "Representation of alpha information in the RGBA pixels"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_colormanage_update"); RNA_api_image(srna); }
static void rna_def_image(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; static const EnumPropertyItem prop_type_items[] = { {IMA_TYPE_IMAGE, "IMAGE", 0, "Image", ""}, {IMA_TYPE_MULTILAYER, "MULTILAYER", 0, "Multilayer", ""}, {IMA_TYPE_UV_TEST, "UV_TEST", 0, "UV Test", ""}, {IMA_TYPE_R_RESULT, "RENDER_RESULT", 0, "Render Result", ""}, {IMA_TYPE_COMPOSITE, "COMPOSITING", 0, "Compositing", ""}, {0, NULL, 0, NULL, NULL}, }; static const EnumPropertyItem alpha_mode_items[] = { {IMA_ALPHA_STRAIGHT, "STRAIGHT", 0, "Straight", "Store RGB and alpha channels separately with alpha acting as a mask, also known as " "unassociated alpha. Commonly used by image editing applications and file formats like " "PNG"}, {IMA_ALPHA_PREMUL, "PREMUL", 0, "Premultiplied", "Store RGB channels with alpha multipled in, also known as associated alpha. The natural " "format for renders and used by file formats like OpenEXR"}, {IMA_ALPHA_CHANNEL_PACKED, "CHANNEL_PACKED", 0, "Channel Packed", "Different images are packed in the RGB and alpha channels, and they should not " "affect each other. Channel packing is commonly used by game engines to save memory"}, {IMA_ALPHA_IGNORE, "NONE", 0, "None", "Ignore alpha channel from the file and make image fully opaque"}, {0, NULL, 0, NULL, NULL}, }; srna = RNA_def_struct(brna, "Image", "ID"); RNA_def_struct_ui_text( srna, "Image", "Image data-block referencing an external or packed image"); RNA_def_struct_ui_icon(srna, ICON_IMAGE_DATA); prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update"); /* eek. this is horrible but needed so we can save to a new name without blanking the data :( */ prop = RNA_def_property(srna, "filepath_raw", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "name"); RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name (without data refreshing)"); prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, rna_enum_image_type_items); RNA_def_property_enum_funcs( prop, "rna_Image_file_format_get", "rna_Image_file_format_set", NULL); RNA_def_property_ui_text(prop, "File Format", "Format used for re-saving this file"); prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, image_source_items); RNA_def_property_enum_funcs(prop, NULL, "rna_Image_source_set", "rna_Image_source_itemf"); RNA_def_property_ui_text(prop, "Source", "Where the image comes from"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, prop_type_items); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Type", "How to generate the image"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "PackedFile"); RNA_def_property_pointer_sdna(prop, NULL, "packedfile"); RNA_def_property_pointer_funcs(prop, "rna_Image_packed_file_get", NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Packed File", "First packed file of the image"); prop = RNA_def_property(srna, "packed_files", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "packedfiles", NULL); RNA_def_property_struct_type(prop, "ImagePackedFile"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Packed Files", "Collection of packed images"); prop = RNA_def_property(srna, "use_view_as_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_VIEW_AS_RENDER); RNA_def_property_ui_text( prop, "View as Render", "Apply render part of display transformation when displaying this image on the screen"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "use_deinterlace", PROP_BOOLEAN, PROP_NONE); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_DEINTERLACE); RNA_def_property_ui_text(prop, "Deinterlace", "Deinterlace movie file on load"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update"); prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_USE_VIEWS); RNA_def_property_ui_text(prop, "Use Multi-View", "Use Multiple Views (when available)"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_views_format_update"); prop = RNA_def_property(srna, "is_stereo_3d", PROP_BOOLEAN, PROP_NONE); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); RNA_def_property_boolean_funcs(prop, "rna_Image_is_stereo_3d_get", NULL); RNA_def_property_ui_text(prop, "Stereo 3D", "Image has left and right views"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "is_multiview", PROP_BOOLEAN, PROP_NONE); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); RNA_def_property_boolean_funcs(prop, "rna_Image_is_multiview_get", NULL); RNA_def_property_ui_text(prop, "Multiple Views", "Image has more than one view"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); RNA_def_property_boolean_funcs(prop, "rna_Image_dirty_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Dirty", "Image has changed and is not saved"); /* generated image (image_generated_change_cb) */ prop = RNA_def_property(srna, "generated_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "gen_type"); RNA_def_property_enum_items(prop, rna_enum_image_generated_type_items); RNA_def_property_ui_text(prop, "Generated Type", "Generated image type"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop = RNA_def_property(srna, "generated_width", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "gen_x"); RNA_def_property_flag(prop, PROP_PROPORTIONAL); RNA_def_property_range(prop, 1, 65536); RNA_def_property_ui_text(prop, "Generated Width", "Generated image width"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop = RNA_def_property(srna, "generated_height", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "gen_y"); RNA_def_property_flag(prop, PROP_PROPORTIONAL); RNA_def_property_range(prop, 1, 65536); RNA_def_property_ui_text(prop, "Generated Height", "Generated image height"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop = RNA_def_property(srna, "use_generated_float", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gen_flag", IMA_GEN_FLOAT); RNA_def_property_ui_text(prop, "Float Buffer", "Generate floating point buffer"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop = RNA_def_property(srna, "generated_color", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "gen_color"); RNA_def_property_array(prop, 4); RNA_def_property_ui_text(prop, "Color", "Fill color for the generated image"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop = RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); RNA_def_property_float_sdna(prop, NULL, "aspx"); RNA_def_property_array(prop, 2); RNA_def_property_range(prop, 0.1f, FLT_MAX); RNA_def_property_ui_range(prop, 0.1f, 5000.f, 1, 2); RNA_def_property_ui_text( prop, "Display Aspect", "Display Aspect for this image, does not affect rendering"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "bindcode", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_funcs(prop, "rna_Image_bindcode_get", NULL, NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Bindcode", "OpenGL bindcode"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL); prop = RNA_def_property(srna, "render_slots", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "RenderSlot"); RNA_def_property_collection_sdna(prop, NULL, "renderslots", NULL); RNA_def_property_ui_text(prop, "Render Slots", "Render slots of the image"); rna_def_render_slots(brna, prop); /* * Image.has_data and Image.depth are temporary, * Update import_obj.py when they are replaced (Arystan) */ prop = RNA_def_property(srna, "has_data", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_Image_has_data_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Has Data", "True if the image data is loaded into memory"); prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_funcs(prop, "rna_Image_depth_get", NULL, NULL); RNA_def_property_ui_text(prop, "Depth", "Image bit depth"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_int_vector(srna, "size", 2, NULL, 0, 0, "Size", "Width and height in pixels, zero when image data cant be loaded", 0, 0); RNA_def_property_subtype(prop, PROP_PIXEL); RNA_def_property_int_funcs(prop, "rna_Image_size_get", NULL, NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_float_vector( srna, "resolution", 2, NULL, 0, 0, "Resolution", "X/Y pixels per meter", 0, 0); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); RNA_def_property_float_funcs(prop, "rna_Image_resolution_get", "rna_Image_resolution_set", NULL); prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_funcs(prop, "rna_Image_frame_duration_get", NULL, NULL); RNA_def_property_ui_text( prop, "Duration", "Duration (in frames) of the image (1 when not a video/sequence)"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* NOTE about pixels/channels/is_floa: * this properties describes how image is stored internally (inside of ImBuf), * not how it was saved to disk or how it'll be saved on disk */ prop = RNA_def_property(srna, "pixels", PROP_FLOAT, PROP_NONE); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_multi_array(prop, 1, NULL); RNA_def_property_ui_text(prop, "Pixels", "Image pixels in floating point values"); RNA_def_property_dynamic_array_funcs(prop, "rna_Image_pixels_get_length"); RNA_def_property_float_funcs(prop, "rna_Image_pixels_get", "rna_Image_pixels_set", NULL); prop = RNA_def_property(srna, "channels", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_funcs(prop, "rna_Image_channels_get", NULL, NULL); RNA_def_property_ui_text(prop, "Channels", "Number of channels in pixels buffer"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "is_float", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_Image_is_float_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Is Float", "True if this image is stored in float buffer"); prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "colorspace_settings"); RNA_def_property_struct_type(prop, "ColorManagedInputColorspaceSettings"); RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings"); prop = RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); RNA_def_property_enum_items(prop, alpha_mode_items); RNA_def_property_ui_text(prop, "Alpha Mode", "Representation of alpha in the image file, to convert to and from " "when saving and loading the image"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_colormanage_update"); /* multiview */ prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); RNA_def_property_enum_sdna(prop, NULL, "views_format"); RNA_def_property_enum_items(prop, rna_enum_views_format_items); RNA_def_property_ui_text(prop, "Views Format", "Mode to load image views"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_views_format_update"); prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format"); RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_struct_type(prop, "Stereo3dFormat"); RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d"); RNA_api_image(srna); }
void RNA_api_scene(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; func = RNA_def_function(srna, "frame_set", "rna_Scene_frame_set"); RNA_def_function_ui_description(func, "Set scene frame updating all objects immediately"); parm = RNA_def_int(func, "frame", 0, MINAFRAME, MAXFRAME, "", "Frame number to set", MINAFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_float(func, "subframe", 0.0, 0.0, 1.0, "", "Sub-frame time, between 0.0 and 1.0", 0.0, 1.0); func = RNA_def_function(srna, "update", "rna_Scene_update_tagged"); RNA_def_function_ui_description(func, "Update data tagged to be updated from previous access to data or operators"); /* Ray Cast */ func = RNA_def_function(srna, "ray_cast", "rna_Scene_ray_cast"); RNA_def_function_ui_description(func, "Cast a ray onto in object space"); /* ray start and end */ parm = RNA_def_float_vector(func, "start", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_float_vector(func, "end", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); RNA_def_property_flag(parm, PROP_REQUIRED); /* return location and normal */ parm = RNA_def_boolean(func, "result", 0, "", ""); RNA_def_function_output(func, parm); parm = RNA_def_pointer(func, "object", "Object", "", "Ray cast object"); RNA_def_function_output(func, parm); parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f); RNA_def_function_output(func, parm); parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "The hit location of this ray cast", -1e4, 1e4); RNA_def_property_flag(parm, PROP_THICK_WRAP); RNA_def_function_output(func, parm); parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "The face normal at the ray cast hit location", -1e4, 1e4); RNA_def_property_flag(parm, PROP_THICK_WRAP); RNA_def_function_output(func, parm); #ifdef WITH_COLLADA /* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */ func = RNA_def_function(srna, "collada_export", "rna_Scene_collada_export"); parm = RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */ parm = RNA_def_boolean(func, "apply_modifiers", 0, "Apply Modifiers", "Apply modifiers"); parm = RNA_def_int(func, "export_mesh_type", 0, INT_MIN, INT_MAX, "Resolution", "Modifier resolution for export", INT_MIN, INT_MAX); parm = RNA_def_boolean(func, "selected", 0, "Selection Only", "Export only selected elements"); parm = RNA_def_boolean(func, "include_children", 0, "Include Children", "Export all children of selected objects (even if not selected)"); parm = RNA_def_boolean(func, "include_armatures", 0, "Include Armatures", "Export related armatures (even if not selected)"); parm = RNA_def_boolean(func, "include_shapekeys", 0, "Include Shape Keys", "Export all Shape Keys from Mesh Objects"); parm = RNA_def_boolean(func, "deform_bones_only", 0, "Deform Bones only", "Only export deforming bones with armatures"); parm = RNA_def_boolean(func, "active_uv_only", 0, "Active UV Layer only", "Export only the active UV Layer"); parm = RNA_def_boolean(func, "include_uv_textures", 0, "Include UV Textures", "Export textures assigned to the object UV maps"); parm = RNA_def_boolean(func, "include_material_textures", 0, "Include Material Textures", "Export textures assigned to the object Materials"); parm = RNA_def_boolean(func, "use_texture_copies", 0, "copy", "Copy textures to same folder where the .dae file is exported"); parm = RNA_def_boolean(func, "use_ngons", 1, "Use NGons", "Keep NGons in Export"); parm = RNA_def_boolean(func, "use_object_instantiation", 1, "Use Object Instances", "Instantiate multiple Objects from same Data"); parm = RNA_def_boolean(func, "sort_by_name", 0, "Sort by Object name", "Sort exported data by Object name"); parm = RNA_def_boolean(func, "second_life", 0, "Export for Second Life", "Compatibility mode for Second Life"); parm = RNA_def_int(func, "export_transformation_type", 0, INT_MIN, INT_MAX, "Transformation", "Transformation type for translation, scale and rotation", INT_MIN, INT_MAX); RNA_def_function_ui_description(func, "Export to collada file"); #endif }