static void rna_def_view2d_api(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; static const float view_default[2] = {0.0f, 0.0f}; static const int region_default[2] = {0.0f, 0.0f}; func = RNA_def_function(srna, "region_to_view", "rna_View2D_region_to_view"); RNA_def_function_ui_description(func, "Transform region coordinates to 2D view"); parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "x", "Region x coordinate", -10000, 10000); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "y", "Region y coordinate", -10000, 10000); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_float_array(func, "result", 2, view_default, -FLT_MAX, FLT_MAX, "Result", "View coordinates", -10000.0f, 10000.0f); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); RNA_def_function_output(func, parm); func = RNA_def_function(srna, "view_to_region", "rna_View2D_view_to_region"); RNA_def_function_ui_description(func, "Transform 2D view coordinates to region"); parm = RNA_def_float(func, "x", 0.0f, -FLT_MAX, FLT_MAX, "x", "2D View x coordinate", -10000.0f, 10000.0f); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_float(func, "y", 0.0f, -FLT_MAX, FLT_MAX, "y", "2D View y coordinate", -10000.0f, 10000.0f); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_boolean(func, "clip", 1, "Clip", "Clip coordinates to the visible region"); parm = RNA_def_int_array(func, "result", 2, region_default, INT_MIN, INT_MAX, "Result", "Region coordinates", -10000, 10000); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); RNA_def_function_output(func, parm); }
void RNA_api_environment_map(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; static const float default_layout[] = {0, 0, 1, 0, 2, 0, 0, 1, 1, 1, 2, 1}; func = RNA_def_function(srna, "clear", "clear_envmap"); RNA_def_function_ui_description(func, "Discard the environment map and free it from memory"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "save", "save_envmap"); RNA_def_function_ui_description(func, "Save the environment map to disc using the scene render settings"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_string_file_name(func, "filepath", "", FILE_MAX, "File path", "Location of the output file"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_pointer(func, "scene", "Scene", "", "Overrides the scene from which image parameters are taken"); RNA_def_float_array(func, "layout", 12, default_layout, 0.0f, 1000.0f, "File layout", "Flat array describing the X,Y position of each cube face in the " "output image, where 1 is the size of a face - order is [+Z -Z +Y -X -Y +X] " "(use -1 to skip a face)", 0.0f, 1000.0f); }
void RNA_api_mesh(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; const int normals_array_dim[] = {1, 3}; func = RNA_def_function(srna, "transform", "rna_Mesh_transform"); RNA_def_function_ui_description(func, "Transform mesh vertices by a matrix " "(Warning: inverts normals if matrix is negative)"); parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_boolean(func, "shape_keys", 0, "", "Transform Shape Keys"); func = RNA_def_function(srna, "flip_normals", "rna_Mesh_flip_normals"); RNA_def_function_ui_description(func, "Invert winding of all polygons " "(clears tessellation, does not handle custom normals)"); func = RNA_def_function(srna, "calc_normals", "BKE_mesh_calc_normals"); RNA_def_function_ui_description(func, "Calculate vertex normals"); func = RNA_def_function(srna, "create_normals_split", "rna_Mesh_create_normals_split"); RNA_def_function_ui_description(func, "Empty split vertex normals"); func = RNA_def_function(srna, "calc_normals_split", "BKE_mesh_calc_normals_split"); RNA_def_function_ui_description(func, "Calculate split vertex normals, which preserve sharp edges"); func = RNA_def_function(srna, "free_normals_split", "rna_Mesh_free_normals_split"); RNA_def_function_ui_description(func, "Free split vertex normals"); func = RNA_def_function(srna, "calc_tangents", "rna_Mesh_calc_tangents"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Compute tangents and bitangent signs, to be used together with the split normals " "to get a complete tangent space for normal mapping " "(split normals are also computed if not yet present)"); parm = RNA_def_string(func, "uvmap", NULL, MAX_CUSTOMDATA_LAYER_NAME, "", "Name of the UV map to use for tangent space computation"); func = RNA_def_function(srna, "free_tangents", "rna_Mesh_free_tangents"); RNA_def_function_ui_description(func, "Free tangents"); func = RNA_def_function(srna, "calc_tessface", "rna_Mesh_calc_tessface"); RNA_def_function_ui_description(func, "Calculate face tessellation (supports editmode too)"); RNA_def_boolean(func, "free_mpoly", 0, "Free MPoly", "Free data used by polygons and loops. " "WARNING: This destructive operation removes regular faces, " "only used on temporary mesh data-blocks to reduce memory footprint of render " "engines and export scripts"); func = RNA_def_function(srna, "calc_smooth_groups", "rna_Mesh_calc_smooth_groups"); RNA_def_function_ui_description(func, "Calculate smooth groups from sharp edges"); RNA_def_boolean(func, "use_bitflags", false, "", "Produce bitflags groups instead of simple numeric values"); /* return values */ parm = RNA_def_int_array(func, "poly_groups", 1, NULL, 0, 0, "", "Smooth Groups", 0, 0); RNA_def_property_flag(parm, PROP_DYNAMIC | PROP_OUTPUT); parm = RNA_def_int(func, "groups", 0, 0, INT_MAX, "groups", "Total number of groups", 0, INT_MAX); RNA_def_property_flag(parm, PROP_OUTPUT); func = RNA_def_function(srna, "normals_split_custom_set", "rna_Mesh_normals_split_custom_set"); RNA_def_function_ui_description(func, "Define custom split normals of this mesh " "(use zero-vectors to keep auto ones)"); RNA_def_function_flag(func, FUNC_USE_REPORTS); /* TODO, see how array size of 0 works, this shouldnt be used */ parm = RNA_def_float_array(func, "normals", 1, NULL, -1.0f, 1.0f, "", "Normals", 0.0f, 0.0f); RNA_def_property_multi_array(parm, 2, normals_array_dim); RNA_def_property_flag(parm, PROP_DYNAMIC | PROP_REQUIRED); func = RNA_def_function(srna, "normals_split_custom_set_from_vertices", "rna_Mesh_normals_split_custom_set_from_vertices"); RNA_def_function_ui_description(func, "Define custom split normals of this mesh, from vertices' normals " "(use zero-vectors to keep auto ones)"); RNA_def_function_flag(func, FUNC_USE_REPORTS); /* TODO, see how array size of 0 works, this shouldnt be used */ parm = RNA_def_float_array(func, "normals", 1, NULL, -1.0f, 1.0f, "", "Normals", 0.0f, 0.0f); RNA_def_property_multi_array(parm, 2, normals_array_dim); RNA_def_property_flag(parm, PROP_DYNAMIC | PROP_REQUIRED); func = RNA_def_function(srna, "update", "ED_mesh_update"); RNA_def_boolean(func, "calc_edges", 0, "Calculate Edges", "Force recalculation of edges"); RNA_def_boolean(func, "calc_tessface", 0, "Calculate Tessellation", "Force recalculation of tessellation faces"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "unit_test_compare", "rna_Mesh_unit_test_compare"); RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to compare to"); /* return value */ parm = RNA_def_string(func, "result", "nothing", 64, "Return value", "String description of result of comparison"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "validate", "BKE_mesh_validate"); RNA_def_function_ui_description(func, "Validate geometry, return True when the mesh has had " "invalid geometry corrected/removed"); RNA_def_boolean(func, "verbose", false, "Verbose", "Output information about the errors found"); RNA_def_boolean(func, "clean_customdata", true, "Clean Custom Data", "Remove temp/cached custom-data layers, like e.g. normals..."); parm = RNA_def_boolean(func, "result", 0, "Result", ""); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "validate_material_indices", "BKE_mesh_validate_material_indices"); RNA_def_function_ui_description(func, "Validate material indices of polygons, return True when the mesh has had " "invalid indices corrected (to default 0)"); parm = RNA_def_boolean(func, "result", 0, "Result", ""); RNA_def_function_return(func, parm); }
void RNA_def_test(BlenderRNA *brna) { #ifdef UNIT_TEST StructRNA *srna; PropertyRNA *prop; unsigned short dimsize[]= {MARRAY_DIMSIZE}; srna= RNA_def_struct(brna, "Test", NULL); RNA_def_struct_sdna(srna, "Test"); prop= RNA_def_float_array(srna, "farr", ARRAY_SIZE, NULL, 0.0f, 0.0f, "farr", "float array", 0.0f, 0.0f); RNA_def_property_float_funcs(prop, "rna_Test_farr_get", "rna_Test_farr_set", NULL); prop= RNA_def_int_array(srna, "iarr", ARRAY_SIZE, NULL, 0, 0, "iarr", "int array", 0, 0); RNA_def_property_int_funcs(prop, "rna_Test_iarr_get", "rna_Test_iarr_set", NULL); prop= RNA_def_boolean_array(srna, "barr", ARRAY_SIZE, NULL, "barr", "boolean array"); RNA_def_property_boolean_funcs(prop, "rna_Test_barr_get", "rna_Test_barr_set"); /* dynamic arrays */ prop= RNA_def_float_array(srna, "fdarr", DYNAMIC_ARRAY_SIZE, NULL, 0.0f, 0.0f, "fdarr", "dynamic float array", 0.0f, 0.0f); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_dynamic_array_funcs(prop, "rna_Test_fdarr_get_length", "rna_Test_fdarr_set_length"); RNA_def_property_float_funcs(prop, "rna_Test_fdarr_get", "rna_Test_fdarr_set", NULL); prop= RNA_def_int_array(srna, "idarr", DYNAMIC_ARRAY_SIZE, NULL, 0, 0, "idarr", "int array", 0, 0); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_dynamic_array_funcs(prop, "rna_Test_idarr_get_length", "rna_Test_idarr_set_length"); RNA_def_property_int_funcs(prop, "rna_Test_idarr_get", "rna_Test_idarr_set", NULL); prop= RNA_def_boolean_array(srna, "bdarr", DYNAMIC_ARRAY_SIZE, NULL, "bdarr", "boolean array"); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_dynamic_array_funcs(prop, "rna_Test_bdarr_get_length", "rna_Test_bdarr_set_length"); RNA_def_property_boolean_funcs(prop, "rna_Test_bdarr_get", "rna_Test_bdarr_set"); /* multidimensional arrays */ prop= RNA_def_property(srna, "fmarr", PROP_FLOAT, PROP_NONE); RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(float), MARRAY_TOTDIM, dimsize); RNA_def_property_float_funcs(prop, "rna_Test_fmarr_get", "rna_Test_fmarr_set", NULL); prop= RNA_def_property(srna, "imarr", PROP_INT, PROP_NONE); RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize); RNA_def_property_int_funcs(prop, "rna_Test_imarr_get", "rna_Test_imarr_set", NULL); prop= RNA_def_property(srna, "bmarr", PROP_BOOLEAN, PROP_NONE); RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize); RNA_def_property_boolean_funcs(prop, "rna_Test_bmarr_get", "rna_Test_bmarr_set"); /* dynamic multidimensional arrays */ prop= RNA_def_property(srna, "fdmarr", PROP_FLOAT, PROP_NONE); RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(float), MARRAY_TOTDIM, dimsize); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_dynamic_array_funcs(prop, "rna_Test_fdmarr_get_length", "rna_Test_fdmarr_set_length"); RNA_def_property_float_funcs(prop, "rna_Test_fdmarr_get", "rna_Test_fdmarr_set", NULL); prop= RNA_def_property(srna, "idmarr", PROP_INT, PROP_NONE); RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_dynamic_array_funcs(prop, "rna_Test_idmarr_get_length", "rna_Test_idmarr_set_length"); RNA_def_property_int_funcs(prop, "rna_Test_idmarr_get", "rna_Test_idmarr_set", NULL); prop= RNA_def_property(srna, "bdmarr", PROP_BOOLEAN, PROP_NONE); RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize); RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_dynamic_array_funcs(prop, "rna_Test_bdmarr_get_length", "rna_Test_bdmarr_set_length"); RNA_def_property_boolean_funcs(prop, "rna_Test_bdmarr_get", "rna_Test_bdmarr_set"); #endif }
void RNA_api_object(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; static const EnumPropertyItem mesh_type_items[] = { {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"}, {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"}, {0, NULL, 0, NULL, NULL} }; static const EnumPropertyItem dupli_eval_mode_items[] = { {DAG_EVAL_VIEWPORT, "VIEWPORT", 0, "Viewport", "Generate duplis using viewport settings"}, {DAG_EVAL_PREVIEW, "PREVIEW", 0, "Preview", "Generate duplis using preview settings"}, {DAG_EVAL_RENDER, "RENDER", 0, "Render", "Generate duplis using render settings"}, {0, NULL, 0, NULL, NULL} }; #ifndef NDEBUG static const EnumPropertyItem mesh_dm_info_items[] = { {0, "SOURCE", 0, "Source", "Source mesh"}, {1, "DEFORM", 0, "Deform", "Objects deform mesh"}, {2, "FINAL", 0, "Final", "Objects final mesh"}, {0, NULL, 0, NULL, NULL} }; #endif /* Matrix space conversion */ func = RNA_def_function(srna, "convert_space", "rna_Scene_mat_convert_space"); RNA_def_function_ui_description(func, "Convert (transform) the given matrix from one space to another"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "pose_bone", "PoseBone", "", "Bone to use to define spaces (may be None, in which case only the two 'WORLD' and " "'LOCAL' spaces are usable)"); parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(parm, "", "The matrix to transform"); parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(parm, "", "The transformed matrix"); RNA_def_function_output(func, parm); parm = RNA_def_enum(func, "from_space", space_items, CONSTRAINT_SPACE_WORLD, "", "The space in which 'matrix' is currently"); parm = RNA_def_enum(func, "to_space", space_items, CONSTRAINT_SPACE_WORLD, "", "The space to which you want to transform 'matrix'"); /* Camera-related operations */ func = RNA_def_function(srna, "calc_matrix_camera", "rna_Object_calc_matrix_camera"); RNA_def_function_ui_description(func, "Generate the camera projection matrix of this object " "(mostly useful for Camera and Lamp types)"); parm = RNA_def_property(func, "result", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(parm, "", "The camera projection matrix"); RNA_def_function_output(func, parm); parm = RNA_def_int(func, "x", 1, 0, INT_MAX, "", "Width of the render area", 0, 10000); parm = RNA_def_int(func, "y", 1, 0, INT_MAX, "", "Height of the render area", 0, 10000); parm = RNA_def_float(func, "scale_x", 1.0f, 1.0e-6f, FLT_MAX, "", "Width scaling factor", 1.0e-2f, 100.0f); parm = RNA_def_float(func, "scale_y", 1.0f, 1.0e-6f, FLT_MAX, "", "height scaling factor", 1.0e-2f, 100.0f); func = RNA_def_function(srna, "camera_fit_coords", "rna_Object_camera_fit_coords"); RNA_def_function_ui_description(func, "Compute the coordinate (and scale for ortho cameras) " "given object should be to 'see' all given coordinates"); parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to get render size information from, if available"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_float_array(func, "coordinates", 1, NULL, -FLT_MAX, FLT_MAX, "", "Coordinates to fit in", -FLT_MAX, FLT_MAX); RNA_def_parameter_flags(parm, PROP_NEVER_NULL | PROP_DYNAMIC, PARM_REQUIRED); parm = RNA_def_property(func, "co_return", PROP_FLOAT, PROP_XYZ); RNA_def_property_array(parm, 3); RNA_def_property_ui_text(parm, "", "The location to aim to be able to see all given points"); RNA_def_parameter_flags(parm, 0, PARM_OUTPUT); parm = RNA_def_property(func, "scale_return", PROP_FLOAT, PROP_NONE); RNA_def_property_ui_text(parm, "", "The ortho scale to aim to be able to see all given points (if relevant)"); RNA_def_parameter_flags(parm, 0, PARM_OUTPUT); /* mesh */ func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh"); RNA_def_function_ui_description(func, "Create a Mesh data-block with modifiers applied"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_boolean(func, "calc_tessface", true, "Calculate Tessellation", "Calculate tessellation faces"); RNA_def_boolean(func, "calc_undeformed", false, "Calculate Undeformed", "Calculate undeformed vertex coordinates"); parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh created from object, remove it if it is only used for export"); RNA_def_function_return(func, parm); /* duplis */ func = RNA_def_function(srna, "dupli_list_create", "rna_Object_create_duplilist"); RNA_def_function_ui_description(func, "Create a list of dupli objects for this object, needs to " "be freed manually with free_dupli_list to restore the " "objects real matrix and layers"); parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate duplis"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); RNA_def_enum(func, "settings", dupli_eval_mode_items, 0, "", "Generate texture coordinates for rendering"); RNA_def_function_flag(func, FUNC_USE_REPORTS); func = RNA_def_function(srna, "dupli_list_clear", "rna_Object_free_duplilist"); RNA_def_function_ui_description(func, "Free the list of dupli objects"); /* Armature */ func = RNA_def_function(srna, "find_armature", "modifiers_isDeformedByArmature"); RNA_def_function_ui_description(func, "Find armature influencing this object as a parent or via a modifier"); parm = RNA_def_pointer(func, "ob_arm", "Object", "", "Armature object influencing this object or NULL"); RNA_def_function_return(func, parm); /* Shape key */ func = RNA_def_function(srna, "shape_key_add", "rna_Object_shape_key_add"); RNA_def_function_ui_description(func, "Add shape key to this object"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); RNA_def_string(func, "name", "Key", 0, "", "Unique name for the new keyblock"); /* optional */ RNA_def_boolean(func, "from_mix", 1, "", "Create new shape from existing mix of shapes"); parm = RNA_def_pointer(func, "key", "ShapeKey", "", "New shape keyblock"); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "shape_key_remove", "rna_Object_shape_key_remove"); RNA_def_function_ui_description(func, "Remove a Shape Key from this object"); RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "key", "ShapeKey", "", "Keyblock to be removed"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); /* Ray Cast */ func = RNA_def_function(srna, "ray_cast", "rna_Object_ray_cast"); RNA_def_function_ui_description(func, "Cast a ray onto in object space"); RNA_def_function_flag(func, FUNC_USE_REPORTS); /* ray start and end */ parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_float_vector(func, "direction", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_float(func, "distance", BVH_RAYCAST_DIST_MAX, 0.0, BVH_RAYCAST_DIST_MAX, "", "Maximum distance", 0.0, BVH_RAYCAST_DIST_MAX); /* return location and normal */ parm = RNA_def_boolean(func, "result", 0, "", ""); 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_parameter_flags(parm, PROP_THICK_WRAP, 0); 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_parameter_flags(parm, PROP_THICK_WRAP, 0); RNA_def_function_output(func, parm); parm = RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0); RNA_def_function_output(func, parm); /* Nearest Point */ func = RNA_def_function(srna, "closest_point_on_mesh", "rna_Object_closest_point_on_mesh"); RNA_def_function_ui_description(func, "Find the nearest point in object space"); RNA_def_function_flag(func, FUNC_USE_REPORTS); /* location of point for test and max distance */ parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* default is sqrt(FLT_MAX) */ RNA_def_float(func, "distance", 1.844674352395373e+19, 0.0, FLT_MAX, "", "Maximum distance", 0.0, FLT_MAX); /* return location and normal */ parm = RNA_def_boolean(func, "result", 0, "", ""); RNA_def_function_output(func, parm); parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "The location on the object closest to the point", -1e4, 1e4); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); 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 closest point", -1e4, 1e4); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); RNA_def_function_output(func, parm); parm = RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0); RNA_def_function_output(func, parm); /* View */ func = RNA_def_function(srna, "is_visible", "rna_Object_is_visible"); RNA_def_function_ui_description(func, "Determine if object is visible in a given scene"); parm = RNA_def_pointer(func, "scene", "Scene", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_boolean(func, "result", 0, "", "Object visibility"); RNA_def_function_return(func, parm); /* utility function for checking if the object is modified */ func = RNA_def_function(srna, "is_modified", "rna_Object_is_modified"); RNA_def_function_ui_description(func, "Determine if this object is modified from the base mesh data"); parm = RNA_def_pointer(func, "scene", "Scene", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_boolean(func, "result", 0, "", "Object visibility"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "is_deform_modified", "rna_Object_is_deform_modified"); RNA_def_function_ui_description(func, "Determine if this object is modified by a deformation from the base mesh data"); parm = RNA_def_pointer(func, "scene", "Scene", "", ""); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_boolean(func, "result", 0, "", "Object visibility"); RNA_def_function_return(func, parm); #ifndef NDEBUG /* mesh */ func = RNA_def_function(srna, "dm_info", "rna_Object_dm_info"); RNA_def_function_ui_description(func, "Returns a string for derived mesh data"); parm = RNA_def_enum(func, "type", mesh_dm_info_items, 0, "", "Modifier settings to apply"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* weak!, no way to return dynamic string type */ parm = RNA_def_string(func, "result", NULL, 16384, "result", ""); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */ RNA_def_function_output(func, parm); #endif /* NDEBUG */ func = RNA_def_function(srna, "update_from_editmode", "rna_Object_update_from_editmode"); RNA_def_function_ui_description(func, "Load the objects edit-mode data into the object data"); parm = RNA_def_boolean(func, "result", 0, "", "Success"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "cache_release", "BKE_object_free_caches"); RNA_def_function_ui_description(func, "Release memory used by caches associated with this object. Intended to be used by render engines only"); }
void RNA_api_ui_layout(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; static EnumPropertyItem curve_type_items[] = { {0, "NONE", 0, "None", ""}, {'v', "VECTOR", 0, "Vector", ""}, {'c', "COLOR", 0, "Color", ""}, {'h', "HUE", 0, "Hue", ""}, {0, NULL, 0, NULL, NULL} }; static float node_socket_color_default[] = { 0.0f, 0.0f, 0.0f, 1.0f }; /* simple layout specifiers */ func = RNA_def_function(srna, "row", "uiLayoutRow"); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_function_ui_description(func, "Sub-layout. Items placed in this sublayout are placed next to each other " "in a row"); RNA_def_boolean(func, "align", false, "", "Align buttons to each other"); func = RNA_def_function(srna, "column", "uiLayoutColumn"); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_function_ui_description(func, "Sub-layout. Items placed in this sublayout are placed under each other " "in a column"); RNA_def_boolean(func, "align", false, "", "Align buttons to each other"); func = RNA_def_function(srna, "column_flow", "uiLayoutColumnFlow"); RNA_def_int(func, "columns", 0, 0, INT_MAX, "", "Number of columns, 0 is automatic", 0, INT_MAX); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_boolean(func, "align", false, "", "Align buttons to each other"); /* box layout */ func = RNA_def_function(srna, "box", "uiLayoutBox"); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_function_ui_description(func, "Sublayout (items placed in this sublayout are placed " "under each other in a column and are surrounded by a box)"); /* split layout */ func = RNA_def_function(srna, "split", "uiLayoutSplit"); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_float(func, "percentage", 0.0f, 0.0f, 1.0f, "Percentage", "Percentage of width to split at", 0.0f, 1.0f); RNA_def_boolean(func, "align", false, "", "Align buttons to each other"); /* radial/pie layout */ func = RNA_def_function(srna, "menu_pie", "uiLayoutRadial"); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); RNA_def_function_ui_description(func, "Sublayout. Items placed in this sublayout are placed " "in a radial fashion around the menu center)"); /* Icon of a rna pointer */ func = RNA_def_function(srna, "icon", "rna_ui_get_rnaptr_icon"); parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX); RNA_def_function_return(func, parm); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take the icon"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); RNA_def_function_ui_description(func, "Return the custom icon for this data, " "use it e.g. to get materials or texture icons"); /* UI name, description and icon of an enum item */ func = RNA_def_function(srna, "enum_item_name", "rna_ui_get_enum_name"); parm = RNA_def_string(func, "name", NULL, 0, "", "UI name of the enum item"); RNA_def_function_return(func, parm); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); api_ui_item_rna_common(func); parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_function_ui_description(func, "Return the UI name for this enum item"); func = RNA_def_function(srna, "enum_item_description", "rna_ui_get_enum_description"); parm = RNA_def_string(func, "description", NULL, 0, "", "UI description of the enum item"); RNA_def_function_return(func, parm); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); api_ui_item_rna_common(func); parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_function_ui_description(func, "Return the UI description for this enum item"); func = RNA_def_function(srna, "enum_item_icon", "rna_ui_get_enum_icon"); parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX); RNA_def_function_return(func, parm); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT); api_ui_item_rna_common(func); parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_function_ui_description(func, "Return the icon for this enum item"); /* items */ func = RNA_def_function(srna, "prop", "rna_uiItemR"); RNA_def_function_ui_description(func, "Item. Exposes an RNA item and places it into the layout"); api_ui_item_rna_common(func); api_ui_item_common(func); RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail"); RNA_def_boolean(func, "slider", false, "", "Use slider widget for numeric values"); RNA_def_boolean(func, "toggle", false, "", "Use toggle widget for boolean values"); RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in buttons, no text"); RNA_def_boolean(func, "event", false, "", "Use button to input key events"); RNA_def_boolean(func, "full_event", false, "", "Use button to input full events including modifiers"); RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, just the icon/text"); RNA_def_int(func, "index", -1, -2, INT_MAX, "", "The index of this button, when set a single member of an array can be accessed, " "when set to -1 all array members are used", -2, INT_MAX); /* RNA_NO_INDEX == -1 */ parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item"); func = RNA_def_function(srna, "props_enum", "uiItemsEnumR"); api_ui_item_rna_common(func); func = RNA_def_function(srna, "prop_menu_enum", "rna_uiItemMenuEnumR"); api_ui_item_rna_common(func); api_ui_item_common(func); func = RNA_def_function(srna, "prop_enum", "rna_uiItemEnumR_string"); api_ui_item_rna_common(func); parm = RNA_def_string(func, "value", NULL, 0, "", "Enum property value"); RNA_def_property_flag(parm, PROP_REQUIRED); api_ui_item_common(func); func = RNA_def_function(srna, "prop_search", "rna_uiItemPointerR"); api_ui_item_rna_common(func); parm = RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); parm = RNA_def_string(func, "search_property", NULL, 0, "", "Identifier of search collection property"); RNA_def_property_flag(parm, PROP_REQUIRED); api_ui_item_common(func); func = RNA_def_function(srna, "operator", "rna_uiItemO"); api_ui_item_op_common(func); RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, just the icon/text"); parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item"); parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "Operator properties to fill in, return when 'properties' is set to true"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); RNA_def_function_return(func, parm); RNA_def_function_ui_description(func, "Item. Places a button into the layout to call an Operator"); func = RNA_def_function(srna, "operator_enum", "uiItemsEnumO"); parm = RNA_def_string(func, "operator", NULL, 0, "", "Identifier of the operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "operator_menu_enum", "rna_uiItemMenuEnumO"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_op(func); /* cant use api_ui_item_op_common because property must come right after */ parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); api_ui_item_common(func); /* useful in C but not in python */ #if 0 func = RNA_def_function(srna, "operator_enum_single", "uiItemEnumO_string"); api_ui_item_op_common(func); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "value", NULL, 0, "", "Enum property value"); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "operator_boolean", "uiItemBooleanO"); api_ui_item_op_common(func); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_boolean(func, "value", false, "", "Value of the property to call the operator with"); RNA_def_property_flag(parm, PROP_REQUIRED); */ func = RNA_def_function(srna, "operator_int", "uiItemIntO"); api_ui_item_op_common(func); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "value", 0, INT_MIN, INT_MAX, "", "Value of the property to call the operator with", INT_MIN, INT_MAX); RNA_def_property_flag(parm, PROP_REQUIRED); */ func = RNA_def_function(srna, "operator_float", "uiItemFloatO"); api_ui_item_op_common(func); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_float(func, "value", 0, -FLT_MAX, FLT_MAX, "", "Value of the property to call the operator with", -FLT_MAX, FLT_MAX); RNA_def_property_flag(parm, PROP_REQUIRED); */ func = RNA_def_function(srna, "operator_string", "uiItemStringO"); api_ui_item_op_common(func); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "value", NULL, 0, "", "Value of the property to call the operator with"); RNA_def_property_flag(parm, PROP_REQUIRED); #endif func = RNA_def_function(srna, "label", "rna_uiItemL"); RNA_def_function_ui_description(func, "Item. Display text and/or icon in the layout"); api_ui_item_common(func); parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item"); func = RNA_def_function(srna, "menu", "rna_uiItemM"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu"); api_ui_item_common(func); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item"); func = RNA_def_function(srna, "separator", "uiItemS"); RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items"); /* context */ func = RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer"); parm = RNA_def_string(func, "name", NULL, 0, "Name", "Name of entry in the context"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); /* templates */ func = RNA_def_function(srna, "template_header", "uiTemplateHeader"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "template_ID", "uiTemplateID"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block"); RNA_def_string(func, "open", NULL, 0, "", "Operator identifier to open a file for creating a new ID block"); RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block"); func = RNA_def_function(srna, "template_ID_preview", "uiTemplateIDPreview"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block"); RNA_def_string(func, "open", NULL, 0, "", "Operator identifier to open a file for creating a new ID block"); RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block"); RNA_def_int(func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX); RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX); func = RNA_def_function(srna, "template_any_ID", "rna_uiTemplateAnyID"); parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "type_property", NULL, 0, "", "Identifier of property in data giving the type of the ID-blocks to use"); RNA_def_property_flag(parm, PROP_REQUIRED); api_ui_item_common_text(func); func = RNA_def_function(srna, "template_path_builder", "rna_uiTemplatePathBuilder"); parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); api_ui_item_common_text(func); func = RNA_def_function(srna, "template_modifier", "uiTemplateModifier"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_function_ui_description(func, "Generates the UI layout for modifiers"); parm = RNA_def_pointer(func, "data", "Modifier", "", "Modifier data"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "template_constraint", "uiTemplateConstraint"); RNA_def_function_ui_description(func, "Generates the UI layout for constraints"); parm = RNA_def_pointer(func, "data", "Constraint", "", "Constraint data"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "template_preview", "uiTemplatePreview"); RNA_def_function_ui_description(func, "Item. A preview window for materials, textures, lamps or worlds"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "id", "ID", "", "ID data-block"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_boolean(func, "show_buttons", true, "", "Show preview buttons?"); RNA_def_pointer(func, "parent", "ID", "", "ID data-block"); RNA_def_pointer(func, "slot", "TextureSlot", "", "Texture slot"); RNA_def_string(func, "preview_id", NULL, 0, "", "Identifier of this preview widget, if not set the ID type will be used " "(i.e. all previews of materials without explicit ID will have the same size...)"); func = RNA_def_function(srna, "template_curve_mapping", "uiTemplateCurveMapping"); RNA_def_function_ui_description(func, "Item. A curve mapping widget used for e.g falloff curves for lamps"); api_ui_item_rna_common(func); RNA_def_enum(func, "type", curve_type_items, 0, "Type", "Type of curves to display"); RNA_def_boolean(func, "levels", false, "", "Show black/white levels"); RNA_def_boolean(func, "brush", false, "", "Show brush options"); RNA_def_boolean(func, "use_negative_slope", false, "", "Use a negative slope by default"); func = RNA_def_function(srna, "template_color_ramp", "uiTemplateColorRamp"); RNA_def_function_ui_description(func, "Item. A color ramp widget"); api_ui_item_rna_common(func); RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail"); func = RNA_def_function(srna, "template_icon_view", "uiTemplateIconView"); RNA_def_function_ui_description(func, "Enum. Large widget showing Icon previews"); api_ui_item_rna_common(func); RNA_def_boolean(func, "show_labels", false, "", "Show enum label in preview buttons"); RNA_def_float(func, "scale", 5.0f, 1.0f, 100.0f, "Scale", "Scale the icon size (by the button size)", 1.0f, 100.0f); func = RNA_def_function(srna, "template_histogram", "uiTemplateHistogram"); RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data"); api_ui_item_rna_common(func); func = RNA_def_function(srna, "template_waveform", "uiTemplateWaveform"); RNA_def_function_ui_description(func, "Item. A waveform widget to analyze imaga data"); api_ui_item_rna_common(func); func = RNA_def_function(srna, "template_vectorscope", "uiTemplateVectorscope"); RNA_def_function_ui_description(func, "Item. A vectorscope widget to analyze imaga data"); api_ui_item_rna_common(func); func = RNA_def_function(srna, "template_layers", "uiTemplateLayers"); api_ui_item_rna_common(func); parm = RNA_def_pointer(func, "used_layers_data", "AnyType", "", "Data from which to take property"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); parm = RNA_def_string(func, "used_layers_property", NULL, 0, "", "Identifier of property in data"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "active_layer", 0, 0, INT_MAX, "Active Layer", "", 0, INT_MAX); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "template_color_picker", "uiTemplateColorPicker"); RNA_def_function_ui_description(func, "Item. A color wheel widget to pick colors"); api_ui_item_rna_common(func); RNA_def_boolean(func, "value_slider", false, "", "Display the value slider to the right of the color wheel"); RNA_def_boolean(func, "lock", false, "", "Lock the color wheel display to value 1.0 regardless of actual color"); RNA_def_boolean(func, "lock_luminosity", false, "", "Keep the color at its original vector length"); RNA_def_boolean(func, "cubic", false, "", "Cubic saturation for picking values close to white"); func = RNA_def_function(srna, "template_palette", "uiTemplatePalette"); RNA_def_function_ui_description(func, "Item. A palette used to pick colors"); api_ui_item_rna_common(func); RNA_def_boolean(func, "color", 0, "", "Display the colors as colors or values"); func = RNA_def_function(srna, "template_image_layers", "uiTemplateImageLayers"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "image", "Image", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "image_user", "ImageUser", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "template_image", "uiTemplateImage"); RNA_def_function_ui_description(func, "Item(s). User interface for selecting images and their source paths"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); parm = RNA_def_pointer(func, "image_user", "ImageUser", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); RNA_def_boolean(func, "compact", false, "", "Use more compact layout"); RNA_def_boolean(func, "multiview", false, "", "Expose Multi-View options"); func = RNA_def_function(srna, "template_image_settings", "uiTemplateImageSettings"); RNA_def_function_ui_description(func, "User interface for setting image format options"); parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); RNA_def_boolean(func, "color_management", false, "", "Show color management settings"); func = RNA_def_function(srna, "template_image_stereo_3d", "uiTemplateImageStereo3d"); RNA_def_function_ui_description(func, "User interface for setting image stereo 3d options"); parm = RNA_def_pointer(func, "stereo_3d_format", "Stereo3dFormat", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); func = RNA_def_function(srna, "template_image_views", "uiTemplateImageViews"); RNA_def_function_ui_description(func, "User interface for setting image views output options"); parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); func = RNA_def_function(srna, "template_movieclip", "uiTemplateMovieClip"); RNA_def_function_ui_description(func, "Item(s). User interface for selecting movie clips and their source paths"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); RNA_def_boolean(func, "compact", false, "", "Use more compact layout"); func = RNA_def_function(srna, "template_track", "uiTemplateTrack"); RNA_def_function_ui_description(func, "Item. A movie-track widget to preview tracking image."); api_ui_item_rna_common(func); func = RNA_def_function(srna, "template_marker", "uiTemplateMarker"); RNA_def_function_ui_description(func, "Item. A widget to control single marker settings."); api_ui_item_rna_common(func); parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); RNA_def_boolean(func, "compact", false, "", "Use more compact layout"); func = RNA_def_function(srna, "template_movieclip_information", "uiTemplateMovieclipInformation"); RNA_def_function_ui_description(func, "Item. Movie clip information data."); api_ui_item_rna_common(func); parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); func = RNA_def_function(srna, "template_list", "uiTemplateList"); RNA_def_function_ui_description(func, "Item. A list widget to display data, e.g. vertexgroups."); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_string(func, "listtype_name", NULL, 0, "", "Identifier of the list type to use"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_string(func, "list_id", NULL, 0, "", "Identifier of this list widget (mandatory when using default \"" UI_UL_DEFAULT_CLASS_NAME "\" class). " "If this is set, the uilist gets a custom ID, otherwise it takes the " "name of the class used to define the uilist (for example, if the " "class name is \"OBJECT_UL_vgroups\", and list_id is not set by the " "script, then bl_idname = \"OBJECT_UL_vgroups\")"); parm = RNA_def_pointer(func, "dataptr", "AnyType", "", "Data from which to take the Collection property"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); parm = RNA_def_string(func, "propname", NULL, 0, "", "Identifier of the Collection property in data"); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "active_dataptr", "AnyType", "", "Data from which to take the integer property, index of the active item"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); parm = RNA_def_string(func, "active_propname", NULL, 0, "", "Identifier of the integer property in active_data, index of the active item"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_string(func, "item_dyntip_propname", NULL, 0, "", "Identifier of a string property in items, to use as tooltip content"); RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Default and minimum number of rows to display", 0, INT_MAX); RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Default maximum number of rows to display", 0, INT_MAX); RNA_def_enum(func, "type", uilist_layout_type_items, UILST_LAYOUT_DEFAULT, "Type", "Type of layout to use"); RNA_def_int(func, "columns", 9, 0, INT_MAX, "", "Number of items to display per row, for GRID layout", 0, INT_MAX); func = RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_function(srna, "template_operator_search", "uiTemplateOperatorSearch"); func = RNA_def_function(srna, "template_header_3D", "uiTemplateHeader3D"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "template_edit_mode_selection", "uiTemplateEditModeSelection"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "template_node_link", "uiTemplateNodeLink"); parm = RNA_def_pointer(func, "ntree", "NodeTree", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "node", "Node", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "socket", "NodeSocket", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "template_node_view", "uiTemplateNodeView"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_pointer(func, "ntree", "NodeTree", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "node", "Node", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_pointer(func, "socket", "NodeSocket", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "template_texture_user", "uiTemplateTextureUser"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); func = RNA_def_function(srna, "template_keymap_item_properties", "uiTemplateKeymapItemProperties"); parm = RNA_def_pointer(func, "item", "KeyMapItem", "", ""); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); func = RNA_def_function(srna, "template_component_menu", "uiTemplateComponentMenu"); RNA_def_function_ui_description(func, "Item. Display expanded property in a popup menu"); parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_string(func, "name", NULL, 0, "", ""); func = RNA_def_function(srna, "introspect", "uiLayoutIntrospect"); parm = RNA_def_string(func, "string", NULL, 1024 * 1024, "Descr", "DESCR"); RNA_def_function_return(func, parm); /* color management templates */ func = RNA_def_function(srna, "template_colorspace_settings", "uiTemplateColorspaceSettings"); RNA_def_function_ui_description(func, "Item. A widget to control input color space settings."); api_ui_item_rna_common(func); func = RNA_def_function(srna, "template_colormanaged_view_settings", "uiTemplateColormanagedViewSettings"); RNA_def_function_ui_description(func, "Item. A widget to control color managed view settings settings."); RNA_def_function_flag(func, FUNC_USE_CONTEXT); api_ui_item_rna_common(func); /* RNA_def_boolean(func, "show_global_settings", false, "", "Show widgets to control global color management settings"); */ /* node socket icon */ func = RNA_def_function(srna, "template_node_socket", "uiTemplateNodeSocket"); RNA_def_function_ui_description(func, "Node Socket Icon"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); RNA_def_float_array(func, "color", 4, node_socket_color_default, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f); }
void RNA_api_object(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; static const EnumPropertyItem mesh_type_items[] = { {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"}, {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"}, {0, NULL, 0, NULL, NULL}, }; # ifndef NDEBUG static const EnumPropertyItem mesh_dm_info_items[] = { {0, "SOURCE", 0, "Source", "Source mesh"}, {1, "DEFORM", 0, "Deform", "Objects deform mesh"}, {2, "FINAL", 0, "Final", "Objects final mesh"}, {0, NULL, 0, NULL, NULL}, }; # endif /* Special wrapper to access the base selection value */ func = RNA_def_function(srna, "select_get", "rna_Object_select_get"); RNA_def_function_ui_description( func, "Test if the object is selected. The selection state is per view layer"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_pointer( func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer"); parm = RNA_def_boolean(func, "result", 0, "", "Object selected"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "select_set", "rna_Object_select_set"); RNA_def_function_ui_description( func, "Select or deselect the object. The selection state is per view layer"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_boolean(func, "state", 0, "", "Selection state to define"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer( func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer"); func = RNA_def_function(srna, "hide_get", "rna_Object_hide_get"); RNA_def_function_ui_description( func, "Test if the object is hidden for viewport editing. This hiding state is per view layer"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_pointer( func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer"); parm = RNA_def_boolean(func, "result", 0, "", "Object hideed"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "hide_set", "rna_Object_hide_set"); RNA_def_function_ui_description( func, "Hide the object for viewport editing. This hiding state is per view layer"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_boolean(func, "state", 0, "", "Hide state to define"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer( func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer"); func = RNA_def_function(srna, "visible_get", "rna_Object_visible_get"); RNA_def_function_ui_description(func, "Test if the object is visible in the 3D viewport, taking into " "account all visibility settings"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_pointer( func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer"); parm = RNA_def_pointer( func, "viewport", "SpaceView3D", "", "Use this instead of the active 3D viewport"); parm = RNA_def_boolean(func, "result", 0, "", "Object visible"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "holdout_get", "rna_Object_holdout_get"); RNA_def_function_ui_description(func, "Test if object is masked in the view layer"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_pointer( func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer"); parm = RNA_def_boolean(func, "result", 0, "", "Object holdout"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "indirect_only_get", "rna_Object_indirect_only_get"); RNA_def_function_ui_description(func, "Test if object is set to contribute only indirectly (through " "shadows and reflections) in the view layer"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_pointer( func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer"); parm = RNA_def_boolean(func, "result", 0, "", "Object indirect only"); RNA_def_function_return(func, parm); /* Local View */ func = RNA_def_function(srna, "local_view_get", "rna_Object_local_view_get"); RNA_def_function_ui_description(func, "Get the local view state for this object"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local view"); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR | PARM_REQUIRED); parm = RNA_def_boolean(func, "result", 0, "", "Object local view state"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "local_view_set", "rna_Object_local_view_set"); RNA_def_function_ui_description(func, "Set the local view state for this object"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local view"); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR | PARM_REQUIRED); parm = RNA_def_boolean(func, "state", 0, "", "Local view state to define"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* Matrix space conversion */ func = RNA_def_function(srna, "convert_space", "rna_Object_mat_convert_space"); RNA_def_function_ui_description( func, "Convert (transform) the given matrix from one space to another"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer( func, "pose_bone", "PoseBone", "", "Bone to use to define spaces (may be None, in which case only the two 'WORLD' and " "'LOCAL' spaces are usable)"); parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(parm, "", "The matrix to transform"); parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(parm, "", "The transformed matrix"); RNA_def_function_output(func, parm); parm = RNA_def_enum(func, "from_space", space_items, CONSTRAINT_SPACE_WORLD, "", "The space in which 'matrix' is currently"); parm = RNA_def_enum(func, "to_space", space_items, CONSTRAINT_SPACE_WORLD, "", "The space to which you want to transform 'matrix'"); /* Camera-related operations */ func = RNA_def_function(srna, "calc_matrix_camera", "rna_Object_calc_matrix_camera"); RNA_def_function_ui_description(func, "Generate the camera projection matrix of this object " "(mostly useful for Camera and Light types)"); parm = RNA_def_pointer( func, "depsgraph", "Depsgraph", "", "Depsgraph to get evaluated data from"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_property(func, "result", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4); RNA_def_property_ui_text(parm, "", "The camera projection matrix"); RNA_def_function_output(func, parm); parm = RNA_def_int(func, "x", 1, 0, INT_MAX, "", "Width of the render area", 0, 10000); parm = RNA_def_int(func, "y", 1, 0, INT_MAX, "", "Height of the render area", 0, 10000); parm = RNA_def_float( func, "scale_x", 1.0f, 1.0e-6f, FLT_MAX, "", "Width scaling factor", 1.0e-2f, 100.0f); parm = RNA_def_float( func, "scale_y", 1.0f, 1.0e-6f, FLT_MAX, "", "Height scaling factor", 1.0e-2f, 100.0f); func = RNA_def_function(srna, "camera_fit_coords", "rna_Object_camera_fit_coords"); RNA_def_function_ui_description(func, "Compute the coordinate (and scale for ortho cameras) " "given object should be to 'see' all given coordinates"); parm = RNA_def_pointer( func, "depsgraph", "Depsgraph", "", "Depsgraph to get evaluated data from"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_float_array(func, "coordinates", 1, NULL, -FLT_MAX, FLT_MAX, "", "Coordinates to fit in", -FLT_MAX, FLT_MAX); RNA_def_parameter_flags(parm, PROP_NEVER_NULL | PROP_DYNAMIC, PARM_REQUIRED); parm = RNA_def_property(func, "co_return", PROP_FLOAT, PROP_XYZ); RNA_def_property_array(parm, 3); RNA_def_property_ui_text(parm, "", "The location to aim to be able to see all given points"); RNA_def_parameter_flags(parm, 0, PARM_OUTPUT); parm = RNA_def_property(func, "scale_return", PROP_FLOAT, PROP_NONE); RNA_def_property_ui_text( parm, "", "The ortho scale to aim to be able to see all given points (if relevant)"); RNA_def_parameter_flags(parm, 0, PARM_OUTPUT); /* mesh */ func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh"); RNA_def_function_ui_description( func, "Create a Mesh data-block from the current state of the object. The object owns the " "data-block. To force free it use to_mesh_clear(). " "The result is temporary and can not be used by objects from the main database"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_boolean(func, "preserve_all_data_layers", false, "", "Preserve all data layers in the mesh, like UV maps and vertex groups. " "By default Blender only computes the subset of data layers needed for viewport " "display and rendering, for better performance"); RNA_def_pointer( func, "depsgraph", "Depsgraph", "Dependency Graph", "Evaluated dependency graph which is required when preserve_all_data_layers is true"); parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh created from object"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "to_mesh_clear", "rna_Object_to_mesh_clear"); RNA_def_function_ui_description(func, "Clears mesh data-block created by to_mesh()"); /* Armature */ func = RNA_def_function(srna, "find_armature", "modifiers_isDeformedByArmature"); RNA_def_function_ui_description( func, "Find armature influencing this object as a parent or via a modifier"); parm = RNA_def_pointer( func, "ob_arm", "Object", "", "Armature object influencing this object or NULL"); RNA_def_function_return(func, parm); /* Shape key */ func = RNA_def_function(srna, "shape_key_add", "rna_Object_shape_key_add"); RNA_def_function_ui_description(func, "Add shape key to this object"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); RNA_def_string(func, "name", "Key", 0, "", "Unique name for the new keyblock"); /* optional */ RNA_def_boolean(func, "from_mix", 1, "", "Create new shape from existing mix of shapes"); parm = RNA_def_pointer(func, "key", "ShapeKey", "", "New shape keyblock"); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "shape_key_remove", "rna_Object_shape_key_remove"); RNA_def_function_ui_description(func, "Remove a Shape Key from this object"); RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "key", "ShapeKey", "", "Keyblock to be removed"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); func = RNA_def_function(srna, "shape_key_clear", "rna_Object_shape_key_clear"); RNA_def_function_ui_description(func, "Remove all Shape Keys from this object"); RNA_def_function_flag(func, FUNC_USE_MAIN); /* Ray Cast */ func = RNA_def_function(srna, "ray_cast", "rna_Object_ray_cast"); RNA_def_function_ui_description( func, "Cast a ray onto evaluated geometry, in object space " "(using context's or provided depsgraph to get evaluated mesh if needed)"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); /* ray start and end */ parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "Origin of the ray, in object space", -1e4, 1e4); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_float_vector(func, "direction", 3, NULL, -FLT_MAX, FLT_MAX, "", "Direction of the ray, in object space", -1e4, 1e4); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); RNA_def_float(func, "distance", BVH_RAYCAST_DIST_MAX, 0.0, BVH_RAYCAST_DIST_MAX, "", "Maximum distance", 0.0, BVH_RAYCAST_DIST_MAX); parm = RNA_def_pointer( func, "depsgraph", "Depsgraph", "", "Depsgraph to use to get evaluated data, when called from original object " "(only needed if current Context's depsgraph is not suitable)"); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); /* return location and normal */ parm = RNA_def_boolean(func, "result", 0, "", "Wheter the ray successfully hit the geometry"); 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_parameter_flags(parm, PROP_THICK_WRAP, 0); 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_parameter_flags(parm, PROP_THICK_WRAP, 0); RNA_def_function_output(func, parm); parm = RNA_def_int( func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0); RNA_def_function_output(func, parm); /* Nearest Point */ func = RNA_def_function(srna, "closest_point_on_mesh", "rna_Object_closest_point_on_mesh"); RNA_def_function_ui_description( func, "Find the nearest point on evaluated geometry, in object space " "(using context's or provided depsgraph to get evaluated mesh if needed)"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); /* location of point for test and max distance */ parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "Point to find closest geometry from (in object space)", -1e4, 1e4); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* default is sqrt(FLT_MAX) */ RNA_def_float( func, "distance", 1.844674352395373e+19, 0.0, FLT_MAX, "", "Maximum distance", 0.0, FLT_MAX); parm = RNA_def_pointer( func, "depsgraph", "Depsgraph", "", "Depsgraph to use to get evaluated data, when called from original object " "(only needed if current Context's depsgraph is not suitable)"); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); /* return location and normal */ parm = RNA_def_boolean(func, "result", 0, "", "Wheter closest point on geometry was found"); RNA_def_function_output(func, parm); parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "The location on the object closest to the point", -1e4, 1e4); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); 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 closest point", -1e4, 1e4); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); RNA_def_function_output(func, parm); parm = RNA_def_int( func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0); RNA_def_function_output(func, parm); /* View */ /* utility function for checking if the object is modified */ func = RNA_def_function(srna, "is_modified", "rna_Object_is_modified"); RNA_def_function_ui_description(func, "Determine if this object is modified from the base mesh data"); parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene in which to check the object"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_boolean(func, "result", 0, "", "Whether the object is modified"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "is_deform_modified", "rna_Object_is_deform_modified"); RNA_def_function_ui_description( func, "Determine if this object is modified by a deformation from the base mesh data"); parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene in which to check the object"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_boolean(func, "result", 0, "", "Whether the object is deform-modified"); RNA_def_function_return(func, parm); # ifndef NDEBUG /* mesh */ func = RNA_def_function(srna, "dm_info", "rna_Object_me_eval_info"); RNA_def_function_ui_description( func, "Returns a string for original/evaluated mesh data (debug builds only, " "using context's or provided depsgraph to get evaluated mesh if needed)"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm = RNA_def_enum(func, "type", mesh_dm_info_items, 0, "", "Modifier settings to apply"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_pointer( func, "depsgraph", "Depsgraph", "", "Depsgraph to use to get evaluated data, when called from original object " "(only needed if current Context's depsgraph is not suitable)"); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); /* weak!, no way to return dynamic string type */ parm = RNA_def_string(func, "result", NULL, 16384, "", "Requested informations"); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */ RNA_def_function_output(func, parm); # endif /* NDEBUG */ func = RNA_def_function(srna, "update_from_editmode", "rna_Object_update_from_editmode"); RNA_def_function_ui_description(func, "Load the objects edit-mode data into the object data"); RNA_def_function_flag(func, FUNC_USE_MAIN); parm = RNA_def_boolean(func, "result", 0, "", "Success"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "cache_release", "BKE_object_free_caches"); RNA_def_function_ui_description(func, "Release memory used by caches associated with this object. " "Intended to be used by render engines only"); }
void RNA_api_image(StructRNA *srna) { FunctionRNA *func; PropertyRNA *parm; func = RNA_def_function(srna, "save_render", "rna_Image_save_render"); RNA_def_function_ui_description(func, "Save image to a specific path using a scenes render settings"); RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); parm = RNA_def_string_file_path(func, "filepath", "", 0, "", "Save path"); RNA_def_property_flag(parm, PROP_REQUIRED); RNA_def_pointer(func, "scene", "Scene", "", "Scene to take image parameters from"); func = RNA_def_function(srna, "save", "rna_Image_save"); RNA_def_function_ui_description(func, "Save image to its source path"); RNA_def_function_flag(func, FUNC_USE_REPORTS); func = RNA_def_function(srna, "pack", "rna_Image_pack"); RNA_def_function_ui_description(func, "Pack an image as embedded data into the .blend file"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_boolean(func, "as_png", 0, "as_png", "Pack the image as PNG (needed for generated/dirty images)"); func = RNA_def_function(srna, "unpack", "rna_Image_unpack"); RNA_def_function_ui_description(func, "Save an image packed in the .blend file to disk"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_enum(func, "method", unpack_method_items, PF_USE_LOCAL, "method", "How to unpack"); func = RNA_def_function(srna, "reload", "rna_Image_reload"); RNA_def_function_ui_description(func, "Reload the image from its source path"); func = RNA_def_function(srna, "update", "rna_Image_update"); RNA_def_function_ui_description(func, "Update the display image from the floating point buffer"); RNA_def_function_flag(func, FUNC_USE_REPORTS); func = RNA_def_function(srna, "scale", "rna_Image_scale"); RNA_def_function_ui_description(func, "Scale the image in pixels"); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_int(func, "width", 1, 1, 10000, "", "Width", 1, 10000); RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_int(func, "height", 1, 1, 10000, "", "Height", 1, 10000); RNA_def_property_flag(parm, PROP_REQUIRED); func = RNA_def_function(srna, "gl_touch", "rna_Image_gl_touch"); RNA_def_function_ui_description(func, "Delay the image from being cleaned from the cache due inactivity"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_int(func, "filter", GL_LINEAR_MIPMAP_NEAREST, -INT_MAX, INT_MAX, "Filter", "The texture minifying function to use if the image wasn't loaded", -INT_MAX, INT_MAX); RNA_def_int(func, "mag", GL_LINEAR, -INT_MAX, INT_MAX, "Magnification", "The texture magnification function to use if the image wasn't loaded", -INT_MAX, INT_MAX); /* return value */ parm = RNA_def_int(func, "error", 0, -INT_MAX, INT_MAX, "Error", "OpenGL error value", -INT_MAX, INT_MAX); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "gl_load", "rna_Image_gl_load"); RNA_def_function_ui_description(func, "Load the image into OpenGL graphics memory"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_int(func, "filter", GL_LINEAR_MIPMAP_NEAREST, -INT_MAX, INT_MAX, "Filter", "The texture minifying function", -INT_MAX, INT_MAX); RNA_def_int(func, "mag", GL_LINEAR, -INT_MAX, INT_MAX, "Magnification", "The texture magnification function", -INT_MAX, INT_MAX); /* return value */ parm = RNA_def_int(func, "error", 0, -INT_MAX, INT_MAX, "Error", "OpenGL error value", -INT_MAX, INT_MAX); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "gl_free", "rna_Image_gl_free"); RNA_def_function_ui_description(func, "Free the image from OpenGL graphics memory"); func= RNA_def_function(srna, "zbuf", "rna_Image_zbuf_blensor"); RNA_def_function_ui_description(func, "Access the image zbuffer"); RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); parm= RNA_def_float_array(func, "outbuffer", 1, NULL, -FLT_MAX, FLT_MAX, "outbuffer", "Target Buffer.", 0.0f, 0.0f); RNA_def_property_flag(parm, PROP_DYNAMIC|PROP_THICK_WRAP|PROP_REQUIRED); RNA_def_function_output(func, parm); RNA_def_pointer(func, "scene", "Scene", "", "Scene to take image parameters from"); /* TODO, pack/unpack, maybe should be generic functions? */ }