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);
288 DAG_id_type_tag(bmain, ID_OB);
291 static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
293 Object *ob= (Object*)ptr->id.data;
296 base= scene ? object_in_scene(ob, scene) : NULL;
300 SWAP(int, base->lay, ob->lay);
302 rna_Object_layer_update__internal(bmain, scene, base, ob);
305 WM_main_add_notifier(NC_SCENE|ND_LAYER_CONTENT, scene);
308 static void rna_Base_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
310 Base *base= (Base*)ptr->data;
311 Object *ob= (Object*)base->object;
313 rna_Object_layer_update__internal(bmain, scene, base, ob);
316 WM_main_add_notifier(NC_SCENE|ND_LAYER_CONTENT, scene);
319 static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
321 Object *ob= (Object*)ptr->data;
324 if (id == NULL || ob->mode & OB_MODE_EDIT)
327 if (ob->type == OB_EMPTY) {
329 id_us_min((ID*)ob->data);
333 if (id && GS(id->name) == ID_IM) {
338 else if(ob->type == OB_MESH) {
339 set_mesh(ob, (Mesh*)id);
343 id_us_min((ID*)ob->data);
348 test_object_materials(id);
350 if(GS(id->name)==ID_CU)
352 else if(ob->type==OB_ARMATURE)
353 armature_rebuild_pose(ob, ob->data);
357 static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
359 Object *ob= (Object*)ptr->data;
362 case OB_EMPTY: return &RNA_Image;
363 case OB_MESH: return &RNA_Mesh;
364 case OB_CURVE: return &RNA_Curve;
365 case OB_SURF: return &RNA_Curve;
366 case OB_FONT: return &RNA_Curve;
367 case OB_MBALL: return &RNA_MetaBall;
368 case OB_LAMP: return &RNA_Lamp;
369 case OB_CAMERA: return &RNA_Camera;
370 case OB_LATTICE: return &RNA_Lattice;
371 case OB_ARMATURE: return &RNA_Armature;
372 case OB_SPEAKER: return &RNA_Speaker;
373 default: return &RNA_ID;
377 static void rna_Object_parent_set(PointerRNA *ptr, PointerRNA value)
379 Object *ob= (Object*)ptr->data;
380 Object *par= (Object*)value.data;
382 ED_object_parent(ob, par, ob->partype, ob->parsubstr);
385 static void rna_Object_parent_type_set(PointerRNA *ptr, int value)
387 Object *ob= (Object*)ptr->data;
389 ED_object_parent(ob, ob->parent, value, ob->parsubstr);
392 static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
394 Object *ob= (Object*)ptr->data;
395 EnumPropertyItem *item= NULL;
398 RNA_enum_items_add_value(&item, &totitem, parent_type_items, PAROBJECT);
401 Object *par= ob->parent;
403 if(par->type == OB_CURVE)
404 RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARCURVE);
405 else if(par->type == OB_LATTICE)
406 RNA_enum_items_add_value(&item, &totitem, &parent_type_items[4], PARSKEL); // special hack: prevents this overriding others
407 else if(par->type == OB_ARMATURE) {
408 RNA_enum_items_add_value(&item, &totitem, &parent_type_items[3], PARSKEL); // special hack: prevents this being overrided
409 RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARBONE);
411 else if(par->type == OB_MESH) {
412 RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT1);
413 RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT3);
417 RNA_enum_item_end(&item, &totitem);
423 static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
425 Object *ob= (Object*)ptr->data;
426 EnumPropertyItem *item= NULL;
429 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_POLYH);
430 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_POLYT);
432 if(ob->body_type!=OB_BODY_TYPE_SOFT) {
433 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CONE);
434 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CYLINDER);
435 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_SPHERE);
436 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_BOX);
437 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CAPSULE);
440 RNA_enum_item_end(&item, &totitem);
446 static void rna_Object_parent_bone_set(PointerRNA *ptr, const char *value)
448 Object *ob= (Object*)ptr->data;
450 ED_object_parent(ob, ob->parent, ob->partype, value);
453 static void rna_Object_dup_group_set(PointerRNA *ptr, PointerRNA value)
455 Object *ob= (Object *)ptr->data;
456 Group *grp = (Group *)value.data;
458 /* must not let this be set if the object belongs in this group already,
459 * thus causing a cycle/infinite-recursion leading to crashes on load [#25298]
461 if (object_in_group(ob, grp) == 0)
464 BKE_report(NULL, RPT_ERROR, "Cannot set dupli-group as object belongs in group being instanced thus causing a cycle");
467 void rna_VertexGroup_name_set(PointerRNA *ptr, const char *value)
469 Object *ob= (Object *)ptr->id.data;
470 bDeformGroup *dg= (bDeformGroup *)ptr->data;
471 BLI_strncpy_utf8(dg->name, value, sizeof(dg->name));
472 defgroup_unique_name(dg, ob);
475 static int rna_VertexGroup_index_get(PointerRNA *ptr)
477 Object *ob= (Object*)ptr->id.data;
479 return BLI_findindex(&ob->defbase, ptr->data);
482 static PointerRNA rna_Object_active_vertex_group_get(PointerRNA *ptr)
484 Object *ob= (Object*)ptr->id.data;
485 return rna_pointer_inherit_refine(ptr, &RNA_VertexGroup, BLI_findlink(&ob->defbase, ob->actdef-1));
488 static int rna_Object_active_vertex_group_index_get(PointerRNA *ptr)
490 Object *ob= (Object*)ptr->id.data;
494 static void rna_Object_active_vertex_group_index_set(PointerRNA *ptr, int value)
496 Object *ob= (Object*)ptr->id.data;
500 static void rna_Object_active_vertex_group_index_range(PointerRNA *ptr, int *min, int *max)
502 Object *ob= (Object*)ptr->id.data;
505 *max= BLI_countlist(&ob->defbase)-1;
509 void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
511 Object *ob= (Object*)ptr->id.data;
514 dg= BLI_findlink(&ob->defbase, index-1);
516 if(dg) BLI_strncpy(value, dg->name, sizeof(dg->name));
520 int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index)
522 Object *ob= (Object*)ptr->id.data;
525 dg= BLI_findlink(&ob->defbase, index-1);
526 return (dg)? strlen(dg->name): 0;
529 void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
531 Object *ob= (Object*)ptr->id.data;
532 *index= defgroup_name_index(ob, value) + 1;
535 void rna_object_vgroup_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
537 Object *ob= (Object*)ptr->id.data;
538 bDeformGroup *dg= defgroup_find_name(ob, value);
540 BLI_strncpy(result, value, maxlen); /* no need for BLI_strncpy_utf8, since this matches an existing group */
547 void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
549 Object *ob= (Object*)ptr->id.data;
551 CustomDataLayer *layer;
554 if(ob->type == OB_MESH && ob->data) {
557 for(a=0; a<me->fdata.totlayer; a++) {
558 layer= &me->fdata.layers[a];
560 if(layer->type == CD_MTFACE && strcmp(layer->name, value) == 0) {
561 BLI_strncpy(result, value, maxlen);
570 void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
572 Object *ob= (Object*)ptr->id.data;
574 CustomDataLayer *layer;
577 if(ob->type == OB_MESH && ob->data) {
580 for(a=0; a<me->fdata.totlayer; a++) {
581 layer= &me->fdata.layers[a];
583 if(layer->type == CD_MCOL && strcmp(layer->name, value) == 0) {
584 BLI_strncpy(result, value, maxlen);
593 static int rna_Object_active_material_index_get(PointerRNA *ptr)
595 Object *ob= (Object*)ptr->id.data;
596 return MAX2(ob->actcol-1, 0);
599 static void rna_Object_active_material_index_set(PointerRNA *ptr, int value)
601 Object *ob= (Object*)ptr->id.data;
604 if(ob->type==OB_MESH) {
608 me->edit_mesh->mat_nr= value;
612 static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, int *max)
614 Object *ob= (Object*)ptr->id.data;
616 *max= MAX2(ob->totcol-1, 0);
619 /* returns active base material */
620 static PointerRNA rna_Object_active_material_get(PointerRNA *ptr)
622 Object *ob= (Object*)ptr->id.data;
625 ma= (ob->totcol)? give_current_material(ob, ob->actcol): NULL;
626 return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
629 static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value)
631 Object *ob= (Object*)ptr->id.data;
633 DAG_id_tag_update(value.data, 0);
634 assign_material(ob, value.data, ob->actcol);
637 static void rna_Object_active_particle_system_index_range(PointerRNA *ptr, int *min, int *max)
639 Object *ob= (Object*)ptr->id.data;
641 *max= BLI_countlist(&ob->particlesystem)-1;
645 static int rna_Object_active_particle_system_index_get(PointerRNA *ptr)
647 Object *ob= (Object*)ptr->id.data;
648 return psys_get_current_num(ob);
651 static void rna_Object_active_particle_system_index_set(PointerRNA *ptr, int value)
653 Object *ob= (Object*)ptr->id.data;
654 psys_set_current_num(ob, value);
657 static void rna_Object_particle_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
659 Object *ob= (Object*)ptr->id.data;
661 PE_current_changed(scene, ob);
664 /* rotation - axis-angle */
665 static void rna_Object_rotation_axis_angle_get(PointerRNA *ptr, float *value)
667 Object *ob= ptr->data;
669 /* for now, assume that rotation mode is axis-angle */
670 value[0]= ob->rotAngle;
671 copy_v3_v3(&value[1], ob->rotAxis);
674 /* rotation - axis-angle */
675 static void rna_Object_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
677 Object *ob= ptr->data;
679 /* for now, assume that rotation mode is axis-angle */
680 ob->rotAngle= value[0];
681 copy_v3_v3(ob->rotAxis, (float *)&value[1]);
683 // TODO: validate axis?
686 static void rna_Object_rotation_mode_set(PointerRNA *ptr, int value)
688 Object *ob= ptr->data;
690 /* use API Method for conversions... */
691 BKE_rotMode_change_values(ob->quat, ob->rot, ob->rotAxis, &ob->rotAngle, ob->rotmode, (short)value);
693 /* finally, set the new rotation type */
697 static void rna_Object_dimensions_get(PointerRNA *ptr, float *value)
699 Object *ob= ptr->data;
700 object_get_dimensions(ob, value);
703 static void rna_Object_dimensions_set(PointerRNA *ptr, const float *value)
705 Object *ob= ptr->data;
706 object_set_dimensions(ob, value);
709 static int rna_Object_location_editable(PointerRNA *ptr, int index)
711 Object *ob= (Object *)ptr->data;
713 /* only if the axis in question is locked, not editable... */
714 if ((index == 0) && (ob->protectflag & OB_LOCK_LOCX))
716 else if ((index == 1) && (ob->protectflag & OB_LOCK_LOCY))
718 else if ((index == 2) && (ob->protectflag & OB_LOCK_LOCZ))
721 return PROP_EDITABLE;
724 static int rna_Object_scale_editable(PointerRNA *ptr, int index)
726 Object *ob= (Object *)ptr->data;
728 /* only if the axis in question is locked, not editable... */
729 if ((index == 0) && (ob->protectflag & OB_LOCK_SCALEX))
731 else if ((index == 1) && (ob->protectflag & OB_LOCK_SCALEY))
733 else if ((index == 2) && (ob->protectflag & OB_LOCK_SCALEZ))
736 return PROP_EDITABLE;
739 static int rna_Object_rotation_euler_editable(PointerRNA *ptr, int index)
741 Object *ob= (Object *)ptr->data;
743 /* only if the axis in question is locked, not editable... */
744 if ((index == 0) && (ob->protectflag & OB_LOCK_ROTX))
746 else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTY))
748 else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTZ))
751 return PROP_EDITABLE;
754 static int rna_Object_rotation_4d_editable(PointerRNA *ptr, int index)
756 Object *ob= (Object *)ptr->data;
758 /* only consider locks if locking components individually... */
759 if (ob->protectflag & OB_LOCK_ROT4D) {
760 /* only if the axis in question is locked, not editable... */
761 if ((index == 0) && (ob->protectflag & OB_LOCK_ROTW))
763 else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTX))
765 else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTY))
767 else if ((index == 3) && (ob->protectflag & OB_LOCK_ROTZ))
771 return PROP_EDITABLE;
775 static PointerRNA rna_MaterialSlot_material_get(PointerRNA *ptr)
777 Object *ob= (Object*)ptr->id.data;
779 int index= (Material**)ptr->data - ob->mat;
781 ma= give_current_material(ob, index+1);
782 return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
785 static void rna_MaterialSlot_material_set(PointerRNA *ptr, PointerRNA value)
787 Object *ob= (Object*)ptr->id.data;
788 int index= (Material**)ptr->data - ob->mat;
790 assign_material(ob, value.data, index+1);
793 static int rna_MaterialSlot_link_get(PointerRNA *ptr)
795 Object *ob= (Object*)ptr->id.data;
796 int index= (Material**)ptr->data - ob->mat;
798 return ob->matbits[index] != 0;
801 static void rna_MaterialSlot_link_set(PointerRNA *ptr, int value)
803 Object *ob= (Object*)ptr->id.data;
804 int index= (Material**)ptr->data - ob->mat;
807 ob->matbits[index]= 1;
808 ob->colbits |= (1<<index);
811 ob->matbits[index]= 0;
812 ob->colbits &= ~(1<<index);
816 static int rna_MaterialSlot_name_length(PointerRNA *ptr)
818 Object *ob= (Object*)ptr->id.data;
820 int index= (Material**)ptr->data - ob->mat;
822 ma= give_current_material(ob, index+1);
825 return strlen(ma->id.name+2);
830 static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str)
832 Object *ob= (Object*)ptr->id.data;
834 int index= (Material**)ptr->data - ob->mat;
836 ma= give_current_material(ob, index+1);
839 strcpy(str, ma->id.name+2);
844 static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr)
846 rna_Object_internal_update(bmain, scene, ptr);
847 WM_main_add_notifier(NC_OBJECT|ND_OB_SHADING, ptr->id.data);
850 /* why does this have to be so complicated?, can't all this crap be
851 * moved to in BGE conversion function? - Campbell *
853 * logic from check_body_type()
855 static int rna_GameObjectSettings_physics_type_get(PointerRNA *ptr)
857 Object *ob= (Object*)ptr->id.data;
859 /* determine the body_type setting based on flags */
860 if (!(ob->gameflag & OB_COLLISION)) {
861 if (ob->gameflag & OB_OCCLUDER) {
862 ob->body_type = OB_BODY_TYPE_OCCLUDER;
863 } else if (ob->gameflag & OB_NAVMESH){
864 ob->body_type = OB_BODY_TYPE_NAVMESH;
866 ob->body_type = OB_BODY_TYPE_NO_COLLISION;
868 } else if (ob->gameflag & OB_SENSOR) {
869 ob->body_type = OB_BODY_TYPE_SENSOR;
870 } else if (!(ob->gameflag & OB_DYNAMIC)) {
871 ob->body_type = OB_BODY_TYPE_STATIC;
872 } else if (!(ob->gameflag & (OB_RIGID_BODY|OB_SOFT_BODY))) {
873 ob->body_type = OB_BODY_TYPE_DYNAMIC;
874 } else if (ob->gameflag & OB_RIGID_BODY) {
875 ob->body_type = OB_BODY_TYPE_RIGID;
877 ob->body_type = OB_BODY_TYPE_SOFT;
878 /* create the structure here because we display soft body buttons in the main panel */
880 ob->bsoft = bsbNew();
883 return ob->body_type;
886 static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
888 Object *ob= (Object*)ptr->id.data;
889 ob->body_type= value;
891 switch (ob->body_type) {
892 case OB_BODY_TYPE_SENSOR:
893 ob->gameflag |= OB_SENSOR|OB_COLLISION|OB_GHOST;
894 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);
896 case OB_BODY_TYPE_OCCLUDER:
897 ob->gameflag |= OB_OCCLUDER;
898 ob->gameflag &= ~(OB_SENSOR|OB_COLLISION|OB_DYNAMIC|OB_NAVMESH);
900 case OB_BODY_TYPE_NAVMESH:
901 ob->gameflag |= OB_NAVMESH;
902 ob->gameflag &= ~(OB_SENSOR|OB_COLLISION|OB_DYNAMIC|OB_OCCLUDER);
904 case OB_BODY_TYPE_NO_COLLISION:
905 ob->gameflag &= ~(OB_SENSOR|OB_COLLISION|OB_OCCLUDER|OB_DYNAMIC|OB_NAVMESH);
907 case OB_BODY_TYPE_STATIC:
908 ob->gameflag |= OB_COLLISION;
909 ob->gameflag &= ~(OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_OCCLUDER|OB_SENSOR|OB_NAVMESH);
911 case OB_BODY_TYPE_DYNAMIC:
912 ob->gameflag |= OB_COLLISION|OB_DYNAMIC|OB_ACTOR;
913 ob->gameflag &= ~(OB_RIGID_BODY|OB_SOFT_BODY|OB_OCCLUDER|OB_SENSOR|OB_NAVMESH);
915 case OB_BODY_TYPE_RIGID:
916 ob->gameflag |= OB_COLLISION|OB_DYNAMIC|OB_RIGID_BODY|OB_ACTOR;
917 ob->gameflag &= ~(OB_SOFT_BODY|OB_OCCLUDER|OB_SENSOR|OB_NAVMESH);
920 case OB_BODY_TYPE_SOFT:
921 ob->gameflag |= OB_COLLISION|OB_DYNAMIC|OB_SOFT_BODY|OB_ACTOR;
922 ob->gameflag &= ~(OB_RIGID_BODY|OB_OCCLUDER|OB_SENSOR|OB_NAVMESH);
924 /* assume triangle mesh, if no bounds chosen for soft body */
925 if ((ob->gameflag & OB_BOUNDS) && (ob->boundtype<OB_BOUND_POLYH))
927 ob->boundtype=OB_BOUND_POLYH;
929 /* create a BulletSoftBody structure if not already existing */
931 ob->bsoft = bsbNew();
936 static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr)
938 Object *ob= (Object*)ptr->id.data;
939 ParticleSystem *psys= psys_get_current(ob);
940 return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem, psys);
943 static PointerRNA rna_Object_game_settings_get(PointerRNA *ptr)
945 return rna_pointer_inherit_refine(ptr, &RNA_GameObjectSettings, ptr->id.data);
949 static unsigned int rna_Object_layer_validate__internal(const int *values, unsigned int lay)
953 /* ensure we always have some layer selected */
961 for(i=0; i<20; i++) {
962 if(values[i]) lay |= (1<<i);
969 static void rna_Object_layer_set(PointerRNA *ptr, const int *values)
971 Object *ob= (Object*)ptr->data;
974 lay= rna_Object_layer_validate__internal(values, ob->lay);
979 static void rna_Base_layer_set(PointerRNA *ptr, const int *values)
981 Base *base= (Base*)ptr->data;
984 lay= rna_Object_layer_validate__internal(values, base->lay);
988 /* rna_Base_layer_update updates the objects layer */
991 static void rna_GameObjectSettings_state_get(PointerRNA *ptr, int *values)
993 Object *ob= (Object*)ptr->data;
995 int all_states = (ob->scaflag & OB_ALLSTATE?1:0);
997 memset(values, 0, sizeof(int)*OB_MAX_STATES);
998 for(i=0; i<OB_MAX_STATES; i++)
999 values[i] = (ob->state & (1<<i)) | all_states;
1002 static void rna_GameObjectSettings_state_set(PointerRNA *ptr, const int *values)
1004 Object *ob= (Object*)ptr->data;
1007 /* ensure we always have some state selected */
1008 for(i=0; i<OB_MAX_STATES; i++)
1015 for(i=0; i<OB_MAX_STATES; i++) {
1016 if(values[i]) ob->state |= (1<<i);
1017 else ob->state &= ~(1<<i);
1021 static void rna_GameObjectSettings_used_state_get(PointerRNA *ptr, int *values)
1023 Object *ob= (Object*)ptr->data;
1026 memset(values, 0, sizeof(int)*OB_MAX_STATES);
1027 for (cont=ob->controllers.first; cont; cont=cont->next) {
1030 for (i=0; i<OB_MAX_STATES; i++) {
1031 if (cont->state_mask & (1<<i))
1037 static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, int *max)
1039 Object *ob= (Object*)ptr->id.data;
1040 Key *key= ob_get_key(ob);
1044 *max= BLI_countlist(&key->block)-1;
1045 if(*max < 0) *max= 0;
1052 static int rna_Object_active_shape_key_index_get(PointerRNA *ptr)
1054 Object *ob= (Object*)ptr->id.data;
1056 return MAX2(ob->shapenr-1, 0);
1059 static void rna_Object_active_shape_key_index_set(PointerRNA *ptr, int value)
1061 Object *ob= (Object*)ptr->id.data;
1063 ob->shapenr= value+1;
1066 static PointerRNA rna_Object_active_shape_key_get(PointerRNA *ptr)
1068 Object *ob= (Object*)ptr->id.data;
1069 Key *key= ob_get_key(ob);
1074 return PointerRNA_NULL;
1076 kb= BLI_findlink(&key->block, ob->shapenr-1);
1077 RNA_pointer_create((ID *)key, &RNA_ShapeKey, kb, &keyptr);
1081 static PointerRNA rna_Object_field_get(PointerRNA *ptr)
1083 Object *ob= (Object*)ptr->id.data;
1087 ob->pd= object_add_collision_fields(0);
1089 return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, ob->pd);
1092 static PointerRNA rna_Object_collision_get(PointerRNA *ptr)
1094 Object *ob= (Object*)ptr->id.data;
1096 if(ob->type != OB_MESH)
1097 return PointerRNA_NULL;
1101 ob->pd= object_add_collision_fields(0);
1103 return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd);
1106 static PointerRNA rna_Object_active_constraint_get(PointerRNA *ptr)
1108 Object *ob= (Object*)ptr->id.data;
1109 bConstraint *con= constraints_get_active(&ob->constraints);
1110 return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con);
1113 static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value)
1115 Object *ob= (Object*)ptr->id.data;
1116 constraints_set_active(&ob->constraints, (bConstraint *)value.data);
1119 static bConstraint *rna_Object_constraints_new(Object *object, int type)
1121 WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object);
1122 return add_ob_constraint(object, NULL, type);
1125 static void rna_Object_constraints_remove(Object *object, ReportList *reports, bConstraint *con)
1127 if(BLI_findindex(&object->constraints, con) == -1) {
1128 BKE_reportf(reports, RPT_ERROR, "Constraint '%s' not found in object '%s'.", con->name, object->id.name+2);
1132 remove_constraint(&object->constraints, con);
1133 ED_object_constraint_update(object);
1134 ED_object_constraint_set_active(object, NULL);
1135 WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_REMOVED, object);
1138 static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports, const char *name, int type)
1140 return ED_object_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
1143 static void rna_Object_modifier_remove(Object *object, bContext *C, ReportList *reports, ModifierData *md)
1145 ED_object_modifier_remove(reports, CTX_data_main(C), CTX_data_scene(C), object, md);
1148 static void rna_Object_boundbox_get(PointerRNA *ptr, float *values)
1150 Object *ob= (Object*)ptr->id.data;
1151 BoundBox *bb= object_get_boundbox(ob);
1153 memcpy(values, bb->vec, sizeof(bb->vec));
1156 fill_vn(values, sizeof(bb->vec)/sizeof(float), 0.0f);
1161 static bDeformGroup *rna_Object_vgroup_new(Object *ob, const char *name)
1163 bDeformGroup *defgroup = ED_vgroup_add_name(ob, name);
1165 WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
1170 static void rna_Object_vgroup_remove(Object *ob, bDeformGroup *defgroup)
1172 ED_vgroup_delete(ob, defgroup);
1174 WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
1177 static void rna_VertexGroup_vertex_add(ID *id, bDeformGroup *def, ReportList *reports, int index_len, int *index, float weight, int assignmode)
1179 Object *ob = (Object *)id;
1181 if(ED_vgroup_object_is_edit_mode(ob)) {
1182 BKE_reportf(reports, RPT_ERROR, "VertexGroup.add(): Can't be called while object is in edit mode.");
1187 ED_vgroup_vert_add(ob, def, *index++, weight, assignmode); /* XXX, not efficient calling within loop*/
1189 WM_main_add_notifier(NC_GEOM|ND_DATA, (ID *)ob->data);
1192 static void rna_VertexGroup_vertex_remove(ID *id, bDeformGroup *dg, ReportList *reports, int index_len, int *index)
1194 Object *ob = (Object *)id;
1196 if(ED_vgroup_object_is_edit_mode(ob)) {
1197 BKE_reportf(reports, RPT_ERROR, "VertexGroup.remove(): Can't be called while object is in edit mode.");
1202 ED_vgroup_vert_remove(ob, dg, *index++);
1204 WM_main_add_notifier(NC_GEOM|ND_DATA, (ID *)ob->data);
1207 static float rna_VertexGroup_weight(ID *id, bDeformGroup *dg, ReportList *reports, int index)
1209 float weight = ED_vgroup_vert_weight((Object *)id, dg, index);
1212 BKE_reportf(reports, RPT_ERROR, "Vertex not in group");
1217 /* generic poll functions */
1218 int rna_Lattice_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
1220 return ((Object *)value.id.data)->type == OB_LATTICE;
1223 int rna_Curve_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
1225 return ((Object *)value.id.data)->type == OB_CURVE;
1228 int rna_Armature_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
1230 return ((Object *)value.id.data)->type == OB_ARMATURE;
1233 int rna_Mesh_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
1235 return ((Object *)value.id.data)->type == OB_MESH;
1238 int rna_Camera_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
1240 return ((Object *)value.id.data)->type == OB_CAMERA;
1245 static int rna_matrix_dimsize_4x4[]= {4, 4};
1247 static void rna_def_vertex_group(BlenderRNA *brna)
1253 static EnumPropertyItem assign_mode_items[] = {
1254 {WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"},
1255 {WEIGHT_ADD, "ADD", 0, "Add", "Add"},
1256 {WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"},
1257 {0, NULL, 0, NULL, NULL}
1260 srna= RNA_def_struct(brna, "VertexGroup", NULL);
1261 RNA_def_struct_sdna(srna, "bDeformGroup");
1262 RNA_def_struct_ui_text(srna, "Vertex Group", "Group of vertices, used for armature deform and other purposes");
1263 RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
1265 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1266 RNA_def_property_ui_text(prop, "Name", "Vertex group name");
1267 RNA_def_struct_name_property(srna, prop);
1268 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_VertexGroup_name_set");
1269 RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, "rna_Object_internal_update_data"); /* update data because modifiers may use [#24761] */
1271 prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
1272 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1273 RNA_def_property_int_funcs(prop, "rna_VertexGroup_index_get", NULL, NULL);
1274 RNA_def_property_ui_text(prop, "Index", "Index number of the vertex group");
1276 func= RNA_def_function(srna, "add", "rna_VertexGroup_vertex_add");
1277 RNA_def_function_ui_description(func, "Add vertices to the group.");
1278 RNA_def_function_flag(func, FUNC_USE_REPORTS|FUNC_USE_SELF_ID);
1279 /* TODO, see how array size of 0 works, this shouldnt be used */
1280 prop= RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List.", 0, 0);
1281 RNA_def_property_flag(prop, PROP_DYNAMIC|PROP_REQUIRED);
1282 prop= RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight.", 0.0f, 1.0f);
1283 RNA_def_property_flag(prop, PROP_REQUIRED);
1284 prop= RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode.");
1285 RNA_def_property_flag(prop, PROP_REQUIRED);
1287 func= RNA_def_function(srna, "remove", "rna_VertexGroup_vertex_remove");
1288 RNA_def_function_ui_description(func, "Remove a vertex from the group.");
1289 RNA_def_function_flag(func, FUNC_USE_REPORTS|FUNC_USE_SELF_ID);
1290 /* TODO, see how array size of 0 works, this shouldnt be used */
1291 prop= RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List.", 0, 0);
1292 RNA_def_property_flag(prop, PROP_DYNAMIC|PROP_REQUIRED);
1294 func= RNA_def_function(srna, "weight", "rna_VertexGroup_weight");
1295 RNA_def_function_ui_description(func, "Get a vertex weight from the group.");
1296 RNA_def_function_flag(func, FUNC_USE_REPORTS|FUNC_USE_SELF_ID);
1297 prop=RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "The index of the vertex.", 0, INT_MAX);
1298 RNA_def_property_flag(prop, PROP_REQUIRED);
1299 prop= RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight.", 0.0f, 1.0f);
1300 RNA_def_function_return(func, prop);
1303 static void rna_def_material_slot(BlenderRNA *brna)
1308 static EnumPropertyItem link_items[] = {
1309 {1, "OBJECT", 0, "Object", ""},
1310 {0, "DATA", 0, "Data", ""},
1311 {0, NULL, 0, NULL, NULL}};
1313 /* NOTE: there is no MaterialSlot equivalent in DNA, so the internal
1314 * pointer data points to ob->mat + index, and we manually implement
1315 * get/set for the properties. */
1317 srna= RNA_def_struct(brna, "MaterialSlot", NULL);
1318 RNA_def_struct_ui_text(srna, "Material Slot", "Material slot in an object");
1319 RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
1321 prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
1322 RNA_def_property_struct_type(prop, "Material");
1323 RNA_def_property_flag(prop, PROP_EDITABLE);
1324 RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", "rna_MaterialSlot_material_set", NULL, NULL);
1325 RNA_def_property_ui_text(prop, "Material", "Material datablock used by this material slot");
1326 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
1328 prop= RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
1329 RNA_def_property_enum_items(prop, link_items);
1330 RNA_def_property_enum_funcs(prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL);
1331 RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data");
1332 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
1334 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1335 RNA_def_property_string_funcs(prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL);
1336 RNA_def_property_ui_text(prop, "Name", "Material slot name");
1337 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1338 RNA_def_struct_name_property(srna, prop);
1341 static void rna_def_object_game_settings(BlenderRNA *brna)
1346 static EnumPropertyItem body_type_items[] = {
1347 {OB_BODY_TYPE_NO_COLLISION, "NO_COLLISION", 0, "No Collision", "Disable collision for this object"},
1348 {OB_BODY_TYPE_STATIC, "STATIC", 0, "Static", "Stationary object"},
1349 {OB_BODY_TYPE_DYNAMIC, "DYNAMIC", 0, "Dynamic", "Linear physics"},
1350 {OB_BODY_TYPE_RIGID, "RIGID_BODY", 0, "Rigid Body", "Linear and angular physics"},
1351 {OB_BODY_TYPE_SOFT, "SOFT_BODY", 0, "Soft Body", "Soft body"},
1352 {OB_BODY_TYPE_OCCLUDER, "OCCLUDE", 0, "Occlude", "Occluder for optimizing scene rendering"},
1353 {OB_BODY_TYPE_SENSOR, "SENSOR", 0, "Sensor", "Collision Sensor, detects static and dynamic objects but not the other collision sensor objects"},
1354 {OB_BODY_TYPE_NAVMESH, "NAVMESH", 0, "Navigation Mesh", "Navigation mesh"},
1355 {0, NULL, 0, NULL, NULL}};
1357 srna= RNA_def_struct(brna, "GameObjectSettings", NULL);
1358 RNA_def_struct_sdna(srna, "Object");
1359 RNA_def_struct_nested(brna, srna, "Object");
1360 RNA_def_struct_ui_text(srna, "Game Object Settings", "Game engine related settings for the object");
1361 RNA_def_struct_ui_icon(srna, ICON_GAME);
1365 prop= RNA_def_property(srna, "sensors", PROP_COLLECTION, PROP_NONE);
1366 RNA_def_property_struct_type(prop, "Sensor");
1367 RNA_def_property_ui_text(prop, "Sensors", "Game engine sensor to detect events");
1369 prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE);
1370 RNA_def_property_struct_type(prop, "Controller");
1371 RNA_def_property_ui_text(prop, "Controllers", "Game engine controllers to process events, connecting sensor to actuators");
1373 prop= RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE);
1374 RNA_def_property_struct_type(prop, "Actuator");
1375 RNA_def_property_ui_text(prop, "Actuators", "Game engine actuators to act on events");
1377 prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
1378 RNA_def_property_collection_sdna(prop, NULL, "prop", NULL);
1379 RNA_def_property_struct_type(prop, "GameProperty"); /* rna_property.c */
1380 RNA_def_property_ui_text(prop, "Properties", "Game engine properties");
1382 prop= RNA_def_property(srna, "show_sensors", PROP_BOOLEAN, PROP_NONE);
1383 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWSENS);
1384 RNA_def_property_ui_text(prop, "Show Sensors", "Shows sensors for this object in the user interface");
1386 prop= RNA_def_property(srna, "show_controllers", PROP_BOOLEAN, PROP_NONE);
1387 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWCONT);
1388 RNA_def_property_ui_text(prop, "Show Controllers", "Shows controllers for this object in the user interface");
1390 prop= RNA_def_property(srna, "show_actuators", PROP_BOOLEAN, PROP_NONE);
1391 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWACT);
1392 RNA_def_property_ui_text(prop, "Show Actuators", "Shows actuators for this object in the user interface");
1396 prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
1397 RNA_def_property_enum_sdna(prop, NULL, "body_type");
1398 RNA_def_property_enum_items(prop, body_type_items);
1399 RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", "rna_GameObjectSettings_physics_type_set", NULL);
1400 RNA_def_property_ui_text(prop, "Physics Type", "Selects the type of physical representation");
1401 RNA_def_property_update(prop, NC_LOGIC, NULL);
1403 prop= RNA_def_property(srna, "use_actor", PROP_BOOLEAN, PROP_NONE);
1404 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ACTOR);
1405 RNA_def_property_ui_text(prop, "Actor", "Object is detected by the Near and Radar sensor");
1407 prop= RNA_def_property(srna, "use_ghost", PROP_BOOLEAN, PROP_NONE);
1408 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_GHOST);
1409 RNA_def_property_ui_text(prop, "Ghost", "Object does not restitute collisions, like a ghost");
1411 prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
1412 RNA_def_property_range(prop, 0.01, 10000.0);
1413 RNA_def_property_ui_text(prop, "Mass", "Mass of the object");
1415 prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
1416 RNA_def_property_float_sdna(prop, NULL, "inertia");
1417 RNA_def_property_range(prop, 0.01, 10.0);
1418 RNA_def_property_ui_text(prop, "Radius", "Radius of bounding sphere and material physics");
1419 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1421 prop= RNA_def_property(srna, "use_sleep", PROP_BOOLEAN, PROP_NONE);
1422 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_COLLISION_RESPONSE);
1423 RNA_def_property_ui_text(prop, "No Sleeping", "Disable auto (de)activation in physics simulation");
1425 prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
1426 RNA_def_property_float_sdna(prop, NULL, "damping");
1427 RNA_def_property_range(prop, 0.0, 1.0);
1428 RNA_def_property_ui_text(prop, "Damping", "General movement damping");
1430 prop= RNA_def_property(srna, "rotation_damping", PROP_FLOAT, PROP_NONE);
1431 RNA_def_property_float_sdna(prop, NULL, "rdamping");
1432 RNA_def_property_range(prop, 0.0, 1.0);
1433 RNA_def_property_ui_text(prop, "Rotation Damping", "General rotation damping");
1435 prop= RNA_def_property(srna, "velocity_min", PROP_FLOAT, PROP_NONE);
1436 RNA_def_property_float_sdna(prop, NULL, "min_vel");
1437 RNA_def_property_range(prop, 0.0, 1000.0);
1438 RNA_def_property_ui_text(prop, "Velocity Min", "Clamp velocity to this minimum speed (except when totally still)");
1440 prop= RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
1441 RNA_def_property_float_sdna(prop, NULL, "max_vel");
1442 RNA_def_property_range(prop, 0.0, 1000.0);
1443 RNA_def_property_ui_text(prop, "Velocity Max", "Clamp velocity to this maximum speed");
1446 prop= RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
1447 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_AXIS);
1448 RNA_def_property_ui_text(prop, "Lock X Axis", "Disable simulation of linear motion along the X axis");
1450 prop= RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE);
1451 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_AXIS);
1452 RNA_def_property_ui_text(prop, "Lock Y Axis", "Disable simulation of linear motion along the Y axis");
1454 prop= RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE);
1455 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_AXIS);
1456 RNA_def_property_ui_text(prop, "Lock Z Axis", "Disable simulation of linear motion along the Z axis");
1460 prop= RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
1461 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_ROT_AXIS);
1462 RNA_def_property_ui_text(prop, "Lock X Rotation Axis", "Disable simulation of angular motion along the X axis");
1464 prop= RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
1465 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_ROT_AXIS);
1466 RNA_def_property_ui_text(prop, "Lock Y Rotation Axis", "Disable simulation of angular motion along the Y axis");
1468 prop= RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
1469 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_ROT_AXIS);
1470 RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis");
1472 /* is this used anywhere ? */
1473 prop= RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
1474 RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflag2", OB_NEVER_DO_ACTIVITY_CULLING);
1475 RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis");
1478 prop= RNA_def_property(srna, "use_material_physics_fh", PROP_BOOLEAN, PROP_NONE);
1479 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_DO_FH);
1480 RNA_def_property_ui_text(prop, "Use Material Force Field", "React to force field physics settings in materials");
1482 prop= RNA_def_property(srna, "use_rotate_from_normal", PROP_BOOLEAN, PROP_NONE);
1483 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ROT_FH);
1484 RNA_def_property_ui_text(prop, "Rotate From Normal", "Use face normal to rotate object, so that it points away from the surface");
1486 prop= RNA_def_property(srna, "form_factor", PROP_FLOAT, PROP_NONE);
1487 RNA_def_property_float_sdna(prop, NULL, "formfactor");
1488 RNA_def_property_range(prop, 0.0, 1.0);
1489 RNA_def_property_ui_text(prop, "Form Factor", "Form factor scales the inertia tensor");
1491 prop= RNA_def_property(srna, "use_anisotropic_friction", PROP_BOOLEAN, PROP_NONE);
1492 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ANISOTROPIC_FRICTION);
1493 RNA_def_property_ui_text(prop, "Anisotropic Friction", "Enable anisotropic friction");
1495 prop= RNA_def_property(srna, "friction_coefficients", PROP_FLOAT, PROP_NONE);
1496 RNA_def_property_float_sdna(prop, NULL, "anisotropicFriction");
1497 RNA_def_property_range(prop, 0.0, 1.0);
1498 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");
1500 prop= RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE);
1501 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_BOUNDS);
1502 RNA_def_property_ui_text(prop, "Use Collision Bounds", "Specify a collision bounds type other than the default");
1504 prop= RNA_def_property(srna, "collision_bounds_type", PROP_ENUM, PROP_NONE);
1505 RNA_def_property_enum_sdna(prop, NULL, "boundtype");
1506 RNA_def_property_enum_items(prop, collision_bounds_items);
1507 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Object_collision_bounds_itemf");
1508 RNA_def_property_ui_text(prop, "Collision Bounds", "Selects the collision type");
1509 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1511 prop= RNA_def_property(srna, "use_collision_compound", PROP_BOOLEAN, PROP_NONE);
1512 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_CHILD);
1513 RNA_def_property_ui_text(prop, "Collision Compound", "Add children to form a compound collision object");
1515 prop= RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
1516 RNA_def_property_float_sdna(prop, NULL, "margin");
1517 RNA_def_property_range(prop, 0.0, 1.0);
1518 RNA_def_property_ui_text(prop, "Collision Margin", "Extra margin around object for collision detection, small amount required for stability");
1520 prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
1521 RNA_def_property_pointer_sdna(prop, NULL, "bsoft");
1522 RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for Bullet soft body simulation");
1524 prop= RNA_def_property(srna, "create_obstacle", PROP_BOOLEAN, PROP_NONE);
1525 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_HASOBSTACLE);
1526 RNA_def_property_ui_text(prop, "Create obstacle", "Create representation for obstacle simulation");
1528 prop= RNA_def_property(srna, "obstacle_radius", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
1529 RNA_def_property_float_sdna(prop, NULL, "obstacleRad");
1530 RNA_def_property_range(prop, 0.0, 1000.0);
1531 RNA_def_property_ui_text(prop, "Obstacle Radius", "Radius of object representation in obstacle simulation");
1535 prop= RNA_def_property(srna, "states_visible", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1536 RNA_def_property_boolean_sdna(prop, NULL, "state", 1);
1537 RNA_def_property_array(prop, OB_MAX_STATES);
1538 RNA_def_property_ui_text(prop, "State", "State determining which controllers are displayed");
1539 RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_state_get", "rna_GameObjectSettings_state_set");
1541 prop= RNA_def_property(srna, "used_states", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1542 RNA_def_property_array(prop, OB_MAX_STATES);
1543 RNA_def_property_ui_text(prop, "Used State", "States which are being used by controllers");
1544 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1545 RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_used_state_get", NULL);
1547 prop= RNA_def_property(srna, "states_initial", PROP_BOOLEAN, PROP_NONE);
1548 RNA_def_property_boolean_sdna(prop, NULL, "init_state", 1);
1549 RNA_def_property_array(prop, OB_MAX_STATES);
1550 RNA_def_property_ui_text(prop, "Initial State", "Initial state when the game starts");
1552 prop= RNA_def_property(srna, "show_debug_state", PROP_BOOLEAN, PROP_NONE);
1553 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_DEBUGSTATE);
1554 RNA_def_property_ui_text(prop, "Debug State", "Print state debug info in the game engine");
1555 RNA_def_property_ui_icon(prop, ICON_INFO, 0);
1557 prop= RNA_def_property(srna, "use_all_states", PROP_BOOLEAN, PROP_NONE);
1558 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_ALLSTATE);
1559 RNA_def_property_ui_text(prop, "All", "Set all state bits");
1561 prop= RNA_def_property(srna, "show_state_panel", PROP_BOOLEAN, PROP_NONE);
1562 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWSTATE);
1563 RNA_def_property_ui_text(prop, "States", "Show state panel");
1564 RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
1567 static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop)
1575 RNA_def_property_srna(cprop, "ObjectConstraints");
1576 srna= RNA_def_struct(brna, "ObjectConstraints", NULL);
1577 RNA_def_struct_sdna(srna, "Object");
1578 RNA_def_struct_ui_text(srna, "Object Constraints", "Collection of object constraints");
1581 /* Collection active property */
1582 prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1583 RNA_def_property_struct_type(prop, "Constraint");
1584 RNA_def_property_pointer_funcs(prop, "rna_Object_active_constraint_get", "rna_Object_active_constraint_set", NULL, NULL);
1585 RNA_def_property_flag(prop, PROP_EDITABLE);
1586 RNA_def_property_ui_text(prop, "Active Constraint", "Active Object constraint");
1589 /* Constraint collection */
1590 func= RNA_def_function(srna, "new", "rna_Object_constraints_new");
1591 RNA_def_function_ui_description(func, "Add a new constraint to this object");
1593 parm= RNA_def_enum(func, "type", constraint_type_items, 1, "", "Constraint type to add.");
1594 RNA_def_property_flag(parm, PROP_REQUIRED);
1596 parm= RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint.");
1597 RNA_def_function_return(func, parm);
1599 func= RNA_def_function(srna, "remove", "rna_Object_constraints_remove");
1600 RNA_def_function_ui_description(func, "Remove a constraint from this object.");
1601 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1602 /* constraint to remove */
1603 parm= RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint.");
1604 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
1607 /* object.modifiers */
1608 static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
1615 RNA_def_property_srna(cprop, "ObjectModifiers");
1616 srna= RNA_def_struct(brna, "ObjectModifiers", NULL);
1617 RNA_def_struct_sdna(srna, "Object");
1618 RNA_def_struct_ui_text(srna, "Object Modifiers", "Collection of object modifiers");
1621 prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1622 RNA_def_property_struct_type(prop, "EditBone");
1623 RNA_def_property_pointer_sdna(prop, NULL, "act_edbone");
1624 RNA_def_property_flag(prop, PROP_EDITABLE);
1625 RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone");
1626 //RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update");
1627 RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_edit_bone_set", NULL, NULL);
1630 // RNA_def_property_collection_active(prop, prop_act);
1634 func= RNA_def_function(srna, "new", "rna_Object_modifier_new");
1635 RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
1636 RNA_def_function_ui_description(func, "Add a new modifier.");
1637 parm= RNA_def_string(func, "name", "Name", 0, "", "New name for the bone.");
1638 RNA_def_property_flag(parm, PROP_REQUIRED);
1639 /* modifier to add */
1640 parm= RNA_def_enum(func, "type", modifier_type_items, 1, "", "Modifier type to add.");
1641 RNA_def_property_flag(parm, PROP_REQUIRED);
1643 parm= RNA_def_pointer(func, "modifier", "Modifier", "", "Newly created modifier.");
1644 RNA_def_function_return(func, parm);
1647 func= RNA_def_function(srna, "remove", "rna_Object_modifier_remove");
1648 RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
1649 RNA_def_function_ui_description(func, "Remove an existing modifier from the object.");
1650 /* target to remove*/
1651 parm= RNA_def_pointer(func, "modifier", "Modifier", "", "Modifier to remove.");
1652 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
1655 /* object.particle_systems */
1656 static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop)
1662 // FunctionRNA *func;
1663 // PropertyRNA *parm;
1665 RNA_def_property_srna(cprop, "ParticleSystems");
1666 srna= RNA_def_struct(brna, "ParticleSystems", NULL);
1667 RNA_def_struct_sdna(srna, "Object");
1668 RNA_def_struct_ui_text(srna, "Particle Systems", "Collection of particle systems");
1670 prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1671 RNA_def_property_struct_type(prop, "ParticleSystem");
1672 RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL, NULL);
1673 RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed");
1674 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1676 prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
1677 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1678 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");
1679 RNA_def_property_ui_text(prop, "Active Particle System Index", "Index of active particle system slot");
1680 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_particle_update");
1684 /* object.vertex_groups */
1685 static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
1694 RNA_def_property_srna(cprop, "VertexGroups");
1695 srna= RNA_def_struct(brna, "VertexGroups", NULL);
1696 RNA_def_struct_sdna(srna, "Object");
1697 RNA_def_struct_ui_text(srna, "Vertex Groups", "Collection of vertex groups");
1699 prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1700 RNA_def_property_struct_type(prop, "VertexGroup");
1701 RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", "rna_Object_active_vertex_group_set", NULL, NULL);
1702 RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object");
1703 RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data");
1705 prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
1706 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1707 RNA_def_property_int_sdna(prop, NULL, "actdef");
1708 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");
1709 RNA_def_property_ui_text(prop, "Active Vertex Group Index", "Active index in vertex group array");
1710 RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data");
1712 /* vertex groups */ // add_vertex_group
1713 func= RNA_def_function(srna, "new", "rna_Object_vgroup_new");
1714 RNA_def_function_ui_description(func, "Add vertex group to object.");
1715 RNA_def_string(func, "name", "Group", 0, "", "Vertex group name."); /* optional */
1716 parm= RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group.");
1717 RNA_def_function_return(func, parm);
1719 func= RNA_def_function(srna, "remove", "rna_Object_vgroup_remove");
1720 RNA_def_function_ui_description(func, "Delete vertex group from object.");
1721 parm= RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to remove.");
1722 RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
1726 static void rna_def_object(BlenderRNA *brna)
1731 static EnumPropertyItem empty_drawtype_items[] = {
1732 {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""},
1733 {OB_ARROWS, "ARROWS", 0, "Arrows", ""},
1734 {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""},
1735 {OB_CIRCLE, "CIRCLE", 0, "Circle", ""},
1736 {OB_CUBE, "CUBE", 0, "Cube", ""},
1737 {OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""},
1738 {OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
1739 {OB_EMPTY_IMAGE, "IMAGE", 0, "Image", ""},
1740 {0, NULL, 0, NULL, NULL}};
1742 static EnumPropertyItem track_items[] = {
1743 {OB_POSX, "POS_X", 0, "+X", ""},
1744 {OB_POSY, "POS_Y", 0, "+Y", ""},
1745 {OB_POSZ, "POS_Z", 0, "+Z", ""},
1746 {OB_NEGX, "NEG_X", 0, "-X", ""},
1747 {OB_NEGY, "NEG_Y", 0, "-Y", ""},
1748 {OB_NEGZ, "NEG_Z", 0, "-Z", ""},
1749 {0, NULL, 0, NULL, NULL}};
1751 static EnumPropertyItem up_items[] = {
1752 {OB_POSX, "X", 0, "X", ""},
1753 {OB_POSY, "Y", 0, "Y", ""},
1754 {OB_POSZ, "Z", 0, "Z", ""},
1755 {0, NULL, 0, NULL, NULL}};
1757 static EnumPropertyItem drawtype_items[] = {
1758 {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Draw the bounding box of the object"},
1759 {OB_WIRE, "WIRE", 0, "Wire", "Draw the object as a wireframe"},
1760 {OB_SOLID, "SOLID", 0, "Solid", "Draw the object as a solid (If solid drawing is enabled in the viewport)"},
1761 {OB_TEXTURE, "TEXTURED", 0, "Textured", "Draw the object with textures (If textures are enabled in the viewport)"},
1762 {0, NULL, 0, NULL, NULL}};
1764 static EnumPropertyItem boundtype_items[] = {
1765 {OB_BOUND_BOX, "BOX", 0, "Box", "Draw bounds as box"},
1766 {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", "Draw bounds as sphere"},
1767 {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Draw bounds as cylinder"},
1768 {OB_BOUND_CONE, "CONE", 0, "Cone", "Draw bounds as cone"},
1769 {OB_BOUND_POLYH, "POLYHEDRON", 0, "Polyhedron", "Draw bounds as polyhedron"},
1770 {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", "Draw bounds as capsule"},
1771 {0, NULL, 0, NULL, NULL}};
1773 static EnumPropertyItem dupli_items[] = {
1774 {0, "NONE", 0, "None", ""},
1775 {OB_DUPLIFRAMES, "FRAMES", 0, "Frames", "Make copy of object for every frame"},
1776 {OB_DUPLIVERTS, "VERTS", 0, "Verts", "Duplicate child objects on all vertices"},
1777 {OB_DUPLIFACES, "FACES", 0, "Faces", "Duplicate child objects on all faces"},
1778 {OB_DUPLIGROUP, "GROUP", 0, "Group", "Enable group instancing"},
1779 {0, NULL, 0, NULL, NULL}};
1781 // XXX: this RNA enum define is currently duplicated for objects, since there is some text here which is not applicable
1782 static EnumPropertyItem prop_rotmode_items[] = {
1783 {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock"},
1784 {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order. Prone to Gimbal Lock. (Default)"},
1785 {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order. Prone to Gimbal Lock"},
1786 {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order. Prone to Gimbal Lock"},
1787 {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order. Prone to Gimbal Lock"},
1788 {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order. Prone to Gimbal Lock"},
1789 {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order. Prone to Gimbal Lock"},
1790 {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", "Axis Angle (W+XYZ). Defines a rotation around some axis defined by 3D-Vector"},
1791 {0, NULL, 0, NULL, NULL}};
1793 static float default_quat[4] = {1,0,0,0}; /* default quaternion values */
1794 static float default_axisAngle[4] = {0,0,1,0}; /* default axis-angle rotation values */
1795 static float default_scale[3] = {1,1,1}; /* default scale values */
1796 static int boundbox_dimsize[]= {8, 3};
1798 srna= RNA_def_struct(brna, "Object", "ID");
1799 RNA_def_struct_ui_text(srna, "Object", "Object datablock defining an object in a scene");
1800 RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
1801 RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
1803 prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
1804 RNA_def_property_struct_type(prop, "ID");
1805 RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_data_set", "rna_Object_data_typef", NULL);
1806 RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
1807 RNA_def_property_ui_text(prop, "Data", "Object data");
1808 RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
1810 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
1811 RNA_def_property_enum_sdna(prop, NULL, "type");
1812 RNA_def_property_enum_items(prop, object_type_items);
1813 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1814 RNA_def_property_ui_text(prop, "Type", "Type of Object");
1816 prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1817 RNA_def_property_enum_sdna(prop, NULL, "mode");
1818 RNA_def_property_enum_items(prop, object_mode_items);
1819 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1820 RNA_def_property_ui_text(prop, "Mode", "Object interaction mode");
1822 prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1823 RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
1824 RNA_def_property_array(prop, 20);
1825 RNA_def_property_ui_text(prop, "Layers", "Layers the object is on");
1826 RNA_def_property_boolean_funcs(prop, NULL, "rna_Object_layer_set");
1827 RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
1828 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_layer_update");
1830 prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
1831 RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
1832 RNA_def_property_ui_text(prop, "Select", "Object selection state");
1833 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_select_update");
1835 /* for data access */
1836 prop= RNA_def_property(srna, "bound_box", PROP_FLOAT, PROP_NONE);
1837 RNA_def_property_multi_array(prop, 2, boundbox_dimsize);
1838 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1839 RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL);
1840 RNA_def_property_ui_text(prop, "Bound Box", "Objects bound box in object-space coordinates, all values are -1.0 when not available.");
1843 prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
1844 RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_parent_set", NULL, NULL);
1845 RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
1846 RNA_def_property_ui_text(prop, "Parent", "Parent Object");
1847 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
1849 prop= RNA_def_property(srna, "parent_type", PROP_ENUM, PROP_NONE);
1850 RNA_def_property_enum_bitflag_sdna(prop, NULL, "partype");
1851 RNA_def_property_enum_items(prop, parent_type_items);
1852 RNA_def_property_enum_funcs(prop, NULL, "rna_Object_parent_type_set", "rna_Object_parent_type_itemf");
1853 RNA_def_property_ui_text(prop, "Parent Type", "Type of parent relation");
1854 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
1856 prop= RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED);
1857 RNA_def_property_int_sdna(prop, NULL, "par1");
1858 RNA_def_property_array(prop, 3);
1859 RNA_def_property_ui_text(prop, "Parent Vertices", "Indices of vertices in cases of a vertex parenting relation");
1860 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
1862 prop= RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
1863 RNA_def_property_string_sdna(prop, NULL, "parsubstr");
1864 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Object_parent_bone_set");
1865 RNA_def_property_ui_text(prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation");
1866 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
1868 /* Track and Up flags */
1869 // XXX: these have been saved here for a bit longer (after old track was removed), since some other tools still refer to this
1870 prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
1871 RNA_def_property_enum_sdna(prop, NULL, "trackflag");
1872 RNA_def_property_enum_items(prop, track_items);
1873 RNA_def_property_ui_text(prop, "Track Axis", "Axis that points in 'forward' direction (applies to DupliFrame when parent 'Follow' is enabled)");
1874 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
1876 prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
1877 RNA_def_property_enum_sdna(prop, NULL, "upflag");
1878 RNA_def_property_enum_items(prop, up_items);
1879 RNA_def_property_ui_text(prop, "Up Axis", "Axis that points in the upward direction (applies to DupliFrame when parent 'Follow' is enabled)");
1880 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
1883 prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
1884 RNA_def_property_ui_text(prop, "Proxy", "Library object this proxy object controls");
1886 prop= RNA_def_property(srna, "proxy_group", PROP_POINTER, PROP_NONE);
1887 RNA_def_property_ui_text(prop, "Proxy Group", "Library group duplicator object this proxy object controls");
1890 prop= RNA_def_property(srna, "material_slots", PROP_COLLECTION, PROP_NONE);
1891 RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
1892 RNA_def_property_struct_type(prop, "MaterialSlot");
1893 RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL); /* don't dereference pointer! */
1894 RNA_def_property_ui_text(prop, "Material Slots", "Material slots in the object");
1896 prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
1897 RNA_def_property_struct_type(prop, "Material");
1898 RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", "rna_Object_active_material_set", NULL, NULL);
1899 RNA_def_property_flag(prop, PROP_EDITABLE);
1900 RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed");
1901 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
1903 prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
1904 RNA_def_property_int_sdna(prop, NULL, "actcol");
1905 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
1906 RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set", "rna_Object_active_material_index_range");
1907 RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot");
1908 RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
1911 prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
1912 RNA_def_property_float_sdna(prop, NULL, "loc");
1913 RNA_def_property_editable_array_func(prop, "rna_Object_location_editable");
1914 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
1915 RNA_def_property_ui_text(prop, "Location", "Location of the object");
1916 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1918 prop= RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
1919 RNA_def_property_float_sdna(prop, NULL, "quat");
1920 RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
1921 RNA_def_property_float_array_default(prop, default_quat);
1922 RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
1923 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1925 /* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
1926 * having a single one is better for Keyframing and other property-management situations...
1928 prop= RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
1929 RNA_def_property_array(prop, 4);
1930 RNA_def_property_float_funcs(prop, "rna_Object_rotation_axis_angle_get", "rna_Object_rotation_axis_angle_set", NULL);
1931 RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
1932 RNA_def_property_float_array_default(prop, default_axisAngle);
1933 RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
1934 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1936 prop= RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
1937 RNA_def_property_float_sdna(prop, NULL, "rot");
1938 RNA_def_property_editable_array_func(prop, "rna_Object_rotation_euler_editable");
1939 RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
1940 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1942 prop= RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
1943 RNA_def_property_enum_sdna(prop, NULL, "rotmode");
1944 RNA_def_property_enum_items(prop, prop_rotmode_items); // XXX move to using a single define of this someday
1945 RNA_def_property_enum_funcs(prop, NULL, "rna_Object_rotation_mode_set", NULL);
1946 RNA_def_property_ui_text(prop, "Rotation Mode", "");
1947 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1949 prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
1950 RNA_def_property_float_sdna(prop, NULL, "size");
1951 RNA_def_property_editable_array_func(prop, "rna_Object_scale_editable");
1952 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
1953 RNA_def_property_float_array_default(prop, default_scale);
1954 RNA_def_property_ui_text(prop, "Scale", "Scaling of the object");
1955 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1957 prop= RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
1958 RNA_def_property_array(prop, 3);
1959 RNA_def_property_float_funcs(prop, "rna_Object_dimensions_get", "rna_Object_dimensions_set", NULL);
1960 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
1961 RNA_def_property_ui_text(prop, "Dimensions", "Absolute bounding box dimensions of the object");
1962 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1965 /* delta transforms */
1966 prop= RNA_def_property(srna, "delta_location", PROP_FLOAT, PROP_TRANSLATION);
1967 RNA_def_property_float_sdna(prop, NULL, "dloc");
1968 RNA_def_property_ui_text(prop, "Delta Location", "Extra translation added to the location of the object");
1969 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1971 prop= RNA_def_property(srna, "delta_rotation_euler", PROP_FLOAT, PROP_EULER);
1972 RNA_def_property_float_sdna(prop, NULL, "drot");
1973 RNA_def_property_ui_text(prop, "Delta Rotation (Euler)", "Extra rotation added to the rotation of the object (when using Euler rotations)");
1974 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1976 prop= RNA_def_property(srna, "delta_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
1977 RNA_def_property_float_sdna(prop, NULL, "dquat");
1978 RNA_def_property_float_array_default(prop, default_quat);
1979 RNA_def_property_ui_text(prop, "Delta Rotation (Quaternion)", "Extra rotation added to the rotation of the object (when using Quaternion rotations)");
1980 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1982 #if 0 // XXX not supported well yet...
1983 prop= RNA_def_property(srna, "delta_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
1984 RNA_def_property_float_sdna(prop, NULL, "dquat"); // FIXME: this is not a single field any more! (drotAxis and drotAngle)
1985 RNA_def_property_float_array_default(prop, default_axisAngle);
1986 RNA_def_property_ui_text(prop, "Delta Rotation (Axis Angle)", "Extra rotation added to the rotation of the object (when using Axis-Angle rotations)");
1987 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1990 prop= RNA_def_property(srna, "delta_scale", PROP_FLOAT, PROP_XYZ);
1991 RNA_def_property_float_sdna(prop, NULL, "dsize");
1992 RNA_def_property_ui_text(prop, "Delta Scale", "Extra scaling added to the scale of the object");
1993 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
1995 /* transform locks */
1996 prop= RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_XYZ);
1997 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX);
1998 RNA_def_property_array(prop, 3);
1999 RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location in the interface");
2000 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
2001 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2003 prop= RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_XYZ);
2004 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX);
2005 RNA_def_property_array(prop, 3);
2006 RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation in the interface");
2007 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
2008 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2010 // XXX this is sub-optimal - it really should be included above, but due to technical reasons we can't do this!
2011 prop= RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
2012 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW);
2013 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
2014 RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)", "Lock editing of 'angle' component of four-component rotations in the interface");
2015 // XXX this needs a better name
2016 prop= RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
2017 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D);
2018 RNA_def_property_ui_text(prop, "Lock Rotations (4D)", "Lock editing of four component rotations by components (instead of as Eulers)");
2020 prop= RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_XYZ);
2021 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX);
2022 RNA_def_property_array(prop, 3);
2023 RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface");
2024 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
2025 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2028 prop= RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
2029 RNA_def_property_float_sdna(prop, NULL, "obmat");
2030 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2031 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2032 RNA_def_property_ui_text(prop, "Matrix World", "Worldspace transformation matrix");
2033 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_matrix_world_update");
2035 prop= RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
2036 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2037 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2038 RNA_def_property_ui_text(prop, "Local Matrix", "Parent relative transformation matrix");
2039 RNA_def_property_float_funcs(prop, "rna_Object_matrix_local_get", "rna_Object_matrix_local_set", NULL);
2040 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, NULL);
2042 prop= RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
2043 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2044 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2045 RNA_def_property_ui_text(prop, "Input Matrix", "Matrix access to location, rotation and scale (including deltas), before constraints and parenting are applied.");
2046 RNA_def_property_float_funcs(prop, "rna_Object_matrix_basis_get", "rna_Object_matrix_basis_set", NULL);
2047 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2050 prop= RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX);
2051 RNA_def_property_float_sdna(prop, NULL, "parentinv");
2052 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2053 RNA_def_property_ui_text(prop, "Matrix", "Inverse of object's parent matrix at time of parenting");
2054 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2057 prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
2058 RNA_def_property_struct_type(prop, "Modifier");
2059 RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the geometric data of the object");
2060 rna_def_object_modifiers(brna, prop);
2063 prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
2064 RNA_def_property_struct_type(prop, "Constraint");
2065 RNA_def_property_ui_text(prop, "Constraints", "Constraints affecting the transformation of the object");
2066 // RNA_def_property_collection_funcs(prop, 0, 0, 0, 0, 0, 0, 0, "constraints__add", "constraints__remove");
2067 rna_def_object_constraints(brna, prop);
2070 prop= RNA_def_property(srna, "game", PROP_POINTER, PROP_NONE);
2071 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2072 RNA_def_property_struct_type(prop, "GameObjectSettings");
2073 RNA_def_property_pointer_funcs(prop, "rna_Object_game_settings_get", NULL, NULL, NULL);
2074 RNA_def_property_ui_text(prop, "Game Settings", "Game engine related settings for the object");
2077 prop= RNA_def_property(srna, "vertex_groups", PROP_COLLECTION, PROP_NONE);
2078 RNA_def_property_collection_sdna(prop, NULL, "defbase", NULL);
2079 RNA_def_property_struct_type(prop, "VertexGroup");
2080 RNA_def_property_ui_text(prop, "Vertex Groups", "Vertex groups of the object");
2081 rna_def_object_vertex_groups(brna, prop);
2084 prop= RNA_def_property(srna, "empty_draw_type", PROP_ENUM, PROP_NONE);
2085 RNA_def_property_enum_sdna(prop, NULL, "empty_drawtype");
2086 RNA_def_property_enum_items(prop, empty_drawtype_items);
2087 RNA_def_property_ui_text(prop, "Empty Display Type", "Viewport display style for empties");
2088 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2090 prop= RNA_def_property(srna, "empty_draw_size", PROP_FLOAT, PROP_DISTANCE);
2091 RNA_def_property_float_sdna(prop, NULL, "empty_drawsize");
2092 RNA_def_property_range(prop, 0.0001f, 1000.0f);
2093 RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
2094 RNA_def_property_ui_text(prop, "Empty Display Size", "Size of display for empties in the viewport");
2095 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2097 prop= RNA_def_property(srna, "empty_image_offset", PROP_FLOAT, PROP_DISTANCE);
2098 RNA_def_property_float_sdna(prop, NULL, "ima_ofs");
2099 RNA_def_property_ui_text(prop, "Origin Offset", "Origin offset distance");
2100 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 0.1f, 2);
2101 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2104 prop= RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
2105 RNA_def_property_int_sdna(prop, NULL, "index");
2106 RNA_def_property_ui_text(prop, "Pass Index", "Index # for the IndexOB render pass");
2107 RNA_def_property_update(prop, NC_OBJECT, NULL);
2109 prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
2110 RNA_def_property_float_sdna(prop, NULL, "col");
2111 RNA_def_property_ui_text(prop, "Color", "Object color and alpha, used when faces have the ObColor mode enabled");
2112 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2115 prop= RNA_def_property(srna, "field", PROP_POINTER, PROP_NONE);
2116 RNA_def_property_pointer_sdna(prop, NULL, "pd");
2117 RNA_def_property_struct_type(prop, "FieldSettings");
2118 RNA_def_property_pointer_funcs(prop, "rna_Object_field_get", NULL, NULL, NULL);
2119 RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the objects as a field in physics simulation");
2121 prop= RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE);
2122 RNA_def_property_pointer_sdna(prop, NULL, "pd");
2123 RNA_def_property_struct_type(prop, "CollisionSettings");
2124 RNA_def_property_pointer_funcs(prop, "rna_Object_collision_get", NULL, NULL, NULL);
2125 RNA_def_property_ui_text(prop, "Collision Settings", "Settings for using the objects as a collider in physics simulation");
2127 prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
2128 RNA_def_property_pointer_sdna(prop, NULL, "soft");
2129 RNA_def_property_struct_type(prop, "SoftBodySettings");
2130 RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for soft body simulation");
2132 prop= RNA_def_property(srna, "particle_systems", PROP_COLLECTION, PROP_NONE);
2133 RNA_def_property_collection_sdna(prop, NULL, "particlesystem", NULL);
2134 RNA_def_property_struct_type(prop, "ParticleSystem");
2135 RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
2136 rna_def_object_particle_systems(brna, prop);
2139 prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
2140 RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEW);
2141 RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport");
2142 RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
2143 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2145 prop= RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
2146 RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT);
2147 RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport");
2148 RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1);
2149 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2151 prop= RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
2152 RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER);
2153 RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability");
2154 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2155 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2158 rna_def_animdata_common(srna);
2160 rna_def_animviz_common(srna);
2161 rna_def_motionpath_common(srna);
2164 // XXX: evil old crap
2165 prop= RNA_def_property(srna, "use_slow_parent", PROP_BOOLEAN, PROP_NONE);
2166 RNA_def_property_boolean_sdna(prop, NULL, "partype", PARSLOW);
2167 RNA_def_property_ui_text(prop, "Slow Parent", "Create a delay in the parent relationship");
2168 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
2170 prop= RNA_def_property(srna, "dupli_type", PROP_ENUM, PROP_NONE);
2171 RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag");
2172 RNA_def_property_enum_items(prop, dupli_items);
2173 RNA_def_property_ui_text(prop, "Dupli Type", "If not None, object duplication method to use");
2174 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
2176 prop= RNA_def_property(srna, "use_dupli_frames_speed", PROP_BOOLEAN, PROP_NONE);
2177 RNA_def_property_boolean_negative_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED);
2178 RNA_def_property_ui_text(prop, "Dupli Frames Speed", "Set dupliframes to use the frame"); // TODO, better descriptio!
2179 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
2181 prop= RNA_def_property(srna, "use_dupli_vertices_rotation", PROP_BOOLEAN, PROP_NONE);
2182 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT);
2183 RNA_def_property_ui_text(prop, "Dupli Verts Rotation", "Rotate dupli according to vertex normal");
2184 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2186 prop= RNA_def_property(srna, "use_dupli_faces_scale", PROP_BOOLEAN, PROP_NONE);
2187 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIFACES_SCALE);
2188 RNA_def_property_ui_text(prop, "Dupli Faces Inherit Scale", "Scale dupli based on face size");
2189 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
2191 prop= RNA_def_property(srna, "dupli_faces_scale", PROP_FLOAT, PROP_NONE);
2192 RNA_def_property_float_sdna(prop, NULL, "dupfacesca");
2193 RNA_def_property_range(prop, 0.001f, 10000.0f);
2194 RNA_def_property_ui_text(prop, "Dupli Faces Scale", "Scale the DupliFace objects");
2195 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2197 prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
2198 RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
2199 RNA_def_property_flag(prop, PROP_EDITABLE);
2200 RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_dup_group_set", NULL, NULL);
2201 RNA_def_property_ui_text(prop, "Dupli Group", "Instance an existing group");
2202 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
2204 prop= RNA_def_property(srna, "dupli_frames_start", PROP_INT, PROP_NONE|PROP_UNIT_TIME);
2205 RNA_def_property_int_sdna(prop, NULL, "dupsta");
2206 RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
2207 RNA_def_property_ui_text(prop, "Dupli Frames Start", "Start frame for DupliFrames");
2208 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
2210 prop= RNA_def_property(srna, "dupli_frames_end", PROP_INT, PROP_NONE|PROP_UNIT_TIME);
2211 RNA_def_property_int_sdna(prop, NULL, "dupend");
2212 RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
2213 RNA_def_property_ui_text(prop, "Dupli Frames End", "End frame for DupliFrames");
2214 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
2216 prop= RNA_def_property(srna, "dupli_frames_on", PROP_INT, PROP_NONE|PROP_UNIT_TIME);
2217 RNA_def_property_int_sdna(prop, NULL, "dupon");
2218 RNA_def_property_range(prop, MINFRAME, MAXFRAME);
2219 RNA_def_property_ui_range(prop, 1, 1500, 1, 0);
2220 RNA_def_property_ui_text(prop, "Dupli Frames On", "Number of frames to use between DupOff frames");
2221 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
2223 prop= RNA_def_property(srna, "dupli_frames_off", PROP_INT, PROP_NONE|PROP_UNIT_TIME);
2224 RNA_def_property_int_sdna(prop, NULL, "dupoff");
2225 RNA_def_property_range(prop, 0, MAXFRAME);
2226 RNA_def_property_ui_range(prop, 0, 1500, 1, 0);
2227 RNA_def_property_ui_text(prop, "Dupli Frames Off", "Recurring frames to exclude from the Dupliframes");
2228 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
2230 prop= RNA_def_property(srna, "dupli_list", PROP_COLLECTION, PROP_NONE);
2231 RNA_def_property_collection_sdna(prop, NULL, "duplilist", NULL);
2232 RNA_def_property_struct_type(prop, "DupliObject");
2233 RNA_def_property_ui_text(prop, "Dupli list", "Object duplis");
2235 prop= RNA_def_property(srna, "is_duplicator", PROP_BOOLEAN, PROP_NONE);
2236 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLI);
2237 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2240 prop= RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE|PROP_UNIT_TIME);
2241 RNA_def_property_float_sdna(prop, NULL, "sf");
2242 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
2243 RNA_def_property_ui_text(prop, "Time Offset", "Animation offset in frames for F-Curve and dupligroup instances");
2244 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2246 prop= RNA_def_property(srna, "use_time_offset_edit", PROP_BOOLEAN, PROP_NONE);
2247 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_OB);
2248 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");
2250 prop= RNA_def_property(srna, "use_time_offset_parent", PROP_BOOLEAN, PROP_NONE);
2251 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARENT);
2252 RNA_def_property_ui_text(prop, "Time Offset Parent", "Apply the time offset to this objects parent relationship");
2253 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2255 prop= RNA_def_property(srna, "use_time_offset_particle", PROP_BOOLEAN, PROP_NONE);
2256 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARTICLE);
2257 RNA_def_property_ui_text(prop, "Time Offset Particle", "Let the time offset work on the particle effect");
2258 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2260 prop= RNA_def_property(srna, "use_time_offset_add_parent", PROP_BOOLEAN, PROP_NONE);
2261 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARENTADD);
2262 RNA_def_property_ui_text(prop, "Time Offset Add Parent", "Add the parents time offset value");
2263 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
2266 prop= RNA_def_property(srna, "draw_type", PROP_ENUM, PROP_NONE);
2267 RNA_def_property_enum_sdna(prop, NULL, "dt");
2268 RNA_def_property_enum_items(prop, drawtype_items);
2269 RNA_def_property_ui_text(prop, "Maximum Draw Type", "Maximum draw type to display object with in viewport");
2270 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2272 prop= RNA_def_property(srna, "show_bounds", PROP_BOOLEAN, PROP_NONE);
2273 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_BOUNDBOX);
2274 RNA_def_property_ui_text(prop, "Draw Bounds", "Displays the object's bounds");
2275 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2277 prop= RNA_def_property(srna, "draw_bounds_type", PROP_ENUM, PROP_NONE);
2278 RNA_def_property_enum_sdna(prop, NULL, "boundtype");
2279 RNA_def_property_enum_items(prop, boundtype_items);
2280 RNA_def_property_ui_text(prop, "Draw Bounds Type", "Object boundary display type");
2281 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2283 prop= RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
2284 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWNAME);
2285 RNA_def_property_ui_text(prop, "Draw Name", "Displays the object's name");
2286 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2288 prop= RNA_def_property(srna, "show_axis", PROP_BOOLEAN, PROP_NONE);
2289 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_AXIS);
2290 RNA_def_property_ui_text(prop, "Draw Axis", "Displays the object's origin and axis");
2291 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2293 prop= RNA_def_property(srna, "show_texture_space", PROP_BOOLEAN, PROP_NONE);
2294 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_TEXSPACE);
2295 RNA_def_property_ui_text(prop, "Draw Texture Space", "Displays the object's texture space");
2296 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2298 prop= RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
2299 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWWIRE);
2300 RNA_def_property_ui_text(prop, "Draw Wire", "Adds the object's wireframe over solid drawing");
2301 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2303 prop= RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE);
2304 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP);
2305 RNA_def_property_ui_text(prop, "Draw Transparent", "Displays material transparency in the object (unsupported for duplicator drawing)");
2306 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2308 prop= RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE);
2309 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY);
2310 RNA_def_property_ui_text(prop, "X-Ray", "Makes the object draw in front of others (unsupported for duplicator drawing)");
2311 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2314 prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
2315 RNA_def_property_pointer_sdna(prop, NULL, "gpd");
2316 RNA_def_property_flag(prop, PROP_EDITABLE);
2317 RNA_def_property_struct_type(prop, "GreasePencil");
2318 RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil datablock");
2319 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
2322 prop= RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE);
2323 RNA_def_property_pointer_sdna(prop, NULL, "poselib");
2324 RNA_def_property_flag(prop, PROP_EDITABLE);
2325 RNA_def_property_struct_type(prop, "Action");
2326 RNA_def_property_ui_text(prop, "Pose Library", "Action used as a pose library for armatures");
2328 prop= RNA_def_property(srna, "pose", PROP_POINTER, PROP_NONE);
2329 RNA_def_property_pointer_sdna(prop, NULL, "pose");
2330 RNA_def_property_struct_type(prop, "Pose");
2331 RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures");
2334 prop= RNA_def_property(srna, "show_only_shape_key", PROP_BOOLEAN, PROP_NONE);
2335 RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_LOCK);
2336 RNA_def_property_ui_text(prop, "Shape Key Lock", "Always show the current Shape for this Object");
2337 RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
2338 RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
2340 prop= RNA_def_property(srna, "use_shape_key_edit_mode", PROP_BOOLEAN, PROP_NONE);
2341 RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_EDIT_MODE);
2342 RNA_def_property_ui_text(prop, "Shape Key Edit Mode", "Apply shape keys in edit mode (for Meshes only)");
2343 RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
2344 RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
2346 prop= RNA_def_property(srna, "active_shape_key", PROP_POINTER, PROP_NONE);
2347 RNA_def_property_struct_type(prop, "ShapeKey");
2348 RNA_def_property_pointer_funcs(prop, "rna_Object_active_shape_key_get", NULL, NULL, NULL);
2349 RNA_def_property_ui_text(prop, "Active Shape Key", "Current shape key");
2351 prop= RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE);
2352 RNA_def_property_int_sdna(prop, NULL, "shapenr");
2353 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); // XXX this is really unpredictable...
2354 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");
2355 RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index");
2356 RNA_def_property_update(prop, 0, "rna_Object_active_shape_update");
2358 RNA_api_object(srna);
2361 static void rna_def_dupli_object(BlenderRNA *brna)
2366 srna= RNA_def_struct(brna, "DupliObject", NULL);
2367 RNA_def_struct_sdna(srna, "DupliObject");
2368 RNA_def_struct_ui_text(srna, "Object Duplicate", "An object duplicate");
2369 /* RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA); */
2371 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2372 RNA_def_property_pointer_sdna(prop, NULL, "ob");
2373 /* RNA_def_property_pointer_funcs(prop, "rna_DupliObject_object_get", NULL, NULL, NULL); */
2374 RNA_def_property_ui_text(prop, "Object", "Object being duplicated");
2376 prop= RNA_def_property(srna, "matrix_original", PROP_FLOAT, PROP_MATRIX);
2377 RNA_def_property_float_sdna(prop, NULL, "omat");
2378 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2379 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2380 RNA_def_property_ui_text(prop, "Object Matrix", "The original matrix of this object before it was duplicated");
2382 prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
2383 RNA_def_property_float_sdna(prop, NULL, "mat");
2384 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2385 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2386 RNA_def_property_ui_text(prop, "Object Duplicate Matrix", "Object duplicate transformation matrix");
2388 /* TODO: DupliObject has more properties that can be wrapped */
2391 static void rna_def_object_base(BlenderRNA *brna)
2396 srna= RNA_def_struct(brna, "ObjectBase", NULL);
2397 RNA_def_struct_sdna(srna, "Base");
2398 RNA_def_struct_ui_text(srna, "Object Base", "An object instance in a scene");
2399 RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
2401 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2402 RNA_def_property_pointer_sdna(prop, NULL, "object");
2403 RNA_def_property_ui_text(prop, "Object", "Object this base links to");
2405 /* same as object layer */
2406 prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
2407 RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
2408 RNA_def_property_array(prop, 20);
2409 RNA_def_property_ui_text(prop, "Layers", "Layers the object base is on");
2410 RNA_def_property_boolean_funcs(prop, NULL, "rna_Base_layer_set");
2411 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Base_layer_update");
2413 prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
2414 RNA_def_property_boolean_sdna(prop, NULL, "flag", BA_SELECT);
2415 RNA_def_property_ui_text(prop, "Select", "Object base selection state");
2416 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Base_select_update");
2418 RNA_api_object_base(srna);
2421 void RNA_def_object(BlenderRNA *brna)
2423 rna_def_object(brna);
2424 rna_def_object_game_settings(brna);
2425 rna_def_object_base(brna);
2426 rna_def_vertex_group(brna);
2427 rna_def_material_slot(brna);
2428 rna_def_dupli_object(brna);