Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_object.c
| Show All 31 Lines | |||||
| #include "DNA_group_types.h" | #include "DNA_group_types.h" | ||||
| #include "DNA_material_types.h" | #include "DNA_material_types.h" | ||||
| #include "DNA_mesh_types.h" | #include "DNA_mesh_types.h" | ||||
| #include "DNA_object_force_types.h" | #include "DNA_object_force_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_meta_types.h" | #include "DNA_meta_types.h" | ||||
| #include "DNA_workspace_types.h" | #include "DNA_workspace_types.h" | ||||
| #include "DNA_gpencil_modifier_types.h" | |||||
| #include "DNA_shader_fx_types.h" | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BKE_camera.h" | #include "BKE_camera.h" | ||||
| #include "BKE_collection.h" | #include "BKE_collection.h" | ||||
| #include "BKE_paint.h" | #include "BKE_paint.h" | ||||
| #include "BKE_editlattice.h" | #include "BKE_editlattice.h" | ||||
| Show All 18 Lines | const EnumPropertyItem rna_enum_object_mode_items[] = { | ||||
| {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object Mode", ""}, | {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object Mode", ""}, | ||||
| {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit Mode", ""}, | {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit Mode", ""}, | ||||
| {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose Mode", ""}, | {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose Mode", ""}, | ||||
| {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt Mode", ""}, | {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt Mode", ""}, | ||||
| {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""}, | {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""}, | ||||
| {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""}, | {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""}, | ||||
| {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""}, | {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""}, | ||||
| {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""}, | {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""}, | ||||
| {OB_MODE_GPENCIL, "GPENCIL_EDIT", ICON_GREASEPENCIL, "Edit Strokes", "Edit Grease Pencil Strokes"}, | {OB_MODE_GPENCIL_EDIT, "GPENCIL_EDIT", ICON_EDITMODE_HLT, "Edit Mode", "Edit Grease Pencil Strokes"}, | ||||
| {OB_MODE_GPENCIL_SCULPT, "GPENCIL_SCULPT", ICON_SCULPTMODE_HLT, "Sculpt Mode", "Sculpt Grease Pencil Strokes"}, | |||||
| {OB_MODE_GPENCIL_PAINT, "GPENCIL_PAINT", ICON_GREASEPENCIL, "Draw", "Paint Grease Pencil Strokes"}, | |||||
| {OB_MODE_GPENCIL_WEIGHT, "GPENCIL_WEIGHT", ICON_WPAINT_HLT, "Weight Paint", "Grease Pencil Weight Paint Strokes" }, | |||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| const EnumPropertyItem rna_enum_object_empty_drawtype_items[] = { | const EnumPropertyItem rna_enum_object_empty_drawtype_items[] = { | ||||
| {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""}, | {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""}, | ||||
| {OB_ARROWS, "ARROWS", 0, "Arrows", ""}, | {OB_ARROWS, "ARROWS", 0, "Arrows", ""}, | ||||
| {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""}, | {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""}, | ||||
| {OB_CIRCLE, "CIRCLE", 0, "Circle", ""}, | {OB_CIRCLE, "CIRCLE", 0, "Circle", ""}, | ||||
| {OB_CUBE, "CUBE", 0, "Cube", ""}, | {OB_CUBE, "CUBE", 0, "Cube", ""}, | ||||
| {OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""}, | {OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""}, | ||||
| {OB_EMPTY_CONE, "CONE", 0, "Cone", ""}, | {OB_EMPTY_CONE, "CONE", 0, "Cone", ""}, | ||||
| {OB_EMPTY_IMAGE, "IMAGE", 0, "Image", ""}, | {OB_EMPTY_IMAGE, "IMAGE", 0, "Image", ""}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| const EnumPropertyItem rna_enum_object_gpencil_type_items[] = { | |||||
| { GP_EMPTY, "EMPTY", ICON_OUTLINER_OB_GREASEPENCIL, "Blank", "Create an empty grease pencil object" }, | |||||
| { GP_MONKEY, "MONKEY", ICON_MONKEY, "Monkey", "Construct a Suzanne grease pencil object" }, | |||||
| { 0, NULL, 0, NULL, NULL } | |||||
| }; | |||||
| static const EnumPropertyItem parent_type_items[] = { | static const EnumPropertyItem parent_type_items[] = { | ||||
| {PAROBJECT, "OBJECT", 0, "Object", "The object is parented to an object"}, | {PAROBJECT, "OBJECT", 0, "Object", "The object is parented to an object"}, | ||||
| {PARSKEL, "ARMATURE", 0, "Armature", ""}, | {PARSKEL, "ARMATURE", 0, "Armature", ""}, | ||||
| {PARSKEL, "LATTICE", 0, "Lattice", "The object is parented to a lattice"}, /* PARSKEL reuse will give issues */ | {PARSKEL, "LATTICE", 0, "Lattice", "The object is parented to a lattice"}, /* PARSKEL reuse will give issues */ | ||||
| {PARVERT1, "VERTEX", 0, "Vertex", "The object is parented to a vertex"}, | {PARVERT1, "VERTEX", 0, "Vertex", "The object is parented to a vertex"}, | ||||
| {PARVERT3, "VERTEX_3", 0, "3 Vertices", ""}, | {PARVERT3, "VERTEX_3", 0, "3 Vertices", ""}, | ||||
| {PARBONE, "BONE", 0, "Bone", "The object is parented to a bone"}, | {PARBONE, "BONE", 0, "Bone", "The object is parented to a bone"}, | ||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | const EnumPropertyItem rna_enum_object_type_items[] = { | ||||
| OBTYPE_CU_CURVE, | OBTYPE_CU_CURVE, | ||||
| OBTYPE_CU_SURF, | OBTYPE_CU_SURF, | ||||
| {OB_MBALL, "META", 0, "Meta", ""}, | {OB_MBALL, "META", 0, "Meta", ""}, | ||||
| OBTYPE_CU_FONT, | OBTYPE_CU_FONT, | ||||
| {0, "", 0, NULL, NULL}, | {0, "", 0, NULL, NULL}, | ||||
| {OB_ARMATURE, "ARMATURE", 0, "Armature", ""}, | {OB_ARMATURE, "ARMATURE", 0, "Armature", ""}, | ||||
| {OB_LATTICE, "LATTICE", 0, "Lattice", ""}, | {OB_LATTICE, "LATTICE", 0, "Lattice", ""}, | ||||
| {OB_EMPTY, "EMPTY", 0, "Empty", ""}, | {OB_EMPTY, "EMPTY", 0, "Empty", ""}, | ||||
| {OB_GPENCIL, "GPENCIL", 0, "GPencil", ""}, | |||||
| {0, "", 0, NULL, NULL}, | {0, "", 0, NULL, NULL}, | ||||
| {OB_CAMERA, "CAMERA", 0, "Camera", ""}, | {OB_CAMERA, "CAMERA", 0, "Camera", ""}, | ||||
| {OB_LAMP, "LIGHT", 0, "Light", ""}, | {OB_LAMP, "LIGHT", 0, "Light", ""}, | ||||
| {OB_SPEAKER, "SPEAKER", 0, "Speaker", ""}, | {OB_SPEAKER, "SPEAKER", 0, "Speaker", ""}, | ||||
| {OB_LIGHTPROBE, "LIGHT_PROBE", 0, "Probe", ""}, | {OB_LIGHTPROBE, "LIGHT_PROBE", 0, "Probe", ""}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| Show All 15 Lines | |||||
| }; | }; | ||||
| #ifdef RNA_RUNTIME | #ifdef RNA_RUNTIME | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "DNA_key_types.h" | #include "DNA_key_types.h" | ||||
| #include "DNA_constraint_types.h" | #include "DNA_constraint_types.h" | ||||
| #include "DNA_gpencil_types.h" | |||||
| #include "DNA_ID.h" | #include "DNA_ID.h" | ||||
| #include "DNA_lattice_types.h" | #include "DNA_lattice_types.h" | ||||
| #include "DNA_node_types.h" | #include "DNA_node_types.h" | ||||
| #include "BKE_armature.h" | #include "BKE_armature.h" | ||||
| #include "BKE_constraint.h" | #include "BKE_constraint.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_curve.h" | #include "BKE_curve.h" | ||||
| ▲ Show 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | switch (ob->type) { | ||||
| case OB_FONT: return &RNA_Curve; | case OB_FONT: return &RNA_Curve; | ||||
| case OB_MBALL: return &RNA_MetaBall; | case OB_MBALL: return &RNA_MetaBall; | ||||
| case OB_LAMP: return &RNA_Light; | case OB_LAMP: return &RNA_Light; | ||||
| case OB_CAMERA: return &RNA_Camera; | case OB_CAMERA: return &RNA_Camera; | ||||
| case OB_LATTICE: return &RNA_Lattice; | case OB_LATTICE: return &RNA_Lattice; | ||||
| case OB_ARMATURE: return &RNA_Armature; | case OB_ARMATURE: return &RNA_Armature; | ||||
| case OB_SPEAKER: return &RNA_Speaker; | case OB_SPEAKER: return &RNA_Speaker; | ||||
| case OB_LIGHTPROBE: return &RNA_LightProbe; | case OB_LIGHTPROBE: return &RNA_LightProbe; | ||||
| case OB_GPENCIL: return &RNA_GreasePencil; | |||||
| default: return &RNA_ID; | default: return &RNA_ID; | ||||
| } | } | ||||
| } | } | ||||
| static bool rna_Object_data_poll(PointerRNA *ptr, const PointerRNA value) | |||||
| { | |||||
| Object *ob = (Object *)ptr->data; | |||||
| if (ob->type == OB_GPENCIL) { | |||||
| /* GP Object - Don't allow using "Annotation" GP datablocks here */ | |||||
| bGPdata *gpd = value.data; | |||||
| return (gpd->flag & GP_DATA_ANNOTATIONS) == 0; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| static void rna_Object_parent_set(PointerRNA *ptr, PointerRNA value) | static void rna_Object_parent_set(PointerRNA *ptr, PointerRNA value) | ||||
| { | { | ||||
| Object *ob = (Object *)ptr->data; | Object *ob = (Object *)ptr->data; | ||||
| Object *par = (Object *)value.data; | Object *par = (Object *)value.data; | ||||
| { | { | ||||
| ED_object_parent(ob, par, ob->partype, ob->parsubstr); | ED_object_parent(ob, par, ob->partype, ob->parsubstr); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 539 Lines • ▼ Show 20 Lines | static void rna_MaterialSlot_material_set(PointerRNA *ptr, PointerRNA value) | ||||
| Object *ob = (Object *)ptr->id.data; | Object *ob = (Object *)ptr->id.data; | ||||
| int index = (Material **)ptr->data - ob->mat; | int index = (Material **)ptr->data - ob->mat; | ||||
| BLI_assert(BKE_id_is_in_gobal_main(&ob->id)); | BLI_assert(BKE_id_is_in_gobal_main(&ob->id)); | ||||
| BLI_assert(BKE_id_is_in_gobal_main(value.data)); | BLI_assert(BKE_id_is_in_gobal_main(value.data)); | ||||
| assign_material(G_MAIN, ob, value.data, index + 1, BKE_MAT_ASSIGN_EXISTING); | assign_material(G_MAIN, ob, value.data, index + 1, BKE_MAT_ASSIGN_EXISTING); | ||||
| } | } | ||||
| static bool rna_MaterialSlot_material_poll(PointerRNA *ptr, PointerRNA value) | |||||
| { | |||||
| Object *ob = (Object *)ptr->id.data; | |||||
| Material *ma = (Material *)value.data; | |||||
| if (ob->type == OB_GPENCIL) { | |||||
| /* GP Materials only */ | |||||
| return (ma->gp_style != NULL); | |||||
| } | |||||
| else { | |||||
| /* Everything except GP materials */ | |||||
| return (ma->gp_style == NULL); | |||||
| } | |||||
| } | |||||
| static int rna_MaterialSlot_link_get(PointerRNA *ptr) | static int rna_MaterialSlot_link_get(PointerRNA *ptr) | ||||
| { | { | ||||
| Object *ob = (Object *)ptr->id.data; | Object *ob = (Object *)ptr->id.data; | ||||
| int index = (Material **)ptr->data - ob->mat; | int index = (Material **)ptr->data - ob->mat; | ||||
| return ob->matbits[index] != 0; | return ob->matbits[index] != 0; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr) | ||||
| DEG_relations_tag_update(bmain); | DEG_relations_tag_update(bmain); | ||||
| } | } | ||||
| static char *rna_MaterialSlot_path(PointerRNA *ptr) | static char *rna_MaterialSlot_path(PointerRNA *ptr) | ||||
| { | { | ||||
| Object *ob = (Object *)ptr->id.data; | Object *ob = (Object *)ptr->id.data; | ||||
| int index = (Material **)ptr->data - ob->mat; | int index = (Material **)ptr->data - ob->mat; | ||||
| /* from armature... */ | |||||
| return BLI_sprintfN("material_slots[%d]", index); | return BLI_sprintfN("material_slots[%d]", index); | ||||
| } | } | ||||
| /* why does this have to be so complicated?, can't all this crap be | /* why does this have to be so complicated?, can't all this crap be | ||||
| * moved to in BGE conversion function? - Campbell * | * moved to in BGE conversion function? - Campbell * | ||||
| * | * | ||||
| * logic from check_body_type() | * logic from check_body_type() | ||||
| * */ | * */ | ||||
| ▲ Show 20 Lines • Show All 251 Lines • ▼ Show 20 Lines | bool rna_Object_modifiers_override_apply( | ||||
| /* This should actually *not* be needed in typical cases. However, if overridden source was edited, | /* This should actually *not* be needed in typical cases. However, if overridden source was edited, | ||||
| * we *may* have some new conflicting names. */ | * we *may* have some new conflicting names. */ | ||||
| modifier_unique_name(&ob_dst->modifiers, mod_dst); | modifier_unique_name(&ob_dst->modifiers, mod_dst); | ||||
| // printf("%s: We inserted a modifier...\n", __func__); | // printf("%s: We inserted a modifier...\n", __func__); | ||||
| return true; | return true; | ||||
| } | } | ||||
| static GpencilModifierData *rna_Object_greasepencil_modifier_new( | |||||
| Object *object, bContext *C, ReportList *reports, | |||||
| const char *name, int type) | |||||
| { | |||||
| return ED_object_gpencil_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type); | |||||
| } | |||||
| static void rna_Object_greasepencil_modifier_remove( | |||||
| Object *object, bContext *C, ReportList *reports, PointerRNA *gmd_ptr) | |||||
| { | |||||
| GpencilModifierData *gmd = gmd_ptr->data; | |||||
| if (ED_object_gpencil_modifier_remove(reports, CTX_data_main(C), object, gmd) == false) { | |||||
| /* error is already set */ | |||||
| return; | |||||
| } | |||||
| RNA_POINTER_INVALIDATE(gmd_ptr); | |||||
| WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object); | |||||
| } | |||||
| static void rna_Object_greasepencil_modifier_clear(Object *object, bContext *C) | |||||
| { | |||||
| ED_object_gpencil_modifier_clear(CTX_data_main(C), object); | |||||
| WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object); | |||||
| } | |||||
| /* shader fx */ | |||||
| static ShaderFxData *rna_Object_shaderfx_new( | |||||
| Object *object, bContext *C, ReportList *reports, | |||||
| const char *name, int type) | |||||
| { | |||||
| return ED_object_shaderfx_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type); | |||||
| } | |||||
| static void rna_Object_shaderfx_remove( | |||||
| Object *object, bContext *C, ReportList *reports, PointerRNA *gmd_ptr) | |||||
| { | |||||
| ShaderFxData *gmd = gmd_ptr->data; | |||||
| if (ED_object_shaderfx_remove(reports, CTX_data_main(C), object, gmd) == false) { | |||||
| /* error is already set */ | |||||
| return; | |||||
| } | |||||
| RNA_POINTER_INVALIDATE(gmd_ptr); | |||||
| WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object); | |||||
| } | |||||
| static void rna_Object_shaderfx_clear(Object *object, bContext *C) | |||||
| { | |||||
| ED_object_shaderfx_clear(CTX_data_main(C), object); | |||||
| WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object); | |||||
| } | |||||
| static void rna_Object_boundbox_get(PointerRNA *ptr, float *values) | static void rna_Object_boundbox_get(PointerRNA *ptr, float *values) | ||||
| { | { | ||||
| Object *ob = (Object *)ptr->id.data; | Object *ob = (Object *)ptr->id.data; | ||||
| BoundBox *bb = BKE_object_boundbox_get(ob); | BoundBox *bb = BKE_object_boundbox_get(ob); | ||||
| if (bb) { | if (bb) { | ||||
| memcpy(values, bb->vec, sizeof(bb->vec)); | memcpy(values, bb->vec, sizeof(bb->vec)); | ||||
| } | } | ||||
| else { | else { | ||||
| ▲ Show 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | bool rna_Camera_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) | ||||
| return ((Object *)value.id.data)->type == OB_CAMERA; | return ((Object *)value.id.data)->type == OB_CAMERA; | ||||
| } | } | ||||
| bool rna_Light_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) | bool rna_Light_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) | ||||
| { | { | ||||
| return ((Object *)value.id.data)->type == OB_LAMP; | return ((Object *)value.id.data)->type == OB_LAMP; | ||||
| } | } | ||||
| bool rna_GPencil_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) | |||||
| { | |||||
| return ((Object *)value.id.data)->type == OB_GPENCIL; | |||||
| } | |||||
| int rna_Object_use_dynamic_topology_sculpting_get(PointerRNA *ptr) | int rna_Object_use_dynamic_topology_sculpting_get(PointerRNA *ptr) | ||||
| { | { | ||||
| SculptSession *ss = ((Object *)ptr->id.data)->sculpt; | SculptSession *ss = ((Object *)ptr->id.data)->sculpt; | ||||
| return (ss && ss->bm); | return (ss && ss->bm); | ||||
| } | } | ||||
| #else | #else | ||||
| ▲ Show 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | static void rna_def_material_slot(BlenderRNA *brna) | ||||
| RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data"); | RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data"); | ||||
| RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update"); | RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update"); | ||||
| prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(prop, "Material"); | RNA_def_property_struct_type(prop, "Material"); | ||||
| RNA_def_property_flag(prop, PROP_EDITABLE); | RNA_def_property_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_editable_func(prop, "rna_MaterialSlot_material_editable"); | RNA_def_property_editable_func(prop, "rna_MaterialSlot_material_editable"); | ||||
| RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); | RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); | ||||
| RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", "rna_MaterialSlot_material_set", NULL, NULL); | RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", "rna_MaterialSlot_material_set", NULL, "rna_MaterialSlot_material_poll"); | ||||
| RNA_def_property_ui_text(prop, "Material", "Material data-block used by this material slot"); | RNA_def_property_ui_text(prop, "Material", "Material data-block used by this material slot"); | ||||
| RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update"); | RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update"); | ||||
| prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | ||||
| RNA_def_property_string_funcs(prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL); | RNA_def_property_string_funcs(prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL); | ||||
| RNA_def_property_ui_text(prop, "Name", "Material slot name"); | RNA_def_property_ui_text(prop, "Name", "Material slot name"); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_struct_name_property(srna, prop); | RNA_def_struct_name_property(srna, prop); | ||||
| ▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | #endif | ||||
| RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); | RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); | ||||
| /* clear all modifiers */ | /* clear all modifiers */ | ||||
| func = RNA_def_function(srna, "clear", "rna_Object_modifier_clear"); | func = RNA_def_function(srna, "clear", "rna_Object_modifier_clear"); | ||||
| RNA_def_function_flag(func, FUNC_USE_CONTEXT); | RNA_def_function_flag(func, FUNC_USE_CONTEXT); | ||||
| RNA_def_function_ui_description(func, "Remove all modifiers from the object"); | RNA_def_function_ui_description(func, "Remove all modifiers from the object"); | ||||
| } | } | ||||
| /* object.grease_pencil_modifiers */ | |||||
| static void rna_def_object_grease_pencil_modifiers(BlenderRNA *brna, PropertyRNA *cprop) | |||||
| { | |||||
| StructRNA *srna; | |||||
| FunctionRNA *func; | |||||
| PropertyRNA *parm; | |||||
| RNA_def_property_srna(cprop, "ObjectGpencilModifiers"); | |||||
| srna = RNA_def_struct(brna, "ObjectGpencilModifiers", NULL); | |||||
| RNA_def_struct_sdna(srna, "Object"); | |||||
| RNA_def_struct_ui_text(srna, "Object Grease Pencil Modifiers", "Collection of object grease pencil modifiers"); | |||||
| /* add greasepencil modifier */ | |||||
| func = RNA_def_function(srna, "new", "rna_Object_greasepencil_modifier_new"); | |||||
| RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); | |||||
| RNA_def_function_ui_description(func, "Add a new greasepencil_modifier"); | |||||
| parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the greasepencil_modifier"); | |||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | |||||
| /* greasepencil_modifier to add */ | |||||
| parm = RNA_def_enum(func, "type", rna_enum_object_greasepencil_modifier_type_items, 1, "", "Modifier type to add"); | |||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | |||||
| /* return type */ | |||||
| parm = RNA_def_pointer(func, "greasepencil_modifier", "GpencilModifier", "", "Newly created modifier"); | |||||
| RNA_def_function_return(func, parm); | |||||
| /* remove greasepencil_modifier */ | |||||
| func = RNA_def_function(srna, "remove", "rna_Object_greasepencil_modifier_remove"); | |||||
| RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); | |||||
| RNA_def_function_ui_description(func, "Remove an existing greasepencil_modifier from the object"); | |||||
| /* greasepencil_modifier to remove */ | |||||
| parm = RNA_def_pointer(func, "greasepencil_modifier", "GpencilModifier", "", "Modifier to remove"); | |||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | |||||
| RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); | |||||
| /* clear all greasepencil modifiers */ | |||||
| func = RNA_def_function(srna, "clear", "rna_Object_greasepencil_modifier_clear"); | |||||
| RNA_def_function_flag(func, FUNC_USE_CONTEXT); | |||||
| RNA_def_function_ui_description(func, "Remove all grease pencil modifiers from the object"); | |||||
| } | |||||
| /* object.shaderfxs */ | |||||
| static void rna_def_object_shaderfxs(BlenderRNA *brna, PropertyRNA *cprop) | |||||
| { | |||||
| StructRNA *srna; | |||||
| FunctionRNA *func; | |||||
| PropertyRNA *parm; | |||||
| RNA_def_property_srna(cprop, "ObjectShaderFx"); | |||||
| srna = RNA_def_struct(brna, "ObjectShaderFx", NULL); | |||||
| RNA_def_struct_sdna(srna, "Object"); | |||||
| RNA_def_struct_ui_text(srna, "Object Shader Effects", "Collection of object effects"); | |||||
| /* add shader_fx */ | |||||
| func = RNA_def_function(srna, "new", "rna_Object_shaderfx_new"); | |||||
| RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); | |||||
| RNA_def_function_ui_description(func, "Add a new shader fx"); | |||||
| parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the effect"); | |||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | |||||
| /* shader to add */ | |||||
| parm = RNA_def_enum(func, "type", rna_enum_object_shaderfx_type_items, 1, "", "Effect type to add"); | |||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | |||||
| /* return type */ | |||||
| parm = RNA_def_pointer(func, "shader_fx", "ShaderFx", "", "Newly created effect"); | |||||
| RNA_def_function_return(func, parm); | |||||
| /* remove shader_fx */ | |||||
| func = RNA_def_function(srna, "remove", "rna_Object_shaderfx_remove"); | |||||
| RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS); | |||||
| RNA_def_function_ui_description(func, "Remove an existing effect from the object"); | |||||
| /* shader to remove */ | |||||
| parm = RNA_def_pointer(func, "shader_fx", "ShaderFx", "", "Effect to remove"); | |||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | |||||
| RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); | |||||
| /* clear all shader fx */ | |||||
| func = RNA_def_function(srna, "clear", "rna_Object_shaderfx_clear"); | |||||
| RNA_def_function_flag(func, FUNC_USE_CONTEXT); | |||||
| RNA_def_function_ui_description(func, "Remove all effects from the object"); | |||||
| } | |||||
| /* object.particle_systems */ | /* object.particle_systems */ | ||||
| static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop) | static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| /* FunctionRNA *func; */ | /* FunctionRNA *func; */ | ||||
| ▲ Show 20 Lines • Show All 188 Lines • ▼ Show 20 Lines | static void rna_def_object(BlenderRNA *brna) | ||||
| srna = RNA_def_struct(brna, "Object", "ID"); | srna = RNA_def_struct(brna, "Object", "ID"); | ||||
| 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); | ||||
| 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(prop, NULL, "rna_Object_data_set", "rna_Object_data_typef", NULL); | RNA_def_property_pointer_funcs(prop, NULL, "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_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); | RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); | ||||
| 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_internal_update_data"); | RNA_def_property_update(prop, 0, "rna_Object_internal_update_data"); | ||||
| 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); | ||||
| ▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | static void rna_def_object(BlenderRNA *brna) | ||||
| RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_NO_PROP_NAME); | RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_NO_PROP_NAME); | ||||
| /* don't dereference pointer! */ | /* don't dereference pointer! */ | ||||
| RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL, NULL); | RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL, NULL); | ||||
| RNA_def_property_ui_text(prop, "Material Slots", "Material slots in the object"); | RNA_def_property_ui_text(prop, "Material Slots", "Material slots in the object"); | ||||
| prop = RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(prop, "Material"); | RNA_def_property_struct_type(prop, "Material"); | ||||
| RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", | RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", | ||||
| "rna_Object_active_material_set", NULL, NULL); | "rna_Object_active_material_set", NULL, | ||||
| "rna_MaterialSlot_material_poll"); | |||||
| RNA_def_property_flag(prop, PROP_EDITABLE); | RNA_def_property_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); | RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); | ||||
| RNA_def_property_editable_func(prop, "rna_Object_active_material_editable"); | RNA_def_property_editable_func(prop, "rna_Object_active_material_editable"); | ||||
| RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed"); | RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed"); | ||||
| RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update"); | RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update"); | ||||
| prop = RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED); | prop = RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED); | ||||
| RNA_def_property_int_sdna(prop, NULL, "actcol"); | RNA_def_property_int_sdna(prop, NULL, "actcol"); | ||||
| ▲ Show 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | #endif | ||||
| /* modifiers */ | /* modifiers */ | ||||
| prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE); | prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE); | ||||
| RNA_def_property_struct_type(prop, "Modifier"); | RNA_def_property_struct_type(prop, "Modifier"); | ||||
| RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the geometric data of the object"); | RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the geometric data of the object"); | ||||
| RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Object_modifiers_override_apply"); | RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Object_modifiers_override_apply"); | ||||
| RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_STATIC_INSERTION); | RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_STATIC_INSERTION); | ||||
| rna_def_object_modifiers(brna, prop); | rna_def_object_modifiers(brna, prop); | ||||
| /* Grease Pencil modifiers. */ | |||||
| prop = RNA_def_property(srna, "grease_pencil_modifiers", PROP_COLLECTION, PROP_NONE); | |||||
| RNA_def_property_collection_sdna(prop, NULL, "greasepencil_modifiers", NULL); | |||||
| RNA_def_property_struct_type(prop, "GpencilModifier"); | |||||
| RNA_def_property_ui_text(prop, "Grease Pencil Modifiers", "Modifiers affecting the data of the grease pencil object"); | |||||
| rna_def_object_grease_pencil_modifiers(brna, prop); | |||||
| /* Shader FX. */ | |||||
| prop = RNA_def_property(srna, "shader_effects", PROP_COLLECTION, PROP_NONE); | |||||
| RNA_def_property_collection_sdna(prop, NULL, "shader_fx", NULL); | |||||
| RNA_def_property_struct_type(prop, "ShaderFx"); | |||||
| RNA_def_property_ui_text(prop, "Shader Effects", "Effects affecting display of object"); | |||||
| rna_def_object_shaderfxs(brna, prop); | |||||
| /* constraints */ | /* constraints */ | ||||
| prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE); | prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE); | ||||
| RNA_def_property_struct_type(prop, "Constraint"); | RNA_def_property_struct_type(prop, "Constraint"); | ||||
| RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_STATIC_INSERTION); | RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_STATIC_INSERTION); | ||||
| RNA_def_property_ui_text(prop, "Constraints", "Constraints affecting the transformation of the object"); | RNA_def_property_ui_text(prop, "Constraints", "Constraints affecting the transformation of the object"); | ||||
| RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Object_constraints_override_apply"); | RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Object_constraints_override_apply"); | ||||
| /* RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "constraints__add", "constraints__remove"); */ | /* RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "constraints__add", "constraints__remove"); */ | ||||
| rna_def_object_constraints(brna, prop); | rna_def_object_constraints(brna, prop); | ||||
| ▲ Show 20 Lines • Show All 255 Lines • ▼ Show 20 Lines | /* RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "constraints__add", "constraints__remove"); */ | ||||
| prop = RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY); | RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY); | ||||
| RNA_def_property_ui_text(prop, "X-Ray", | RNA_def_property_ui_text(prop, "X-Ray", | ||||
| "Make the object draw in front of others (unsupported for duplicator drawing)"); | "Make the object draw in front of others (unsupported for duplicator drawing)"); | ||||
| RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); | RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); | ||||
| /* Grease Pencil */ | /* Grease Pencil */ | ||||
| #if 1 /* FIXME: Remove this code when all Open-Movie assets have been fixed */ | |||||
| prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_pointer_sdna(prop, NULL, "gpd"); | RNA_def_property_pointer_sdna(prop, NULL, "gpd"); | ||||
| RNA_def_property_struct_type(prop, "GreasePencil"); | RNA_def_property_struct_type(prop, "GreasePencil"); | ||||
| RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_GPencil_datablocks_obdata_poll"); /* XXX */ | |||||
| RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); | RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); | ||||
| RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil data-block"); | RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil data-block (deprecated)"); | ||||
| RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); | RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); | ||||
| #endif | |||||
| /* pose */ | /* pose */ | ||||
| prop = RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_pointer_sdna(prop, NULL, "poselib"); | RNA_def_property_pointer_sdna(prop, NULL, "poselib"); | ||||
| RNA_def_property_struct_type(prop, "Action"); | RNA_def_property_struct_type(prop, "Action"); | ||||
| RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); | RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); | ||||
| RNA_def_property_ui_text(prop, "Pose Library", "Action used as a pose library for armatures"); | RNA_def_property_ui_text(prop, "Pose Library", "Action used as a pose library for armatures"); | ||||
| ▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines | |||||