4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * Contributor(s): Blender Foundation (2008).
22 * ***** END GPL LICENSE BLOCK *****
25 /** \file blender/makesrna/intern/rna_object.c
33 #include "RNA_access.h"
34 #include "RNA_define.h"
35 #include "RNA_enum_types.h"
37 #include "rna_internal.h"
39 #include "DNA_action_types.h"
40 #include "DNA_customdata_types.h"
41 #include "DNA_controller_types.h"
42 #include "DNA_group_types.h"
43 #include "DNA_material_types.h"
44 #include "DNA_mesh_types.h"
45 #include "DNA_object_force.h"
46 #include "DNA_object_types.h"
47 #include "DNA_property_types.h"
48 #include "DNA_scene_types.h"
49 #include "DNA_meta_types.h"
51 #include "BKE_group.h" /* needed for object_in_group() */
53 #include "BLO_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
59 EnumPropertyItem object_mode_items[] = {
60 {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object", ""},
61 {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit", ""},
62 {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt", ""},
63 {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
64 {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
65 {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
66 {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""},
67 {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose", ""},
68 {0, NULL, 0, NULL, NULL}};
70 static EnumPropertyItem parent_type_items[] = {
71 {PAROBJECT, "OBJECT", 0, "Object", "The object is parented to an object"},
72 {PARCURVE, "CURVE", 0, "Curve", "The object is parented to a curve"},
73 {PARKEY, "KEY", 0, "Key", ""},
74 {PARSKEL, "ARMATURE", 0, "Armature", ""},
75 {PARSKEL, "LATTICE", 0, "Lattice", "The object is parented to a lattice"}, // PARSKEL reuse will give issues
76 {PARVERT1, "VERTEX", 0, "Vertex", "The object is parented to a vertex"},
77 {PARVERT3, "VERTEX_3", 0, "3 Vertices", ""},
78 {PARBONE, "BONE", 0, "Bone", "The object is parented to a bone"},
79 {0, NULL, 0, NULL, NULL}};
81 static EnumPropertyItem collision_bounds_items[] = {
82 {OB_BOUND_BOX, "BOX", 0, "Box", ""},
83 {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""},
84 {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", ""},
85 {OB_BOUND_CONE, "CONE", 0, "Cone", ""},
86 {OB_BOUND_POLYT, "CONVEX_HULL", 0, "Convex Hull", ""},
87 {OB_BOUND_POLYH, "TRIANGLE_MESH", 0, "Triangle Mesh", ""},
88 {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", ""},
89 //{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""},
90 {0, NULL, 0, NULL, NULL}};
92 EnumPropertyItem metaelem_type_items[] = {
93 {MB_BALL, "BALL", ICON_META_BALL, "Ball", ""},
94 {MB_TUBE, "CAPSULE", ICON_META_CAPSULE, "Capsule", ""},
95 {MB_PLANE, "PLANE", ICON_META_PLANE, "Plane", ""},
96 {MB_ELIPSOID, "ELLIPSOID", ICON_META_ELLIPSOID, "Ellipsoid", ""}, // NOTE: typo at original definition!
97 {MB_CUBE, "CUBE", ICON_META_CUBE, "Cube", ""},
98 {0, NULL, 0, NULL, NULL}};
100 /* used for 2 enums */
101 #define OBTYPE_CU_CURVE {OB_CURVE, "CURVE", 0, "Curve", ""}
102 #define OBTYPE_CU_SURF {OB_SURF, "SURFACE", 0, "Surface", ""}
103 #define OBTYPE_CU_FONT {OB_FONT, "FONT", 0, "Font", ""}
105 EnumPropertyItem object_type_items[] = {
106 {OB_MESH, "MESH", 0, "Mesh", ""},
109 {OB_MBALL, "META", 0, "Meta", ""},
111 {0, "", 0, NULL, NULL},
112 {OB_ARMATURE, "ARMATURE", 0, "Armature", ""},
113 {OB_LATTICE, "LATTICE", 0, "Lattice", ""},
114 {OB_EMPTY, "EMPTY", 0, "Empty", ""},
115 {0, "", 0, NULL, NULL},
116 {OB_CAMERA, "CAMERA", 0, "Camera", ""},
117 {OB_LAMP, "LAMP", 0, "Lamp", ""},
118 {OB_SPEAKER, "SPEAKER", 0, "Speaker", ""},
119 {0, NULL, 0, NULL, NULL}};
121 EnumPropertyItem object_type_curve_items[] = {
125 {0, NULL, 0, NULL, NULL}};
130 #include "BLI_math.h"
132 #include "DNA_key_types.h"
133 #include "DNA_constraint_types.h"
134 #include "DNA_lattice_types.h"
135 #include "DNA_node_types.h"
137 #include "BKE_armature.h"
138 #include "BKE_bullet.h"
139 #include "BKE_constraint.h"
140 #include "BKE_context.h"
141 #include "BKE_curve.h"
142 #include "BKE_depsgraph.h"
143 #include "BKE_effect.h"
145 #include "BKE_object.h"
146 #include "BKE_material.h"
147 #include "BKE_mesh.h"
148 #include "BKE_particle.h"
149 #include "BKE_scene.h"
150 #include "BKE_deform.h"
152 #include "BLI_editVert.h" /* for EditMesh->mat_nr */
155 #include "ED_object.h"
156 #include "ED_particle.h"
157 #include "ED_curve.h"
158 #include "ED_lattice.h"
160 static void rna_Object_internal_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
162 DAG_id_tag_update(ptr->id.data, OB_RECALC_OB);
165 static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
167 /* dont use compat so we get predictable rotation */
168 object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat, FALSE, TRUE);
169 rna_Object_internal_update(bmain, scene, ptr);
172 static void rna_Object_matrix_local_get(PointerRNA *ptr, float values[16])
174 Object *ob= ptr->id.data;
177 float invmat[4][4]; /* for inverse of parent's matrix */
178 invert_m4_m4(invmat, ob->parent->obmat);
179 mul_m4_m4m4((float(*)[4])values, ob->obmat, invmat);
182 copy_m4_m4((float(*)[4])values, ob->obmat);
186 static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16])
188 Object *ob= ptr->id.data;
190 /* localspace matrix is truly relative to the parent, but parameters
191 * stored in object are relative to parentinv matrix. Undo the parent
192 * inverse part before updating obmat and calling apply_obmat() */
195 invert_m4_m4(invmat, ob->parentinv);
196 mul_m4_m4m4(ob->obmat, (float(*)[4])values, invmat);
199 copy_m4_m4(ob->obmat, (float(*)[4])values);
202 /* dont use compat so we get predictable rotation */
203 object_apply_mat4(ob, ob->obmat, FALSE, FALSE);
206 static void rna_Object_matrix_basis_get(PointerRNA *ptr, float values[16])
208 Object *ob= ptr->id.data;
209 object_to_mat4(ob, (float(*)[4])values);
212 static void rna_Object_matrix_basis_set(PointerRNA *ptr, const float values[16])
214 Object *ob= ptr->id.data;
215 object_apply_mat4(ob, (float(*)[4])values, FALSE, FALSE);
218 void rna_Object_internal_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
220 DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
221 WM_main_add_notifier(NC_OBJECT|ND_DRAW, ptr->id.data);
224 void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
226 Object *ob= ptr->id.data;
228 if(scene->obedit == ob) {
229 /* exit/enter editmode to get new shape */
232 load_editMesh(scene, ob);
233 make_editMesh(scene, ob);
247 rna_Object_internal_update_data(bmain, scene, ptr);
250 static void rna_Object_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
252 DAG_id_tag_update(ptr->id.data, OB_RECALC_OB);
253 DAG_scene_sort(bmain, scene);
254 WM_main_add_notifier(NC_OBJECT|ND_PARENT, ptr->id.data);
257 /* when changing the selection flag the scene needs updating */
258 static void rna_Object_select_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
260 Object *ob= (Object*)ptr->id.data;
261 short mode = ob->flag & SELECT ? BA_SELECT : BA_DESELECT;
262 ED_base_object_select(object_in_scene(ob, scene), mode);
265 static void rna_Base_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
267 Base *base= (Base*)ptr->data;
268 short mode = base->flag & BA_SELECT ? BA_SELECT : BA_DESELECT;
269 ED_base_object_select(base, mode);
272 static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, Base *base, Object *ob)
274 /* try to avoid scene sort */
276 /* pass - unlikely but when running scripts on startup it happens */
278 else if((ob->lay & scene->lay) && (base->lay & scene->lay)) {
281 else if((ob->lay & scene->lay)==0 && (base->lay & scene->lay)==0) {
285 DAG_scene_sort(bmain, scene);
289 static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
291 Object *ob= (Object*)ptr->id.data;
294 base= scene ? object_in_scene(ob, scene) : NULL;
298 SWAP(int, base->lay, ob->lay);
300 rna_Object_layer_update__internal(bmain, scene, base, ob);
303 WM_main_add_notifier(NC_SCENE|ND_LAYER_CONTENT, scene);
306 static void rna_Base_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
308 Base *base= (Base*)ptr->data;
309 Object *ob= (Object*)base->object;
311 rna_Object_layer_update__internal(bmain, scene, base, ob);
314 WM_main_add_notifier(NC_SCENE|ND_LAYER_CONTENT, scene);
317 static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
319 Object *ob= (Object*)ptr->data;
322 if (id == NULL || ob->mode & OB_MODE_EDIT)
325 if (ob->type == OB_EMPTY) {
327 id_us_min((ID*)ob->data);
331 if (id && GS(id->name) == ID_IM) {
336 else if(ob->type == OB_MESH) {
337 set_mesh(ob, (Mesh*)id);
341 id_us_min((ID*)ob->data);
346 test_object_materials(id);
348 if(GS(id->name)==ID_CU)
350 else if(ob->type==OB_ARMATURE)
351 armature_rebuild_pose(ob, ob->data);
355 static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
357 Object *ob= (Object*)ptr->data;
360 case OB_EMPTY: return &RNA_Image;
361 case OB_MESH: return &RNA_Mesh;
362 case OB_CURVE: return &RNA_Curve;
363 case OB_SURF: return &RNA_Curve;
364 case OB_FONT: return &RNA_Curve;
365 case OB_MBALL: return &RNA_MetaBall;
366 case OB_LAMP: return &RNA_Lamp;
367 case OB_CAMERA: return &RNA_Camera;
368 case OB_LATTICE: return &RNA_Lattice;
369 case OB_ARMATURE: return &RNA_Armature;
370 case OB_SPEAKER: return &RNA_Speaker;
371 default: return &RNA_ID;
375 static void rna_Object_parent_set(PointerRNA *ptr, PointerRNA value)
377 Object *ob= (Object*)ptr->data;
378 Object *par= (Object*)value.data;
380 ED_object_parent(ob, par, ob->partype, ob->parsubstr);
383 static void rna_Object_parent_type_set(PointerRNA *ptr, int value)
385 Object *ob= (Object*)ptr->data;
387 ED_object_parent(ob, ob->parent, value, ob->parsubstr);
390 static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
392 Object *ob= (Object*)ptr->data;
393 EnumPropertyItem *item= NULL;
396 RNA_enum_items_add_value(&item, &totitem, parent_type_items, PAROBJECT);
399 Object *par= ob->parent;
401 if(par->type == OB_CURVE)
402 RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARCURVE);
403 else if(par->type == OB_LATTICE)
404 RNA_enum_items_add_value(&item, &totitem, &parent_type_items[4], PARSKEL); // special hack: prevents this overriding others
405 else if(par->type == OB_ARMATURE) {
406 RNA_enum_items_add_value(&item, &totitem, &parent_type_items[3], PARSKEL); // special hack: prevents this being overrided
407 RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARBONE);
409 else if(par->type == OB_MESH) {
410 RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT1);
411 RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT3);
415 RNA_enum_item_end(&item, &totitem);
421 static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
423 Object *ob= (Object*)ptr->data;
424 EnumPropertyItem *item= NULL;
427 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_POLYH);
428 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_POLYT);
430 if(ob->body_type!=OB_BODY_TYPE_SOFT) {
431 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CONE);
432 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CYLINDER);
433 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_SPHERE);
434 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_BOX);
435 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CAPSULE);
438 RNA_enum_item_end(&item, &totitem);
444 static void rna_Object_parent_bone_set(PointerRNA *ptr, const char *value)
446 Object *ob= (Object*)ptr->data;
448 ED_object_parent(ob, ob->parent, ob->partype, value);
451 static void rna_Object_dup_group_set(PointerRNA *ptr, PointerRNA value)
453 Object *ob= (Object *)ptr->data;
454 Group *grp = (Group *)value.data;
456 /* must not let this be set if the object belongs in this group already,
457 * thus causing a cycle/infinite-recursion leading to crashes on load [#25298]
459 if (object_in_group(ob, grp) == 0)
462 BKE_report(NULL, RPT_ERROR, "Cannot set dupli-group as object belongs in group being instanced thus causing a cycle");
465 void rna_VertexGroup_name_set(PointerRNA *ptr, const char *value)
467 Object *ob= (Object *)ptr->id.data;
468 bDeformGroup *dg= (bDeformGroup *)ptr->data;
469 BLI_strncpy_utf8(dg->name, value, sizeof(dg->name));
470 defgroup_unique_name(dg, ob);
473 static int rna_VertexGroup_index_get(PointerRNA *ptr)
475 Object *ob= (Object*)ptr->id.data;
477 return BLI_findindex(&ob->defbase, ptr->data);
480 static PointerRNA rna_Object_active_vertex_group_get(PointerRNA *ptr)
482 Object *ob= (Object*)ptr->id.data;
483 return rna_pointer_inherit_refine(ptr, &RNA_VertexGroup, BLI_findlink(&ob->defbase, ob->actdef-1));
486 static int rna_Object_active_vertex_group_index_get(PointerRNA *ptr)
488 Object *ob= (Object*)ptr->id.data;
492 static void rna_Object_active_vertex_group_index_set(PointerRNA *ptr, int value)
494 Object *ob= (Object*)ptr->id.data;
498 static void rna_Object_active_vertex_group_index_range(PointerRNA *ptr, int *min, int *max)
500 Object *ob= (Object*)ptr->id.data;
503 *max= BLI_countlist(&ob->defbase)-1;
507 void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
509 Object *ob= (Object*)ptr->id.data;
512 dg= BLI_findlink(&ob->defbase, index-1);
514 if(dg) BLI_strncpy(value, dg->name, sizeof(dg->name));
518 int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index)
520 Object *ob= (Object*)ptr->id.data;
523 dg= BLI_findlink(&ob->defbase, index-1);
524 return (dg)? strlen(dg->name): 0;
527 void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
529 Object *ob= (Object*)ptr->id.data;
530 *index= defgroup_name_index(ob, value) + 1;
533 void rna_object_vgroup_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
535 Object *ob= (Object*)ptr->id.data;
536 bDeformGroup *dg= defgroup_find_name(ob, value);
538 BLI_strncpy(result, value, maxlen); /* no need for BLI_strncpy_utf8, since this matches an existing group */
545 void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
547 Object *ob= (Object*)ptr->id.data;
549 CustomDataLayer *layer;
552 if(ob->type == OB_MESH && ob->data) {
555 for(a=0; a<me->fdata.totlayer; a++) {
556 layer= &me->fdata.layers[a];
558 if(layer->type == CD_MTFACE && strcmp(layer->name, value) == 0) {
559 BLI_strncpy(result, value, maxlen);
568 void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
570 Object *ob= (Object*)ptr->id.data;
572 CustomDataLayer *layer;
575 if(ob->type == OB_MESH && ob->data) {
578 for(a=0; a<me->fdata.totlayer; a++) {
579 layer= &me->fdata.layers[a];
581 if(layer->type == CD_MCOL && strcmp(layer->name, value) == 0) {
582 BLI_strncpy(result, value, maxlen);
591 static int rna_Object_active_material_index_get(PointerRNA *ptr)
593 Object *ob= (Object*)ptr->id.data;
594 return MAX2(ob->actcol-1, 0);
597 static void rna_Object_active_material_index_set(PointerRNA *ptr, int value)
599 Object *ob= (Object*)ptr->id.data;
602 if(ob->type==OB_MESH) {
606 me->edit_mesh->mat_nr= value;
610 static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, int *max)
612 Object *ob= (Object*)ptr->id.data;
614 *max= MAX2(ob->totcol-1, 0);
617 /* returns active base material */
618 static PointerRNA rna_Object_active_material_get(PointerRNA *ptr)
620 Object *ob= (Object*)ptr->id.data;
623 ma= (ob->totcol)? give_current_material(ob, ob->actcol): NULL;
624 return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
627 static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value)
629 Object *ob= (Object*)ptr->id.data;
631 DAG_id_tag_update(value.data, 0);
632 assign_material(ob, value.data, ob->actcol);
635 static void rna_Object_active_particle_system_index_range(PointerRNA *ptr, int *min, int *max)
637 Object *ob= (Object*)ptr->id.data;
639 *max= BLI_countlist(&ob->particlesystem)-1;
643 static int rna_Object_active_particle_system_index_get(PointerRNA *ptr)
645 Object *ob= (Object*)ptr->id.data;
646 return psys_get_current_num(ob);
649 static void rna_Object_active_particle_system_index_set(PointerRNA *ptr, int value)
651 Object *ob= (Object*)ptr->id.data;
652 psys_set_current_num(ob, value);
655 static void rna_Object_particle_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
657 Object *ob= (Object*)ptr->id.data;
659 PE_current_changed(scene, ob);
662 /* rotation - axis-angle */
663 static void rna_Object_rotation_axis_angle_get(PointerRNA *ptr, float *value)
665 Object *ob= ptr->data;
667 /* for now, assume that rotation mode is axis-angle */
668 value[0]= ob->rotAngle;
669 copy_v3_v3(&value[1], ob->rotAxis);
672 /* rotation - axis-angle */
673 static void rna_Object_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
675 Object *ob= ptr->data;
677 /* for now, assume that rotation mode is axis-angle */
678 ob->rotAngle= value[0];
679 copy_v3_v3(ob->rotAxis, (float *)&value[1]);
681 // TODO: validate axis?
684 static void rna_Object_rotation_mode_set(PointerRNA *ptr, int value)
686 Object *ob= ptr->data;
688 /* use API Method for conversions... */
689 BKE_rotMode_change_values(ob->quat, ob->rot, ob->rotAxis, &ob->rotAngle, ob->rotmode, (short)value);
691 /* finally, set the new rotation type */
695 static void rna_Object_dimensions_get(PointerRNA *ptr, float *value)
697 Object *ob= ptr->data;
698 object_get_dimensions(ob, value);
701 static void rna_Object_dimensions_set(PointerRNA *ptr, const float *value)
703 Object *ob= ptr->data;
704 object_set_dimensions(ob, value);
707 static int rna_Object_location_editable(PointerRNA *ptr, int index)
709 Object *ob= (Object *)ptr->data;
711 /* only if the axis in question is locked, not editable... */
712 if ((index == 0) && (ob->protectflag & OB_LOCK_LOCX))
714 else if ((index == 1) && (ob->protectflag & OB_LOCK_LOCY))
716 else if ((index == 2) && (ob->protectflag & OB_LOCK_LOCZ))
719 return PROP_EDITABLE;
722 static int rna_Object_scale_editable(PointerRNA *ptr, int index)
724 Object *ob= (Object *)ptr->data;
726 /* only if the axis in question is locked, not editable... */
727 if ((index == 0) && (ob->protectflag & OB_LOCK_SCALEX))
729 else if ((index == 1) && (ob->protectflag & OB_LOCK_SCALEY))
731 else if ((index == 2) && (ob->protectflag & OB_LOCK_SCALEZ))
734 return PROP_EDITABLE;
737 static int rna_Object_rotation_euler_editable(PointerRNA *ptr, int index)
739 Object *ob= (Object *)ptr->data;
741 /* only if the axis in question is locked, not editable... */
742 if ((index == 0) && (ob->protectflag & OB_LOCK_ROTX))
744 else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTY))
746 else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTZ))
749 return PROP_EDITABLE;
752 static int rna_Object_rotation_4d_editable(PointerRNA *ptr, int index)
754 Object *ob= (Object *)ptr->data;
756 /* only consider locks if locking components individually... */
757 if (ob->protectflag & OB_LOCK_ROT4D) {
758 /* only if the axis in question is locked, not editable... */
759 if ((index == 0) && (ob->protectflag & OB_LOCK_ROTW))
761 else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTX))
763 else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTY))
765 else if ((index == 3) && (ob->protectflag & OB_LOCK_ROTZ))
769 return PROP_EDITABLE;
773 static PointerRNA rna_MaterialSlot_material_get(PointerRNA *ptr)
775 Object *ob= (Object*)ptr->id.data;
777 int index= (Material**)ptr->data - ob->mat;
779 ma= give_current_material(ob, index+1);
780 return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
783 static void rna_MaterialSlot_material_set(PointerRNA *ptr, PointerRNA value)
785 Object *ob= (Object*)ptr->id.data;
786 int index= (Material**)ptr->data - ob->mat;
788 assign_material(ob, value.data, index+1);
791 static int rna_MaterialSlot_link_get(PointerRNA *ptr)
793 Object *ob= (Object*)ptr->id.data;
794 int index= (Material**)ptr->data - ob->mat;
796 return ob->matbits[index] != 0;
799 static void rna_MaterialSlot_link_set(PointerRNA *ptr, int value)
801 Object *ob= (Object*)ptr->id.data;
802 int index= (Material**)ptr->data - ob->mat;
805 ob->matbits[index]= 1;
806 ob->colbits |= (1<<index);
809 ob->matbits[index]= 0;
810 ob->colbits &= ~(1<<index);
814 static int rna_MaterialSlot_name_length(PointerRNA *ptr)
816 Object *ob= (Object*)ptr->id.data;
818 int index= (Material**)ptr->data - ob->mat;
820 ma= give_current_material(ob, index+1);
823 return strlen(ma->id.name+2);
828 static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str)
830 Object *ob= (Object*)ptr->id.data;
832 int index= (Material**)ptr->data - ob->mat;
834 ma= give_current_material(ob, index+1);
837 strcpy(str, ma->id.name+2);
842 static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr)
844 rna_Object_internal_update(bmain, scene, ptr);
845 WM_main_add_notifier(NC_OBJECT|ND_OB_SHADING, ptr->id.data);
848 /* why does this have to be so complicated?, can't all this crap be
849 * moved to in BGE conversion function? - Campbell *
851 * logic from check_body_type()
853 static int rna_GameObjectSettings_physics_type_get(PointerRNA *ptr)
855 Object *ob= (Object*)ptr->id.data;
857 /* determine the body_type setting based on flags */
858 if (!(ob->gameflag & OB_COLLISION)) {
859 if (ob->gameflag & OB_OCCLUDER) {
860 ob->body_type = OB_BODY_TYPE_OCCLUDER;
861 } else if (ob->gameflag & OB_NAVMESH){
862 ob->body_type = OB_BODY_TYPE_NAVMESH;
864 ob->body_type = OB_BODY_TYPE_NO_COLLISION;
866 } else if (ob->gameflag & OB_SENSOR) {
867 ob->body_type = OB_BODY_TYPE_SENSOR;
868 } else if (!(ob->gameflag & OB_DYNAMIC)) {
869 ob->body_type = OB_BODY_TYPE_STATIC;
870 } else if (!(ob->gameflag & (OB_RIGID_BODY|OB_SOFT_BODY))) {
871 ob->body_type = OB_BODY_TYPE_DYNAMIC;
872 } else if (ob->gameflag & OB_RIGID_BODY) {
873 ob->body_type = OB_BODY_TYPE_RIGID;
875 ob->body_type = OB_BODY_TYPE_SOFT;
876 /* create the structure here because we display soft body buttons in the main panel */
878 ob->bsoft = bsbNew();
881 return ob->body_type;
884 static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
886 Object *ob= (Object*)ptr->id.data;
887 ob->body_type= value;
889 switch (ob->body_type) {
890 case OB_BODY_TYPE_SENSOR:
891 ob->gameflag |= OB_SENSOR|OB_COLLISION|OB_GHOST;
892 ob->gameflag &= ~(OB_OCCLUDER|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_ACTOR|OB_ANISOTROPIC_FRICTION|OB_DO_FH|OB_ROT_FH|OB_COLLISION_RESPONSE|OB_NAVMESH);
894 case OB_BODY_TYPE_OCCLUDER:
895 ob->gameflag |= OB_OCCLUDER;
896 ob->gameflag &= ~(OB_SENSOR|OB_COLLISION|OB_DYNAMIC|OB_NAVMESH);
898 case OB_BODY_TYPE_NAVMESH:
899 ob->gameflag |= OB_NAVMESH;
900 ob->gameflag &= ~(OB_SENSOR|OB_COLLISION|OB_DYNAMIC|OB_OCCLUDER);
902 case OB_BODY_TYPE_NO_COLLISION:
903 ob->gameflag &= ~(OB_SENSOR|OB_COLLISION|OB_OCCLUDER|OB_DYNAMIC|OB_NAVMESH);
905 case OB_BODY_TYPE_STATIC:
906 ob->gameflag |= OB_COLLISION;
907 ob->gameflag &= ~(OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_OCCLUDER|OB_SENSOR|OB_NAVMESH);
909 case OB_BODY_TYPE_DYNAMIC:
910 ob->gameflag |= OB_COLLISION|OB_DYNAMIC|OB_ACTOR;
911 ob->gameflag &= ~(OB_RIGID_BODY|OB_SOFT_BODY|OB_OCCLUDER|OB_SENSOR|OB_NAVMESH);
913 case OB_BODY_TYPE_RIGID:
914 ob->gameflag |= OB_COLLISION|OB_DYNAMIC|OB_RIGID_BODY|OB_ACTOR;
915 ob->gameflag &= ~(OB_SOFT_BODY|OB_OCCLUDER|OB_SENSOR|OB_NAVMESH);
918 case OB_BODY_TYPE_SOFT:
919 ob->gameflag |= OB_COLLISION|OB_DYNAMIC|OB_SOFT_BODY|OB_ACTOR;
920 ob->gameflag &= ~(OB_RIGID_BODY|OB_OCCLUDER|OB_SENSOR|OB_NAVMESH);
922 /* assume triangle mesh, if no bounds chosen for soft body */
923 if ((ob->gameflag & OB_BOUNDS) && (ob->boundtype<OB_BOUND_POLYH))
925 ob->boundtype=OB_BOUND_POLYH;
927 /* create a BulletSoftBody structure if not already existing */
929 ob->bsoft = bsbNew();
934 static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr)
936 Object *ob= (Object*)ptr->id.data;
937 ParticleSystem *psys= psys_get_current(ob);
938 return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem, psys);
941 static PointerRNA rna_Object_game_settings_get(PointerRNA *ptr)
943 return rna_pointer_inherit_refine(ptr, &RNA_GameObjectSettings, ptr->id.data);
947 static unsigned int rna_Object_layer_validate__internal(const int *values, unsigned int lay)
951 /* ensure we always have some layer selected */
959 for(i=0; i<20; i++) {
960 if(values[i]) lay |= (1<<i);
967 static void rna_Object_layer_set(PointerRNA *ptr, const int *values)
969 Object *ob= (Object*)ptr->data;
972 lay= rna_Object_layer_validate__internal(values, ob->lay);
977 static void rna_Base_layer_set(PointerRNA *ptr, const int *values)
979 Base *base= (Base*)ptr->data;
982 lay= rna_Object_layer_validate__internal(values, base->lay);
986 /* rna_Base_layer_update updates the objects layer */
989 static void rna_GameObjectSettings_state_get(PointerRNA *ptr, int *values)
991 Object *ob= (Object*)ptr->data;
993 int all_states = (ob->scaflag & OB_ALLSTATE?1:0);
995 memset(values, 0, sizeof(int)*OB_MAX_STATES);
996 for(i=0; i<OB_MAX_STATES; i++)
997 values[i] = (ob->state & (1<<i)) | all_states;
1000 static void rna_GameObjectSettings_state_set(PointerRNA *ptr, const int *values)
1002 Object *ob= (Object*)ptr->data;
1005 /* ensure we always have some state selected */
1006 for(i=0; i<OB_MAX_STATES; i++)
1013 for(i=0; i<OB_MAX_STATES; i++) {
1014 if(values[i]) ob->state |= (1<<i);
1015 else ob->state &= ~(1<<i);
1019 static void rna_GameObjectSettings_used_state_get(PointerRNA *ptr, int *values)
1021 Object *ob= (Object*)ptr->data;
1024 memset(values, 0, sizeof(int)*OB_MAX_STATES);
1025 for (cont=ob->controllers.first; cont; cont=cont->next) {
1028 for (i=0; i<OB_MAX_STATES; i++) {
1029 if (cont->state_mask & (1<<i))
1035 static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, int *max)
1037 Object *ob= (Object*)ptr->id.data;
1038 Key *key= ob_get_key(ob);
1042 *max= BLI_countlist(&key->block)-1;
1043 if(*max < 0) *max= 0;
1050 static int rna_Object_active_shape_key_index_get(PointerRNA *ptr)
1052 Object *ob= (Object*)ptr->id.data;
1054 return MAX2(ob->shapenr-1, 0);
1057 static void rna_Object_active_shape_key_index_set(PointerRNA *ptr, int value)
1059 Object *ob= (Object*)ptr->id.data;
1061 ob->shapenr= value+1;
1064 static PointerRNA rna_Object_active_shape_key_get(PointerRNA *ptr)
1066 Object *ob= (Object*)ptr->id.data;
1067 Key *key= ob_get_key(ob);
1072 return PointerRNA_NULL;
1074 kb= BLI_findlink(&key->block, ob->shapenr-1);
1075 RNA_pointer_create((ID *)key, &RNA_ShapeKey, kb, &keyptr);
1079 static PointerRNA rna_Object_field_get(PointerRNA *ptr)
1081 Object *ob= (Object*)ptr->id.data;
1085 ob->pd= object_add_collision_fields(0);
1087 return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, ob->pd);
1090 static PointerRNA rna_Object_collision_get(PointerRNA *ptr)
1092 Object *ob= (Object*)ptr->id.data;
1094 if(ob->type != OB_MESH)
1095 return PointerRNA_NULL;
1099 ob->pd= object_add_collision_fields(0);
1101 return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd);
1104 static PointerRNA rna_Object_active_constraint_get(PointerRNA *ptr)
1106 Object *ob= (Object*)ptr->id.data;
1107 bConstraint *con= constraints_get_active(&ob->constraints);
1108 return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con);
1111 static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value)
1113 Object *ob= (Object*)ptr->id.data;
1114 constraints_set_active(&ob->constraints, (bConstraint *)value.data);
1117 static bConstraint *rna_Object_constraints_new(Object *object, int type)
1119 WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object);
1120 return add_ob_constraint(object, NULL, type);
1123 static void rna_Object_constraints_remove(Object *object, ReportList *reports, bConstraint *con)
1125 if(BLI_findindex(&object->constraints, con) == -1) {
1126 BKE_reportf(reports, RPT_ERROR, "Constraint '%s' not found in object '%s'.", con->name, object->id.name+2);
1130 remove_constraint(&object->constraints, con);
1131 ED_object_constraint_update(object);
1132 ED_object_constraint_set_active(object, NULL);
1133 WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_REMOVED, object);
1136 static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports, const char *name, int type)
1138 return ED_object_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
1141 static void rna_Object_modifier_remove(Object *object, bContext *C, ReportList *reports, ModifierData *md)
1143 ED_object_modifier_remove(reports, CTX_data_main(C), CTX_data_scene(C), object, md);
1146 static void rna_Object_boundbox_get(PointerRNA *ptr, float *values)
1148 Object *ob= (Object*)ptr->id.data;
1149 BoundBox *bb= object_get_boundbox(ob);
1151 memcpy(values, bb->vec, sizeof(bb->vec));
1154 fill_vn(values, sizeof(bb->vec)/sizeof(float), 0.0f);
1159 static bDeformGroup *rna_Object_vgroup_new(Object *ob, const char *name)
1161 bDeformGroup *defgroup = ED_vgroup_add_name(ob, name);
1163 WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
1168 static void rna_Object_vgroup_remove(Object *ob, bDeformGroup *defgroup)
1170 ED_vgroup_delete(ob, defgroup);
1172 WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
1175 static void rna_VertexGroup_vertex_add(ID *id, bDeformGroup *def, ReportList *reports, int index_len, int *index, float weight, int assignmode)
1177 Object *ob = (Object *)id;
1179 if(ED_vgroup_object_is_edit_mode(ob)) {
1180 BKE_reportf(reports, RPT_ERROR, "VertexGroup.add(): Can't be called while object is in edit mode.");
1185 ED_vgroup_vert_add(ob, def, *index++, weight, assignmode); /* XXX, not efficient calling within loop*/
1187 WM_main_add_notifier(NC_GEOM|ND_DATA, (ID *)ob->data);
1190 static void rna_VertexGroup_vertex_remove(ID *id, bDeformGroup *dg, ReportList *reports, int index_len, int *index)
1192 Object *ob = (Object *)id;
1194 if(ED_vgroup_object_is_edit_mode(ob)) {
1195 BKE_reportf(reports, RPT_ERROR, "VertexGroup.remove(): Can't be called while object is in edit mode.");
1200 ED_vgroup_vert_remove(ob, dg, *index++);
1202 WM_main_add_notifier(NC_GEOM|ND_DATA, (ID *)ob->data);
1205 static float rna_VertexGroup_weight(ID *id, bDeformGroup *dg, ReportList *reports, int index)
1207 float weight = ED_vgroup_vert_weight((Object *)id, dg, index);
1210 BKE_reportf(reports, RPT_ERROR, "Vertex not in group");
1215 /* generic poll functions */
1216 int rna_Lattice_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
1218 return ((Object *)value.id.data)->type == OB_LATTICE;
1221 int rna_Curve_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
1223 return ((Object *)value.id.data)->type == OB_CURVE;
1226 int rna_Armature_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
1228 return ((Object *)value.id.data)->type == OB_ARMATURE;
1231 int rna_Mesh_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
1233 return ((Object *)value.id.data)->type == OB_MESH;
1236 int rna_Camera_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
1238 return ((Object *)value.id.data)->type == OB_CAMERA;
1243 static int rna_matrix_dimsize_4x4[]= {4, 4};
1245 static void rna_def_vertex_group(BlenderRNA *brna)
1251 static EnumPropertyItem assign_mode_items[] = {
1252 {WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"},
1253 {WEIGHT_ADD, "ADD", 0, "Add", "Add"},
1254 {WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"},
1255 {0, NULL, 0, NULL, NULL}
1258 srna= RNA_def_struct(brna, "VertexGroup", NULL);
1259 RNA_def_struct_sdna(srna, "bDeformGroup");
1260 RNA_def_struct_ui_text(srna, "Vertex Group", "Group of vertices, used for armature deform and other purposes");
1261 RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
1263 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1264 RNA_def_property_ui_text(prop, "Name", "Vertex group name");
1265 RNA_def_struct_name_property(srna, prop);
1266 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_VertexGroup_name_set");
1267 RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, "rna_Object_internal_update_data"); /* update data because modifiers may use [#24761] */
1269 prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
1270 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1271 RNA_def_property_int_funcs(prop, "rna_VertexGroup_index_get", NULL, NULL);
1272 RNA_def_property_ui_text(prop, "Index", "Index number of the vertex group");
1274 func= RNA_def_function(srna, "add", "rna_VertexGroup_vertex_add");
1275 RNA_def_function_ui_description(func, "Add vertices to the group.");
1276 RNA_def_function_flag(func, FUNC_USE_REPORTS|FUNC_USE_SELF_ID);
1277 /* TODO, see how array size of 0 works, this shouldnt be used */
1278 prop= RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List.", 0, 0);
1279 RNA_def_property_flag(prop, PROP_DYNAMIC|PROP_REQUIRED);
1280 prop= RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight.", 0.0f, 1.0f);
1281 RNA_def_property_flag(prop, PROP_REQUIRED);
1282 prop= RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode.");
1283 RNA_def_property_flag(prop, PROP_REQUIRED);
1285 func= RNA_def_function(srna, "remove", "rna_VertexGroup_vertex_remove");
1286 RNA_def_function_ui_description(func, "Remove a vertex from the group.");
1287 RNA_def_function_flag(func, FUNC_USE_REPORTS|FUNC_USE_SELF_ID);
1288 /* TODO, see how array size of 0 works, this shouldnt be used */
1289 prop= RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List.", 0, 0);
1290 RNA_def_property_flag(prop, PROP_DYNAMIC|PROP_REQUIRED);
1292 func= RNA_def_function(srna, "weight", "rna_VertexGroup_weight");
1293 RNA_def_function_ui_description(func, "Get a vertex weight from the group.");
1294 RNA_def_function_flag(func, FUNC_USE_REPORTS|FUNC_USE_SELF_ID);
1295 prop=RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "The index of the vertex.", 0, INT_MAX);
1296 RNA_def_property_flag(prop, PROP_REQUIRED);
1297 prop= RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight.", 0.0f, 1.0f);
1298 RNA_def_function_return(func, prop);
1301 static void rna_def_material_slot(BlenderRNA *brna)
1306 static EnumPropertyItem link_items[] = {
1307 {1, "OBJECT", 0, "Object", ""},
1308 {0, "DATA", 0, "Data", ""},
1309 {0, NULL, 0, NULL, NULL}};
1311 /* NOTE: there is no MaterialSlot equivalent in DNA, so the internal
1312 * pointer data points to ob->mat + index, and we manually implement
1313 * get/set for the properties. */
1315 srna= RNA_def_struct(brna, "MaterialSlot", NULL);
1316 RNA_def_struct_ui_text(srna, "Material Slot", "Material slot in an object");
1317 RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
1319 prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
1320 RNA_def_property_struct_type(prop, "Material");
1321 RNA_def_property_flag(prop, PROP_EDITABLE);
1322 RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", "rna_MaterialSlot_material_set", NULL, NULL);
1323 RNA_def_property_ui_text(prop, "Material", "Material datablock used by this material slot");
1324 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
1326 prop= RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
1327 RNA_def_property_enum_items(prop, link_items);
1328 RNA_def_property_enum_funcs(prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL);
1329 RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data");
1330 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
1332 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1333 RNA_def_property_string_funcs(prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL);
1334 RNA_def_property_ui_text(prop, "Name", "Material slot name");
1335 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1336 RNA_def_struct_name_property(srna, prop);
1339 static void rna_def_object_game_settings(BlenderRNA *brna)
1344 static EnumPropertyItem body_type_items[] = {
1345 {OB_BODY_TYPE_NO_COLLISION, "NO_COLLISION", 0, "No Collision", "Disable collision for this object"},
1346 {OB_BODY_TYPE_STATIC, "STATIC", 0, "Static", "Stationary object"},
1347 {OB_BODY_TYPE_DYNAMIC, "DYNAMIC", 0, "Dynamic", "Linear physics"},
1348 {OB_BODY_TYPE_RIGID, "RIGID_BODY", 0, "Rigid Body", "Linear and angular physics"},
1349 {OB_BODY_TYPE_SOFT, "SOFT_BODY", 0, "Soft Body", "Soft body"},
1350 {OB_BODY_TYPE_OCCLUDER, "OCCLUDE", 0, "Occlude", "Occluder for optimizing scene rendering"},
1351 {OB_BODY_TYPE_SENSOR, "SENSOR", 0, "Sensor", "Collision Sensor, detects static and dynamic objects but not the other collision sensor objects"},
1352 {OB_BODY_TYPE_NAVMESH, "NAVMESH", 0, "Navigation Mesh", "Navigation mesh"},
1353 {0, NULL, 0, NULL, NULL}};
1355 srna= RNA_def_struct(brna, "GameObjectSettings", NULL);
1356 RNA_def_struct_sdna(srna, "Object");
1357 RNA_def_struct_nested(brna, srna, "Object");
1358 RNA_def_struct_ui_text(srna, "Game Object Settings", "Game engine related settings for the object");
1359 RNA_def_struct_ui_icon(srna, ICON_GAME);
1363 prop= RNA_def_property(srna, "sensors", PROP_COLLECTION, PROP_NONE);
1364 RNA_def_property_struct_type(prop, "Sensor");
1365 RNA_def_property_ui_text(prop, "Sensors", "Game engine sensor to detect events");
1367 prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE);
1368 RNA_def_property_struct_type(prop, "Controller");
1369 RNA_def_property_ui_text(prop, "Controllers", "Game engine controllers to process events, connecting sensor to actuators");
1371 prop= RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE);
1372 RNA_def_property_struct_type(prop, "Actuator");
1373 RNA_def_property_ui_text(prop, "Actuators", "Game engine actuators to act on events");
1375 prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
1376 RNA_def_property_collection_sdna(prop, NULL, "prop", NULL);
1377 RNA_def_property_struct_type(prop, "GameProperty"); /* rna_property.c */
1378 RNA_def_property_ui_text(prop, "Properties", "Game engine properties");
1380 prop= RNA_def_property(srna, "show_sensors", PROP_BOOLEAN, PROP_NONE);
1381 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWSENS);
1382 RNA_def_property_ui_text(prop, "Show Sensors", "Shows sensors for this object in the user interface");
1384 prop= RNA_def_property(srna, "show_controllers", PROP_BOOLEAN, PROP_NONE);
1385 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWCONT);
1386 RNA_def_property_ui_text(prop, "Show Controllers", "Shows controllers for this object in the user interface");
1388 prop= RNA_def_property(srna, "show_actuators", PROP_BOOLEAN, PROP_NONE);
1389 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWACT);
1390 RNA_def_property_ui_text(prop, "Show Actuators", "Shows actuators for this object in the user interface");
1394 prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
1395 RNA_def_property_enum_sdna(prop, NULL, "body_type");
1396 RNA_def_property_enum_items(prop, body_type_items);
1397 RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", "rna_GameObjectSettings_physics_type_set", NULL);
1398 RNA_def_property_ui_text(prop, "Physics Type", "Selects the type of physical representation");
1399 RNA_def_property_update(prop, NC_LOGIC, NULL);
1401 prop= RNA_def_property(srna, "use_actor", PROP_BOOLEAN, PROP_NONE);
1402 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ACTOR);
1403 RNA_def_property_ui_text(prop, "Actor", "Object is detected by the Near and Radar sensor");
1405 prop= RNA_def_property(srna, "use_ghost", PROP_BOOLEAN, PROP_NONE);
1406 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_GHOST);
1407 RNA_def_property_ui_text(prop, "Ghost", "Object does not restitute collisions, like a ghost");
1409 prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
1410 RNA_def_property_range(prop, 0.01, 10000.0);
1411 RNA_def_property_ui_text(prop, "Mass", "Mass of the object");
1413 prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
1414 RNA_def_property_float_sdna(prop, NULL, "inertia");
1415 RNA_def_property_range(prop, 0.01, 10.0);
1416 RNA_def_property_ui_text(prop, "Radius", "Radius of bounding sphere and material physics");
1417 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1419 prop= RNA_def_property(srna, "use_sleep", PROP_BOOLEAN, PROP_NONE);
1420 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_COLLISION_RESPONSE);
1421 RNA_def_property_ui_text(prop, "No Sleeping", "Disable auto (de)activation in physics simulation");
1423 prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
1424 RNA_def_property_float_sdna(prop, NULL, "damping");
1425 RNA_def_property_range(prop, 0.0, 1.0);
1426 RNA_def_property_ui_text(prop, "Damping", "General movement damping");
1428 prop= RNA_def_property(srna, "rotation_damping", PROP_FLOAT, PROP_NONE);
1429 RNA_def_property_float_sdna(prop, NULL, "rdamping");
1430 RNA_def_property_range(prop, 0.0, 1.0);
1431 RNA_def_property_ui_text(prop, "Rotation Damping", "General rotation damping");
1433 prop= RNA_def_property(srna, "velocity_min", PROP_FLOAT, PROP_NONE);
1434 RNA_def_property_float_sdna(prop, NULL, "min_vel");
1435 RNA_def_property_range(prop, 0.0, 1000.0);
1436 RNA_def_property_ui_text(prop, "Velocity Min", "Clamp velocity to this minimum speed (except when totally still)");
1438 prop= RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
1439 RNA_def_property_float_sdna(prop, NULL, "max_vel");
1440 RNA_def_property_range(prop, 0.0, 1000.0);
1441 RNA_def_property_ui_text(prop, "Velocity Max", "Clamp velocity to this maximum speed");
1444 prop= RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
1445 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_AXIS);
1446 RNA_def_property_ui_text(prop, "Lock X Axis", "Disable simulation of linear motion along the X axis");
1448 prop= RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE);
1449 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_AXIS);
1450 RNA_def_property_ui_text(prop, "Lock Y Axis", "Disable simulation of linear motion along the Y axis");
1452 prop= RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE);
1453 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_AXIS);
1454 RNA_def_property_ui_text(prop, "Lock Z Axis", "Disable simulation of linear motion along the Z axis");
1458 prop= RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
1459 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_ROT_AXIS);
1460 RNA_def_property_ui_text(prop, "Lock X Rotation Axis", "Disable simulation of angular motion along the X axis");
1462 prop= RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
1463 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_ROT_AXIS);
1464 RNA_def_property_ui_text(prop, "Lock Y Rotation Axis", "Disable simulation of angular motion along the Y axis");
1466 prop= RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
1467 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_ROT_AXIS);
1468 RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis");
1470 /* is this used anywhere ? */
1471 prop= RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
1472 RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflag2", OB_NEVER_DO_ACTIVITY_CULLING);
1473 RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis");
1476 prop= RNA_def_property(srna, "use_material_physics_fh", PROP_BOOLEAN, PROP_NONE);
1477 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_DO_FH);
1478 RNA_def_property_ui_text(prop, "Use Material Force Field", "React to force field physics settings in materials");
1480 prop= RNA_def_property(srna, "use_rotate_from_normal", PROP_BOOLEAN, PROP_NONE);
1481 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ROT_FH);
1482 RNA_def_property_ui_text(prop, "Rotate From Normal", "Use face normal to rotate object, so that it points away from the surface");
1484 prop= RNA_def_property(srna, "form_factor", PROP_FLOAT, PROP_NONE);
1485 RNA_def_property_float_sdna(prop, NULL, "formfactor");
1486 RNA_def_property_range(prop, 0.0, 1.0);
1487 RNA_def_property_ui_text(prop, "Form Factor", "Form factor scales the inertia tensor");
1489 prop= RNA_def_property(srna, "use_anisotropic_friction", PROP_BOOLEAN, PROP_NONE);
1490 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ANISOTROPIC_FRICTION);
1491 RNA_def_property_ui_text(prop, "Anisotropic Friction", "Enable anisotropic friction");
1493 prop= RNA_def_property(srna, "friction_coefficients", PROP_FLOAT, PROP_NONE);
1494 RNA_def_property_float_sdna(prop, NULL, "anisotropicFriction");
1495 RNA_def_property_range(prop, 0.0, 1.0);
1496 RNA_def_property_ui_text(prop, "Friction Coefficients", "Relative friction coefficient in the in the X, Y and Z directions, when anisotropic friction is enabled");
1498 prop= RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE);
1499 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_BOUNDS);
1500 RNA_def_property_ui_text(prop, "Use Collision Bounds", "Specify a collision bounds type other than the default");
1502 prop= RNA_def_property(srna, "collision_bounds_type", PROP_ENUM, PROP_NONE);
1503 RNA_def_property_enum_sdna(prop, NULL, "boundtype");
1504 RNA_def_property_enum_items(prop, collision_bounds_items);
1505 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Object_collision_bounds_itemf");
1506 RNA_def_property_ui_text(prop, "Collision Bounds", "Selects the collision type");
1507 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1509 prop= RNA_def_property(srna, "use_collision_compound", PROP_BOOLEAN, PROP_NONE);
1510 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_CHILD);
1511 RNA_def_property_ui_text(prop, "Collision Compound", "Add children to form a compound collision object");
1513 prop= RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
1514 RNA_def_property_float_sdna(prop, NULL, "margin");
1515 RNA_def_property_range(prop, 0.0, 1.0);
1516 RNA_def_property_ui_text(prop, "Collision Margin", "Extra margin around object for collision detection, small amount required for stability");
1518 prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
1519 RNA_def_property_pointer_sdna(prop, NULL, "bsoft");
1520 RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for Bullet soft body simulation");
1522 prop= RNA_def_property(srna, "create_obstacle", PROP_BOOLEAN, PROP_NONE);
1523 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_HASOBSTACLE);
1524 RNA_def_property_ui_text(prop, "Create obstacle", "Create representation for obstacle simulation");
1526 prop= RNA_def_property(srna, "obstacle_radius", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
1527 RNA_def_property_float_sdna(prop, NULL, "obstacleRad");
1528 RNA_def_property_range(prop, 0.0, 1000.0);
1529 RNA_def_property_ui_text(prop, "Obstacle Radius", "Radius of object representation in obstacle simulation");
1533 prop= RNA_def_property(srna, "states_visible", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1534 RNA_def_property_boolean_sdna(prop, NULL, "state", 1);
1535 RNA_def_property_array(prop, OB_MAX_STATES);
1536 RNA_def_property_ui_text(prop, "State", "State determining which controllers are displayed");
1537 RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_state_get", "rna_GameObjectSettings_state_set");
1539 prop= RNA_def_property(srna, "used_states", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1540 RNA_def_property_array(prop, OB_MAX_STATES);
1541 RNA_def_property_ui_text(prop, "Used State", "States which are being used by controllers");
1542 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1543 RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_used_state_get", NULL);
1545 prop= RNA_def_property(srna, "states_initial", PROP_BOOLEAN, PROP_NONE);
1546 RNA_def_property_boolean_sdna(prop, NULL, "init_state", 1);
1547 RNA_def_property_array(prop, OB_MAX_STATES);
1548 RNA_def_property_ui_text(prop, "Initial State", "Initial state when the game starts");
1550 prop= RNA_def_property(srna, "show_debug_state", PROP_BOOLEAN, PROP_NONE);
1551 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_DEBUGSTATE);
1552 RNA_def_property_ui_text(prop, "Debug State", "Print state debug info in the game engine");
1553 RNA_def_property_ui_icon(prop, ICON_INFO, 0);
1555 prop= RNA_def_property(srna, "use_all_states", PROP_BOOLEAN, PROP_NONE);
1556 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_ALLSTATE);
1557 RNA_def_property_ui_text(prop, "All", "Set all state bits");
1559 prop= RNA_def_property(srna, "show_state_panel", PROP_BOOLEAN, PROP_NONE);
1560 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWSTATE);
1561 RNA_def_property_ui_text(prop, "States", "Show state panel");
1562 RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
1565 static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop)
1573 RNA_def_property_srna(cprop, "ObjectConstraints");
1574 srna= RNA_def_struct(brna, "ObjectConstraints", NULL);
1575 RNA_def_struct_sdna(srna, "Object");
1576 RNA_def_struct_ui_text(srna, "Object Constraints", "Collection of object constraints");
1579 /* Collection active property */
1580 prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1581 RNA_def_property_struct_type(prop, "Constraint");
1582 RNA_def_property_pointer_funcs(prop, "rna_Object_active_constraint_get", "rna_Object_active_constraint_set", NULL, NULL);
1583 RNA_def_property_flag(prop, PROP_EDITABLE);
1584 RNA_def_property_ui_text(prop, "Active Constraint", "Active Object constraint");
1587 /* Constraint collection */
1588 func= RNA_def_function(srna, "new", "rna_Object_constraints_new");
1589 RNA_def_function_ui_description(func, "Add a new constraint to this object");
1591 parm= RNA_def_enum(func, "type", constraint_type_items, 1, "", "Constraint type to add.");
1592 RNA_def_property_flag(parm, PROP_REQUIRED);
1594 parm= RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint.");
1595 RNA_def_function_return(func, parm);
1597 func= RNA_def_function(srna, "remove", "rna_Object_constraints_remove");
1598 RNA_def_function_ui_description(func, "Remove a constraint from this object.");
1599 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1600 /* constraint to remove */
1601 parm= RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint.");
1602 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
1605 /* object.modifiers */
1606 static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
1613 RNA_def_property_srna(cprop, "ObjectModifiers");
1614 srna= RNA_def_struct(brna, "ObjectModifiers", NULL);
1615 RNA_def_struct_sdna(srna, "Object");
1616 RNA_def_struct_ui_text(srna, "Object Modifiers", "Collection of object modifiers");
1619 prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1620 RNA_def_property_struct_type(prop, "EditBone");
1621 RNA_def_property_pointer_sdna(prop, NULL, "act_edbone");
1622 RNA_def_property_flag(prop, PROP_EDITABLE);
1623 RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone");
1624 //RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update");
1625 RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_edit_bone_set", NULL, NULL);
1628 // RNA_def_property_collection_active(prop, prop_act);
1632 func= RNA_def_function(srna, "new", "rna_Object_modifier_new");
1633 RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
1634 RNA_def_function_ui_description(func, "Add a new modifier.");
1635 parm= RNA_def_string(func, "name", "Name", 0, "", "New name for the bone.");
1636 RNA_def_property_flag(parm, PROP_REQUIRED);
1637 /* modifier to add */
1638 parm= RNA_def_enum(func, "type", modifier_type_items, 1, "", "Modifier type to add.");
1639 RNA_def_property_flag(parm, PROP_REQUIRED);
1641 parm= RNA_def_pointer(func, "modifier", "Modifier", "", "Newly created modifier.");
1642 RNA_def_function_return(func, parm);
1645 func= RNA_def_function(srna, "remove", "rna_Object_modifier_remove");
1646 RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
1647 RNA_def_function_ui_description(func, "Remove an existing modifier from the object.");
1648 /* target to remove*/
1649 parm= RNA_def_pointer(func, "modifier", "Modifier", "", "Modifier to remove.");
1650 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
1653 /* object.particle_systems */
1654 static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop)
1660 // FunctionRNA *func;
1661 // PropertyRNA *parm;
1663 RNA_def_property_srna(cprop, "ParticleSystems");
1664 srna= RNA_def_struct(brna, "ParticleSystems", NULL);
1665 RNA_def_struct_sdna(srna, "Object");
1666 RNA_def_struct_ui_text(srna, "Particle Systems", "Collection of particle systems");
1668 prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1669 RNA_def_property_struct_type(prop, "ParticleSystem");
1670 RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL, NULL);
1671 RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed");
1672 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1674 prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
1675 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1676 RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get", "rna_Object_active_particle_system_index_set", "rna_Object_active_particle_system_index_range");
1677 RNA_def_property_ui_text(prop, "Active Particle System Index", "Index of active particle system slot");
1678 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_particle_update");
1682 /* object.vertex_groups */
1683 static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
1692 RNA_def_property_srna(cprop, "VertexGroups");
1693 srna= RNA_def_struct(brna, "VertexGroups", NULL);
1694 RNA_def_struct_sdna(srna, "Object");
1695 RNA_def_struct_ui_text(srna, "Vertex Groups", "Collection of vertex groups");
1697 prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1698 RNA_def_property_struct_type(prop, "VertexGroup");
1699 RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", "rna_Object_active_vertex_group_set", NULL, NULL);
1700 RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object");
1701 RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data");
1703 prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
1704 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1705 RNA_def_property_int_sdna(prop, NULL, "actdef");
1706 RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get", "rna_Object_active_vertex_group_index_set", "rna_Object_active_vertex_group_index_range");
1707 RNA_def_property_ui_text(prop, "Active Vertex Group Index", "Active index in vertex group array");
1708 RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data");
1710 /* vertex groups */ // add_vertex_group
1711 func= RNA_def_function(srna, "new", "rna_Object_vgroup_new");
1712 RNA_def_function_ui_description(func, "Add vertex group to object.");
1713 RNA_def_string(func, "name", "Group", 0, "", "Vertex group name."); /* optional */
1714 parm= RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group.");
1715 RNA_def_function_return(func, parm);
1717 func= RNA_def_function(srna, "remove", "rna_Object_vgroup_remove");
1718 RNA_def_function_ui_description(func, "Delete vertex group from object.");
1719 parm= RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to remove.");
1720 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
1724 static void rna_def_object(BlenderRNA *brna)
1729 static EnumPropertyItem empty_drawtype_items[] = {
1730 {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""},
1731 {OB_ARROWS, "ARROWS", 0, "Arrows", ""},
1732 {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""},
1733 {OB_CIRCLE, "CIRCLE", 0, "Circle", ""},
1734 {OB_CUBE, "CUBE", 0, "Cube", ""},
1735 {OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""},
1736 {OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
1737 {OB_EMPTY_IMAGE, "IMAGE", 0, "Image", ""},
1738 {0, NULL, 0, NULL, NULL}};
1740 static EnumPropertyItem track_items[] = {
1741 {OB_POSX, "POS_X", 0, "+X", ""},
1742 {OB_POSY, "POS_Y", 0, "+Y", ""},
1743 {OB_POSZ, "POS_Z", 0, "+Z", ""},
1744 {OB_NEGX, "NEG_X", 0, "-X", ""},
1745 {OB_NEGY, "NEG_Y", 0, "-Y", ""},
1746 {OB_NEGZ, "NEG_Z", 0, "-Z", ""},
1747 {0, NULL, 0, NULL, NULL}};
1749 static EnumPropertyItem up_items[] = {
1750 {OB_POSX, "X", 0, "X", ""},
1751 {OB_POSY, "Y", 0, "Y", ""},
1752 {OB_POSZ, "Z", 0, "Z", ""},
1753 {0, NULL, 0, NULL, NULL}};
1755 static EnumPropertyItem drawtype_items[] = {
1756 {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Draw the bounding box of the object"},
1757 {OB_WIRE, "WIRE", 0, "Wire", "Draw the object as a wireframe"},
1758 {OB_SOLID, "SOLID", 0, "Solid", "Draw the object as a solid (If solid drawing is enabled in the viewport)"},
1759 {OB_TEXTURE, "TEXTURED", 0, "Textured", "Draw the object with textures (If textures are enabled in the viewport)"},
1760 {0, NULL, 0, NULL, NULL}};
1762 static EnumPropertyItem boundtype_items[] = {
1763 {OB_BOUND_BOX, "BOX", 0, "Box", "Draw bounds as box"},
1764 {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", "Draw bounds as sphere"},
1765 {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Draw bounds as cylinder"},
1766 {OB_BOUND_CONE, "CONE", 0, "Cone", "Draw bounds as cone"},
1767 {OB_BOUND_POLYH, "POLYHEDRON", 0, "Polyhedron", "Draw bounds as polyhedron"},
1768 {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", "Draw bounds as capsule"},
1769 {0, NULL, 0, NULL, NULL}};
1771 static EnumPropertyItem dupli_items[] = {
1772 {0, "NONE", 0, "None", ""},
1773 {OB_DUPLIFRAMES, "FRAMES", 0, "Frames", "Make copy of object for every frame"},
1774 {OB_DUPLIVERTS, "VERTS", 0, "Verts", "Duplicate child objects on all vertices"},
1775 {OB_DUPLIFACES, "FACES", 0, "Faces", "Duplicate child objects on all faces"},
1776 {OB_DUPLIGROUP, "GROUP", 0, "Group", "Enable group instancing"},
1777 {0, NULL, 0, NULL, NULL}};
1779 // XXX: this RNA enum define is currently duplicated for objects, since there is some text here which is not applicable
1780 static EnumPropertyItem prop_rotmode_items[] = {
1781 {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock"},
1782 {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order. Prone to Gimbal Lock. (Default)"},
1783 {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order. Prone to Gimbal Lock"},
1784 {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order. Prone to Gimbal Lock"},
1785 {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order. Prone to Gimbal Lock"},
1786 {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order. Prone to Gimbal Lock"},
1787 {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order. Prone to Gimbal Lock"},
1788 {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", "Axis Angle (W+XYZ). Defines a rotation around some axis defined by 3D-Vector"},
1789 {0, NULL, 0, NULL, NULL}};
1791 static float default_quat[4] = {1,0,0,0}; /* default quaternion values */
1792 static float default_axisAngle[4] = {0,0,1,0}; /* default axis-angle rotation values */
1793 static float default_scale[3] = {1,1,1}; /* default scale values */
1794 static int boundbox_dimsize[]= {8, 3};
1796 srna= RNA_def_struct(brna, "Object", "ID");
1797 RNA_def_struct_ui_text(srna, "Object", "Object datablock defining an object in a scene");
1798 RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
1799 RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
1801 prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
1802 RNA_def_property_struct_type(prop, "ID");
1803 RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_data_set", "rna_Object_data_typef", NULL);
1804 RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
1805 RNA_def_property_ui_text(prop, "Data", "Object data");
1806 RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
1808 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
1809 RNA_def_property_enum_sdna(prop, NULL, "type");
1810 RNA_def_property_enum_items(prop, object_type_items);
1811 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1812 RNA_def_property_ui_text(prop, "Type", "Type of Object");
1814 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1815 RNA_def_property_enum_sdna(prop, NULL, "mode");
1816 RNA_def_property_enum_items(prop, object_mode_items);
1817 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1818 RNA_def_property_ui_text(prop, "Mode", "Object interaction mode");
1820 prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1821 RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
1822 RNA_def_property_array(prop, 20);
1823 RNA_def_property_ui_text(prop, "Layers", "Layers the object is on");
1824 RNA_def_property_boolean_funcs(prop, NULL, "rna_Object_layer_set");
1825 RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
1826 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_layer_update");
1828 prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
1829 RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
1830 RNA_def_property_ui_text(prop, "Select", "Object selection state");
1831 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_select_update");
1833 /* for data access */
1834 prop= RNA_def_property(srna, "bound_box", PROP_FLOAT, PROP_NONE);
1835 RNA_def_property_multi_array(prop, 2, boundbox_dimsize);
1836 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1837 RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL);
1838 RNA_def_property_ui_text(prop, "Bound Box", "Objects bound box in object-space coordinates, all values are -1.0 when not available.");
1841 prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
1842 RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_parent_set", NULL, NULL);
1843 RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
1844 RNA_def_property_ui_text(prop, "Parent", "Parent Object");
1845 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
1847 prop= RNA_def_property(srna, "parent_type", PROP_ENUM, PROP_NONE);
1848 RNA_def_property_enum_bitflag_sdna(prop, NULL, "partype");
1849 RNA_def_property_enum_items(prop, parent_type_items);
1850 RNA_def_property_enum_funcs(prop, NULL, "rna_Object_parent_type_set", "rna_Object_parent_type_itemf");
1851 RNA_def_property_ui_text(prop, "Parent Type", "Type of parent relation");
1852 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
1854 prop= RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED);
1855 RNA_def_property_int_sdna(prop, NULL, "par1");
1856 RNA_def_property_array(prop, 3);
1857 RNA_def_property_ui_text(prop, "Parent Vertices", "Indices of vertices in cases of a vertex parenting relation");
1858 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
1860 prop= RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
1861 RNA_def_property_string_sdna(prop, NULL, "parsubstr");
1862 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Object_parent_bone_set");
1863 RNA_def_property_ui_text(prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation");
1864 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
1866 /* Track and Up flags */
1867 // XXX: these have been saved here for a bit longer (after old track was removed), since some other tools still refer to this
1868 prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
1869 RNA_def_property_enum_sdna(prop, NULL, "trackflag");
1870 RNA_def_property_enum_items(prop, track_items);
1871 RNA_def_property_ui_text(prop, "Track Axis", "Axis that points in 'forward' direction (applies to DupliFrame when parent 'Follow' is enabled)");
1872 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
1874 prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
1875 RNA_def_property_enum_sdna(prop, NULL, "upflag");
1876 RNA_def_property_enum_items(prop, up_items);
1877 RNA_def_property_ui_text(prop, "Up Axis", "Axis that points in the upward direction (applies to DupliFrame when parent 'Follow' is enabled)");
1878 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
1881 prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
1882 RNA_def_property_ui_text(prop, "Proxy", "Library object this proxy object controls");
1884 prop= RNA_def_property(srna, "proxy_group", PROP_POINTER, PROP_NONE);
1885 RNA_def_property_ui_text(prop, "Proxy Group", "Library group duplicator object this proxy object controls");
1888 prop= RNA_def_property(srna, "material_slots", PROP_COLLECTION, PROP_NONE);
1889 RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
1890 RNA_def_property_struct_type(prop, "MaterialSlot");
1891 RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL); /* don't dereference pointer! */
1892 RNA_def_property_ui_text(prop, "Material Slots", "Material slots in the object");
1894 prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
1895 RNA_def_property_struct_type(prop, "Material");
1896 RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", "rna_Object_active_material_set", NULL, NULL);
1897 RNA_def_property_flag(prop, PROP_EDITABLE);
1898 RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed");
1899 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
1901 prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
1902 RNA_def_property_int_sdna(prop, NULL, "actcol");
1903 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1904 RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set", "rna_Object_active_material_index_range");
1905 RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot");
1906 RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
1909 prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
1910 RNA_def_property_float_sdna(prop, NULL, "loc");
1911 RNA_def_property_editable_array_func(prop, "rna_Object_location_editable");
1912 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
1913 RNA_def_property_ui_text(prop, "Location", "Location of the object");
1914 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1916 prop= RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
1917 RNA_def_property_float_sdna(prop, NULL, "quat");
1918 RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
1919 RNA_def_property_float_array_default(prop, default_quat);
1920 RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
1921 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1923 /* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
1924 * having a single one is better for Keyframing and other property-management situations...
1926 prop= RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
1927 RNA_def_property_array(prop, 4);
1928 RNA_def_property_float_funcs(prop, "rna_Object_rotation_axis_angle_get", "rna_Object_rotation_axis_angle_set", NULL);
1929 RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
1930 RNA_def_property_float_array_default(prop, default_axisAngle);
1931 RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
1932 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1934 prop= RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
1935 RNA_def_property_float_sdna(prop, NULL, "rot");
1936 RNA_def_property_editable_array_func(prop, "rna_Object_rotation_euler_editable");
1937 RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
1938 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1940 prop= RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
1941 RNA_def_property_enum_sdna(prop, NULL, "rotmode");
1942 RNA_def_property_enum_items(prop, prop_rotmode_items); // XXX move to using a single define of this someday
1943 RNA_def_property_enum_funcs(prop, NULL, "rna_Object_rotation_mode_set", NULL);
1944 RNA_def_property_ui_text(prop, "Rotation Mode", "");
1945 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1947 prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
1948 RNA_def_property_float_sdna(prop, NULL, "size");
1949 RNA_def_property_editable_array_func(prop, "rna_Object_scale_editable");
1950 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
1951 RNA_def_property_float_array_default(prop, default_scale);
1952 RNA_def_property_ui_text(prop, "Scale", "Scaling of the object");
1953 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1955 prop= RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
1956 RNA_def_property_array(prop, 3);
1957 RNA_def_property_float_funcs(prop, "rna_Object_dimensions_get", "rna_Object_dimensions_set", NULL);
1958 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
1959 RNA_def_property_ui_text(prop, "Dimensions", "Absolute bounding box dimensions of the object");
1960 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1963 /* delta transforms */
1964 prop= RNA_def_property(srna, "delta_location", PROP_FLOAT, PROP_TRANSLATION);
1965 RNA_def_property_float_sdna(prop, NULL, "dloc");
1966 RNA_def_property_ui_text(prop, "Delta Location", "Extra translation added to the location of the object");
1967 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1969 prop= RNA_def_property(srna, "delta_rotation_euler", PROP_FLOAT, PROP_EULER);
1970 RNA_def_property_float_sdna(prop, NULL, "drot");
1971 RNA_def_property_ui_text(prop, "Delta Rotation (Euler)", "Extra rotation added to the rotation of the object (when using Euler rotations)");
1972 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1974 prop= RNA_def_property(srna, "delta_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
1975 RNA_def_property_float_sdna(prop, NULL, "dquat");
1976 RNA_def_property_float_array_default(prop, default_quat);
1977 RNA_def_property_ui_text(prop, "Delta Rotation (Quaternion)", "Extra rotation added to the rotation of the object (when using Quaternion rotations)");
1978 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1980 #if 0 // XXX not supported well yet...
1981 prop= RNA_def_property(srna, "delta_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
1982 RNA_def_property_float_sdna(prop, NULL, "dquat"); // FIXME: this is not a single field any more! (drotAxis and drotAngle)
1983 RNA_def_property_float_array_default(prop, default_axisAngle);
1984 RNA_def_property_ui_text(prop, "Delta Rotation (Axis Angle)", "Extra rotation added to the rotation of the object (when using Axis-Angle rotations)");
1985 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1988 prop= RNA_def_property(srna, "delta_scale", PROP_FLOAT, PROP_XYZ);
1989 RNA_def_property_float_sdna(prop, NULL, "dsize");
1990 RNA_def_property_ui_text(prop, "Delta Scale", "Extra scaling added to the scale of the object");
1991 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1993 /* transform locks */
1994 prop= RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_XYZ);
1995 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX);
1996 RNA_def_property_array(prop, 3);
1997 RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location in the interface");
1998 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
1999 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2001 prop= RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_XYZ);
2002 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX);
2003 RNA_def_property_array(prop, 3);
2004 RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation in the interface");
2005 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
2006 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2008 // XXX this is sub-optimal - it really should be included above, but due to technical reasons we can't do this!
2009 prop= RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
2010 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW);
2011 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
2012 RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)", "Lock editing of 'angle' component of four-component rotations in the interface");
2013 // XXX this needs a better name
2014 prop= RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
2015 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D);
2016 RNA_def_property_ui_text(prop, "Lock Rotations (4D)", "Lock editing of four component rotations by components (instead of as Eulers)");
2018 prop= RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_XYZ);
2019 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX);
2020 RNA_def_property_array(prop, 3);
2021 RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface");
2022 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
2023 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2026 prop= RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
2027 RNA_def_property_float_sdna(prop, NULL, "obmat");
2028 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2029 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2030 RNA_def_property_ui_text(prop, "Matrix World", "Worldspace transformation matrix");
2031 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_matrix_world_update");
2033 prop= RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
2034 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2035 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2036 RNA_def_property_ui_text(prop, "Local Matrix", "Parent relative transformation matrix");
2037 RNA_def_property_float_funcs(prop, "rna_Object_matrix_local_get", "rna_Object_matrix_local_set", NULL);
2038 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, NULL);
2040 prop= RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
2041 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2042 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2043 RNA_def_property_ui_text(prop, "Input Matrix", "Matrix access to location, rotation and scale (including deltas), before constraints and parenting are applied.");
2044 RNA_def_property_float_funcs(prop, "rna_Object_matrix_basis_get", "rna_Object_matrix_basis_set", NULL);
2045 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2048 prop= RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX);
2049 RNA_def_property_float_sdna(prop, NULL, "parentinv");
2050 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2051 RNA_def_property_ui_text(prop, "Matrix", "Inverse of object's parent matrix at time of parenting");
2052 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2055 prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
2056 RNA_def_property_struct_type(prop, "Modifier");
2057 RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the geometric data of the object");
2058 rna_def_object_modifiers(brna, prop);
2061 prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
2062 RNA_def_property_struct_type(prop, "Constraint");
2063 RNA_def_property_ui_text(prop, "Constraints", "Constraints affecting the transformation of the object");
2064 // RNA_def_property_collection_funcs(prop, 0, 0, 0, 0, 0, 0, 0, "constraints__add", "constraints__remove");
2065 rna_def_object_constraints(brna, prop);
2068 prop= RNA_def_property(srna, "game", PROP_POINTER, PROP_NONE);
2069 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2070 RNA_def_property_struct_type(prop, "GameObjectSettings");
2071 RNA_def_property_pointer_funcs(prop, "rna_Object_game_settings_get", NULL, NULL, NULL);
2072 RNA_def_property_ui_text(prop, "Game Settings", "Game engine related settings for the object");
2075 prop= RNA_def_property(srna, "vertex_groups", PROP_COLLECTION, PROP_NONE);
2076 RNA_def_property_collection_sdna(prop, NULL, "defbase", NULL);
2077 RNA_def_property_struct_type(prop, "VertexGroup");
2078 RNA_def_property_ui_text(prop, "Vertex Groups", "Vertex groups of the object");
2079 rna_def_object_vertex_groups(brna, prop);
2082 prop= RNA_def_property(srna, "empty_draw_type", PROP_ENUM, PROP_NONE);
2083 RNA_def_property_enum_sdna(prop, NULL, "empty_drawtype");
2084 RNA_def_property_enum_items(prop, empty_drawtype_items);
2085 RNA_def_property_ui_text(prop, "Empty Display Type", "Viewport display style for empties");
2086 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2088 prop= RNA_def_property(srna, "empty_draw_size", PROP_FLOAT, PROP_DISTANCE);
2089 RNA_def_property_float_sdna(prop, NULL, "empty_drawsize");
2090 RNA_def_property_range(prop, 0.0001f, 1000.0f);
2091 RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
2092 RNA_def_property_ui_text(prop, "Empty Display Size", "Size of display for empties in the viewport");
2093 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2095 prop= RNA_def_property(srna, "empty_image_offset", PROP_FLOAT, PROP_DISTANCE);
2096 RNA_def_property_float_sdna(prop, NULL, "ima_ofs");
2097 RNA_def_property_ui_text(prop, "Origin Offset", "Origin offset distance");
2098 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 0.1f, 2);
2099 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2102 prop= RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
2103 RNA_def_property_int_sdna(prop, NULL, "index");
2104 RNA_def_property_ui_text(prop, "Pass Index", "Index # for the IndexOB render pass");
2105 RNA_def_property_update(prop, NC_OBJECT, NULL);
2107 prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
2108 RNA_def_property_float_sdna(prop, NULL, "col");
2109 RNA_def_property_ui_text(prop, "Color", "Object color and alpha, used when faces have the ObColor mode enabled");
2110 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2113 prop= RNA_def_property(srna, "field", PROP_POINTER, PROP_NONE);
2114 RNA_def_property_pointer_sdna(prop, NULL, "pd");
2115 RNA_def_property_struct_type(prop, "FieldSettings");
2116 RNA_def_property_pointer_funcs(prop, "rna_Object_field_get", NULL, NULL, NULL);
2117 RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the objects as a field in physics simulation");
2119 prop= RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE);
2120 RNA_def_property_pointer_sdna(prop, NULL, "pd");
2121 RNA_def_property_struct_type(prop, "CollisionSettings");
2122 RNA_def_property_pointer_funcs(prop, "rna_Object_collision_get", NULL, NULL, NULL);
2123 RNA_def_property_ui_text(prop, "Collision Settings", "Settings for using the objects as a collider in physics simulation");
2125 prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
2126 RNA_def_property_pointer_sdna(prop, NULL, "soft");
2127 RNA_def_property_struct_type(prop, "SoftBodySettings");
2128 RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for soft body simulation");
2130 prop= RNA_def_property(srna, "particle_systems", PROP_COLLECTION, PROP_NONE);
2131 RNA_def_property_collection_sdna(prop, NULL, "particlesystem", NULL);
2132 RNA_def_property_struct_type(prop, "ParticleSystem");
2133 RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
2134 rna_def_object_particle_systems(brna, prop);
2137 prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
2138 RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEW);
2139 RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport");
2140 RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
2141 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2143 prop= RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
2144 RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT);
2145 RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport");
2146 RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1);
2147 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2149 prop= RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
2150 RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER);
2151 RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability");
2152 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2153 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2156 rna_def_animdata_common(srna);
2158 rna_def_animviz_common(srna);
2159 rna_def_motionpath_common(srna);
2162 // XXX: evil old crap
2163 prop= RNA_def_property(srna, "use_slow_parent", PROP_BOOLEAN, PROP_NONE);
2164 RNA_def_property_boolean_sdna(prop, NULL, "partype", PARSLOW);
2165 RNA_def_property_ui_text(prop, "Slow Parent", "Create a delay in the parent relationship");
2166 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
2168 prop= RNA_def_property(srna, "dupli_type", PROP_ENUM, PROP_NONE);
2169 RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag");
2170 RNA_def_property_enum_items(prop, dupli_items);
2171 RNA_def_property_ui_text(prop, "Dupli Type", "If not None, object duplication method to use");
2172 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
2174 prop= RNA_def_property(srna, "use_dupli_frames_speed", PROP_BOOLEAN, PROP_NONE);
2175 RNA_def_property_boolean_negative_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED);
2176 RNA_def_property_ui_text(prop, "Dupli Frames Speed", "Set dupliframes to use the frame"); // TODO, better descriptio!
2177 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
2179 prop= RNA_def_property(srna, "use_dupli_vertices_rotation", PROP_BOOLEAN, PROP_NONE);
2180 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT);
2181 RNA_def_property_ui_text(prop, "Dupli Verts Rotation", "Rotate dupli according to vertex normal");
2182 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2184 prop= RNA_def_property(srna, "use_dupli_faces_scale", PROP_BOOLEAN, PROP_NONE);
2185 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIFACES_SCALE);
2186 RNA_def_property_ui_text(prop, "Dupli Faces Inherit Scale", "Scale dupli based on face size");
2187 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
2189 prop= RNA_def_property(srna, "dupli_faces_scale", PROP_FLOAT, PROP_NONE);
2190 RNA_def_property_float_sdna(prop, NULL, "dupfacesca");
2191 RNA_def_property_range(prop, 0.001f, 10000.0f);
2192 RNA_def_property_ui_text(prop, "Dupli Faces Scale", "Scale the DupliFace objects");
2193 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2195 prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
2196 RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
2197 RNA_def_property_flag(prop, PROP_EDITABLE);
2198 RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_dup_group_set", NULL, NULL);
2199 RNA_def_property_ui_text(prop, "Dupli Group", "Instance an existing group");
2200 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
2202 prop= RNA_def_property(srna, "dupli_frames_start", PROP_INT, PROP_NONE|PROP_UNIT_TIME);
2203 RNA_def_property_int_sdna(prop, NULL, "dupsta");
2204 RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
2205 RNA_def_property_ui_text(prop, "Dupli Frames Start", "Start frame for DupliFrames");
2206 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
2208 prop= RNA_def_property(srna, "dupli_frames_end", PROP_INT, PROP_NONE|PROP_UNIT_TIME);
2209 RNA_def_property_int_sdna(prop, NULL, "dupend");
2210 RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
2211 RNA_def_property_ui_text(prop, "Dupli Frames End", "End frame for DupliFrames");
2212 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
2214 prop= RNA_def_property(srna, "dupli_frames_on", PROP_INT, PROP_NONE|PROP_UNIT_TIME);
2215 RNA_def_property_int_sdna(prop, NULL, "dupon");
2216 RNA_def_property_range(prop, MINFRAME, MAXFRAME);
2217 RNA_def_property_ui_range(prop, 1, 1500, 1, 0);
2218 RNA_def_property_ui_text(prop, "Dupli Frames On", "Number of frames to use between DupOff frames");
2219 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
2221 prop= RNA_def_property(srna, "dupli_frames_off", PROP_INT, PROP_NONE|PROP_UNIT_TIME);
2222 RNA_def_property_int_sdna(prop, NULL, "dupoff");
2223 RNA_def_property_range(prop, 0, MAXFRAME);
2224 RNA_def_property_ui_range(prop, 0, 1500, 1, 0);
2225 RNA_def_property_ui_text(prop, "Dupli Frames Off", "Recurring frames to exclude from the Dupliframes");
2226 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
2228 prop= RNA_def_property(srna, "dupli_list", PROP_COLLECTION, PROP_NONE);
2229 RNA_def_property_collection_sdna(prop, NULL, "duplilist", NULL);
2230 RNA_def_property_struct_type(prop, "DupliObject");
2231 RNA_def_property_ui_text(prop, "Dupli list", "Object duplis");
2233 prop= RNA_def_property(srna, "is_duplicator", PROP_BOOLEAN, PROP_NONE);
2234 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLI);
2235 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2238 prop= RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE|PROP_UNIT_TIME);
2239 RNA_def_property_float_sdna(prop, NULL, "sf");
2240 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
2241 RNA_def_property_ui_text(prop, "Time Offset", "Animation offset in frames for F-Curve and dupligroup instances");
2242 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2244 prop= RNA_def_property(srna, "use_time_offset_edit", PROP_BOOLEAN, PROP_NONE);
2245 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_OB);
2246 RNA_def_property_ui_text(prop, "Time Offset Edit", "Use time offset when inserting keys and display time offset for F-Curve and action views");
2248 prop= RNA_def_property(srna, "use_time_offset_parent", PROP_BOOLEAN, PROP_NONE);
2249 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARENT);
2250 RNA_def_property_ui_text(prop, "Time Offset Parent", "Apply the time offset to this objects parent relationship");
2251 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2253 prop= RNA_def_property(srna, "use_time_offset_particle", PROP_BOOLEAN, PROP_NONE);
2254 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARTICLE);
2255 RNA_def_property_ui_text(prop, "Time Offset Particle", "Let the time offset work on the particle effect");
2256 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2258 prop= RNA_def_property(srna, "use_time_offset_add_parent", PROP_BOOLEAN, PROP_NONE);
2259 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARENTADD);
2260 RNA_def_property_ui_text(prop, "Time Offset Add Parent", "Add the parents time offset value");
2261 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2264 prop= RNA_def_property(srna, "draw_type", PROP_ENUM, PROP_NONE);
2265 RNA_def_property_enum_sdna(prop, NULL, "dt");
2266 RNA_def_property_enum_items(prop, drawtype_items);
2267 RNA_def_property_ui_text(prop, "Maximum Draw Type", "Maximum draw type to display object with in viewport");
2268 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2270 prop= RNA_def_property(srna, "show_bounds", PROP_BOOLEAN, PROP_NONE);
2271 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_BOUNDBOX);
2272 RNA_def_property_ui_text(prop, "Draw Bounds", "Displays the object's bounds");
2273 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2275 prop= RNA_def_property(srna, "draw_bounds_type", PROP_ENUM, PROP_NONE);
2276 RNA_def_property_enum_sdna(prop, NULL, "boundtype");
2277 RNA_def_property_enum_items(prop, boundtype_items);
2278 RNA_def_property_ui_text(prop, "Draw Bounds Type", "Object boundary display type");
2279 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2281 prop= RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
2282 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWNAME);
2283 RNA_def_property_ui_text(prop, "Draw Name", "Displays the object's name");
2284 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2286 prop= RNA_def_property(srna, "show_axis", PROP_BOOLEAN, PROP_NONE);
2287 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_AXIS);
2288 RNA_def_property_ui_text(prop, "Draw Axis", "Displays the object's origin and axis");
2289 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2291 prop= RNA_def_property(srna, "show_texture_space", PROP_BOOLEAN, PROP_NONE);
2292 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_TEXSPACE);
2293 RNA_def_property_ui_text(prop, "Draw Texture Space", "Displays the object's texture space");
2294 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2296 prop= RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
2297 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWWIRE);
2298 RNA_def_property_ui_text(prop, "Draw Wire", "Adds the object's wireframe over solid drawing");
2299 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2301 prop= RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE);
2302 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP);
2303 RNA_def_property_ui_text(prop, "Draw Transparent", "Displays material transparency in the object (unsupported for duplicator drawing)");
2304 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2306 prop= RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE);
2307 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY);
2308 RNA_def_property_ui_text(prop, "X-Ray", "Makes the object draw in front of others (unsupported for duplicator drawing)");
2309 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2312 prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
2313 RNA_def_property_pointer_sdna(prop, NULL, "gpd");
2314 RNA_def_property_flag(prop, PROP_EDITABLE);
2315 RNA_def_property_struct_type(prop, "GreasePencil");
2316 RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil datablock");
2317 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2320 prop= RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE);
2321 RNA_def_property_pointer_sdna(prop, NULL, "poselib");
2322 RNA_def_property_flag(prop, PROP_EDITABLE);
2323 RNA_def_property_struct_type(prop, "Action");
2324 RNA_def_property_ui_text(prop, "Pose Library", "Action used as a pose library for armatures");
2326 prop= RNA_def_property(srna, "pose", PROP_POINTER, PROP_NONE);
2327 RNA_def_property_pointer_sdna(prop, NULL, "pose");
2328 RNA_def_property_struct_type(prop, "Pose");
2329 RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures");
2332 prop= RNA_def_property(srna, "show_only_shape_key", PROP_BOOLEAN, PROP_NONE);
2333 RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_LOCK);
2334 RNA_def_property_ui_text(prop, "Shape Key Lock", "Always show the current Shape for this Object");
2335 RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
2336 RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
2338 prop= RNA_def_property(srna, "use_shape_key_edit_mode", PROP_BOOLEAN, PROP_NONE);
2339 RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_EDIT_MODE);
2340 RNA_def_property_ui_text(prop, "Shape Key Edit Mode", "Apply shape keys in edit mode (for Meshes only)");
2341 RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
2342 RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
2344 prop= RNA_def_property(srna, "active_shape_key", PROP_POINTER, PROP_NONE);
2345 RNA_def_property_struct_type(prop, "ShapeKey");
2346 RNA_def_property_pointer_funcs(prop, "rna_Object_active_shape_key_get", NULL, NULL, NULL);
2347 RNA_def_property_ui_text(prop, "Active Shape Key", "Current shape key");
2349 prop= RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE);
2350 RNA_def_property_int_sdna(prop, NULL, "shapenr");
2351 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); // XXX this is really unpredictable...
2352 RNA_def_property_int_funcs(prop, "rna_Object_active_shape_key_index_get", "rna_Object_active_shape_key_index_set", "rna_Object_active_shape_key_index_range");
2353 RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index");
2354 RNA_def_property_update(prop, 0, "rna_Object_active_shape_update");
2356 RNA_api_object(srna);
2359 static void rna_def_dupli_object(BlenderRNA *brna)
2364 srna= RNA_def_struct(brna, "DupliObject", NULL);
2365 RNA_def_struct_sdna(srna, "DupliObject");
2366 RNA_def_struct_ui_text(srna, "Object Duplicate", "An object duplicate");
2367 /* RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA); */
2369 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2370 RNA_def_property_pointer_sdna(prop, NULL, "ob");
2371 /* RNA_def_property_pointer_funcs(prop, "rna_DupliObject_object_get", NULL, NULL, NULL); */
2372 RNA_def_property_ui_text(prop, "Object", "Object being duplicated");
2374 prop= RNA_def_property(srna, "matrix_original", PROP_FLOAT, PROP_MATRIX);
2375 RNA_def_property_float_sdna(prop, NULL, "omat");
2376 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2377 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2378 RNA_def_property_ui_text(prop, "Object Matrix", "The original matrix of this object before it was duplicated");
2380 prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
2381 RNA_def_property_float_sdna(prop, NULL, "mat");
2382 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2383 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2384 RNA_def_property_ui_text(prop, "Object Duplicate Matrix", "Object duplicate transformation matrix");
2386 /* TODO: DupliObject has more properties that can be wrapped */
2389 static void rna_def_object_base(BlenderRNA *brna)
2394 srna= RNA_def_struct(brna, "ObjectBase", NULL);
2395 RNA_def_struct_sdna(srna, "Base");
2396 RNA_def_struct_ui_text(srna, "Object Base", "An object instance in a scene");
2397 RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
2399 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2400 RNA_def_property_pointer_sdna(prop, NULL, "object");
2401 RNA_def_property_ui_text(prop, "Object", "Object this base links to");
2403 /* same as object layer */
2404 prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
2405 RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
2406 RNA_def_property_array(prop, 20);
2407 RNA_def_property_ui_text(prop, "Layers", "Layers the object base is on");
2408 RNA_def_property_boolean_funcs(prop, NULL, "rna_Base_layer_set");
2409 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Base_layer_update");
2411 prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
2412 RNA_def_property_boolean_sdna(prop, NULL, "flag", BA_SELECT);
2413 RNA_def_property_ui_text(prop, "Select", "Object base selection state");
2414 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Base_select_update");
2416 RNA_api_object_base(srna);
2419 void RNA_def_object(BlenderRNA *brna)
2421 rna_def_object(brna);
2422 rna_def_object_game_settings(brna);
2423 rna_def_object_base(brna);
2424 rna_def_vertex_group(brna);
2425 rna_def_material_slot(brna);
2426 rna_def_dupli_object(brna);