Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_object.c
| Show First 20 Lines • Show All 325 Lines • ▼ Show 20 Lines | |||||
| # include "BKE_context.h" | # include "BKE_context.h" | ||||
| # include "BKE_curve.h" | # include "BKE_curve.h" | ||||
| # include "BKE_deform.h" | # include "BKE_deform.h" | ||||
| # include "BKE_effect.h" | # include "BKE_effect.h" | ||||
| # include "BKE_global.h" | # include "BKE_global.h" | ||||
| # include "BKE_key.h" | # include "BKE_key.h" | ||||
| # include "BKE_material.h" | # include "BKE_material.h" | ||||
| # include "BKE_mesh.h" | # include "BKE_mesh.h" | ||||
| # include "BKE_mesh_wrapper.h" | |||||
| # include "BKE_modifier.h" | # include "BKE_modifier.h" | ||||
| # include "BKE_object.h" | # include "BKE_object.h" | ||||
| # include "BKE_particle.h" | # include "BKE_particle.h" | ||||
| # include "BKE_scene.h" | # include "BKE_scene.h" | ||||
| # include "DEG_depsgraph.h" | # include "DEG_depsgraph.h" | ||||
| # include "DEG_depsgraph_build.h" | # include "DEG_depsgraph_build.h" | ||||
| ▲ Show 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | void rna_Object_data_update(Main *bmain, Scene *scene, PointerRNA *ptr) | ||||
| if (object->mode == OB_MODE_SCULPT) { | if (object->mode == OB_MODE_SCULPT) { | ||||
| BKE_sculpt_ensure_orig_mesh_data(scene, object); | BKE_sculpt_ensure_orig_mesh_data(scene, object); | ||||
| } | } | ||||
| rna_Object_internal_update_data_dependency(bmain, scene, ptr); | rna_Object_internal_update_data_dependency(bmain, scene, ptr); | ||||
| } | } | ||||
| static PointerRNA rna_Object_data_get(PointerRNA *ptr) | |||||
| { | |||||
| Object *ob = (Object *)ptr->data; | |||||
| if (ob->type == OB_MESH) { | |||||
| Mesh *me = (Mesh *)ob->data; | |||||
| me = BKE_mesh_wrapper_ensure_subdivision(ob, me); | |||||
| return rna_pointer_inherit_refine(ptr, &RNA_Mesh, me); | |||||
| } | |||||
| return rna_pointer_inherit_refine(ptr, &RNA_ID, ob->data); | |||||
| } | |||||
| static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value, struct ReportList *reports) | static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value, struct ReportList *reports) | ||||
| { | { | ||||
| Object *ob = (Object *)ptr->data; | Object *ob = (Object *)ptr->data; | ||||
| ID *id = value.data; | ID *id = value.data; | ||||
| if (ob->mode & OB_MODE_EDIT) { | if (ob->mode & OB_MODE_EDIT) { | ||||
| return; | return; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 2,515 Lines • ▼ Show 20 Lines | static void rna_def_object(BlenderRNA *brna) | ||||
| RNA_def_struct_ui_text(srna, "Object", "Object data-block defining an object in a scene"); | RNA_def_struct_ui_text(srna, "Object", "Object data-block defining an object in a scene"); | ||||
| RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); | RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); | ||||
| RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA); | RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA); | ||||
| RNA_define_lib_overridable(true); | RNA_define_lib_overridable(true); | ||||
| prop = RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(prop, "ID"); | RNA_def_property_struct_type(prop, "ID"); | ||||
| RNA_def_property_pointer_funcs( | RNA_def_property_pointer_funcs(prop, | ||||
| prop, NULL, "rna_Object_data_set", "rna_Object_data_typef", "rna_Object_data_poll"); | "rna_Object_data_get", | ||||
| "rna_Object_data_set", | |||||
| "rna_Object_data_typef", | |||||
| "rna_Object_data_poll"); | |||||
| RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK); | RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK); | ||||
| RNA_def_property_ui_text(prop, "Data", "Object data"); | RNA_def_property_ui_text(prop, "Data", "Object data"); | ||||
| RNA_def_property_update(prop, 0, "rna_Object_data_update"); | RNA_def_property_update(prop, 0, "rna_Object_data_update"); | ||||
| prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "type"); | RNA_def_property_enum_sdna(prop, NULL, "type"); | ||||
| RNA_def_property_enum_items(prop, rna_enum_object_type_items); | RNA_def_property_enum_items(prop, rna_enum_object_type_items); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| ▲ Show 20 Lines • Show All 734 Lines • Show Last 20 Lines | |||||