Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_object_api.c
| Show First 20 Lines • Show All 369 Lines • ▼ Show 20 Lines | |||||
| static void rna_Object_camera_fit_coords( | static void rna_Object_camera_fit_coords( | ||||
| Object *ob, Depsgraph *depsgraph, int num_cos, float *cos, float co_ret[3], float *scale_ret) | Object *ob, Depsgraph *depsgraph, int num_cos, float *cos, float co_ret[3], float *scale_ret) | ||||
| { | { | ||||
| BKE_camera_view_frame_fit_to_coords( | BKE_camera_view_frame_fit_to_coords( | ||||
| depsgraph, (const float(*)[3])cos, num_cos / 3, ob, co_ret, scale_ret); | depsgraph, (const float(*)[3])cos, num_cos / 3, ob, co_ret, scale_ret); | ||||
| } | } | ||||
| /* copied from Mesh_getFromObject and adapted to RNA interface */ | /* copied from Mesh_getFromObject and adapted to RNA interface */ | ||||
| static Mesh *rna_Object_to_mesh(Object *object, bContext *C, ReportList *reports) | static Mesh *rna_Object_to_mesh(Object *object, ReportList *reports) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | /* TODO(sergey): Make it more re-usable function, de-duplicate with | ||||
| * rna_Main_meshes_new_from_object. */ | |||||
| switch (object->type) { | |||||
| case OB_FONT: | |||||
| case OB_CURVE: | |||||
| case OB_SURF: | |||||
| case OB_MBALL: | |||||
| case OB_MESH: | |||||
| break; | |||||
| default: | |||||
| BKE_report(reports, RPT_ERROR, "Object does not have geometry data"); | |||||
| return NULL; | |||||
| } | |||||
| return rna_Main_meshes_new_from_object(bmain, reports, object); | return BKE_object_to_mesh(object); | ||||
| } | |||||
| static void rna_Object_to_mesh_clear(Object *object) | |||||
| { | |||||
| BKE_object_to_mesh_clear(object); | |||||
| } | } | ||||
| static PointerRNA rna_Object_shape_key_add( | static PointerRNA rna_Object_shape_key_add( | ||||
| Object *ob, bContext *C, ReportList *reports, const char *name, bool from_mix) | Object *ob, bContext *C, ReportList *reports, const char *name, bool from_mix) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| KeyBlock *kb = NULL; | KeyBlock *kb = NULL; | ||||
| ▲ Show 20 Lines • Show All 479 Lines • ▼ Show 20 Lines | # endif | ||||
| RNA_def_parameter_flags(parm, 0, PARM_OUTPUT); | RNA_def_parameter_flags(parm, 0, PARM_OUTPUT); | ||||
| parm = RNA_def_property(func, "scale_return", PROP_FLOAT, PROP_NONE); | parm = RNA_def_property(func, "scale_return", PROP_FLOAT, PROP_NONE); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| parm, "", "The ortho scale to aim to be able to see all given points (if relevant)"); | parm, "", "The ortho scale to aim to be able to see all given points (if relevant)"); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_OUTPUT); | RNA_def_parameter_flags(parm, 0, PARM_OUTPUT); | ||||
| /* mesh */ | /* mesh */ | ||||
| func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh"); | func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh"); | ||||
| RNA_def_function_ui_description(func, | RNA_def_function_ui_description( | ||||
| "Create a Mesh data-block from the current state of the object"); | func, | ||||
| RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT); | "Create a Mesh data-block from the current state of the object. The object owns the " | ||||
| parm = RNA_def_pointer(func, | "data-block. To force free it use to_mesh_clear()"); | ||||
| "mesh", | RNA_def_function_flag(func, FUNC_USE_REPORTS); | ||||
| "Mesh", | parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh created from object"); | ||||
| "", | |||||
| "Mesh created from object, remove it if it is only used for export"); | |||||
| RNA_def_function_return(func, parm); | 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 */ | /* Armature */ | ||||
| func = RNA_def_function(srna, "find_armature", "modifiers_isDeformedByArmature"); | func = RNA_def_function(srna, "find_armature", "modifiers_isDeformedByArmature"); | ||||
| RNA_def_function_ui_description( | RNA_def_function_ui_description( | ||||
| func, "Find armature influencing this object as a parent or via a modifier"); | func, "Find armature influencing this object as a parent or via a modifier"); | ||||
| parm = RNA_def_pointer( | parm = RNA_def_pointer( | ||||
| func, "ob_arm", "Object", "", "Armature object influencing this object or NULL"); | func, "ob_arm", "Object", "", "Armature object influencing this object or NULL"); | ||||
| RNA_def_function_return(func, parm); | RNA_def_function_return(func, parm); | ||||
| ▲ Show 20 Lines • Show All 226 Lines • Show Last 20 Lines | |||||