2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * Contributor(s): Blender Foundation (2008).
20 * ***** END GPL LICENSE BLOCK *****
23 /** \file blender/makesrna/intern/rna_object.c
30 #include "DNA_action_types.h"
31 #include "DNA_customdata_types.h"
32 #include "DNA_controller_types.h"
33 #include "DNA_group_types.h"
34 #include "DNA_material_types.h"
35 #include "DNA_mesh_types.h"
36 #include "DNA_object_force.h"
37 #include "DNA_object_types.h"
38 #include "DNA_property_types.h"
39 #include "DNA_scene_types.h"
40 #include "DNA_meta_types.h"
42 #include "BLI_utildefines.h"
43 #include "BLI_listbase.h"
45 #include "BKE_camera.h"
46 #include "BKE_paint.h"
47 #include "BKE_editmesh.h"
48 #include "BKE_group.h" /* needed for BKE_group_object_exists() */
49 #include "BKE_object_deform.h"
51 #include "RNA_access.h"
52 #include "RNA_define.h"
53 #include "RNA_enum_types.h"
55 #include "rna_internal.h"
57 #include "BLI_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
63 EnumPropertyItem object_mode_items[] = {
64 {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object Mode", ""},
65 {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit Mode", ""},
66 {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose Mode", ""},
67 {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt Mode", ""},
68 {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
69 {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
70 {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
71 {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""},
72 {0, NULL, 0, NULL, NULL}
75 EnumPropertyItem object_empty_drawtype_items[] = {
76 {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""},
77 {OB_ARROWS, "ARROWS", 0, "Arrows", ""},
78 {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""},
79 {OB_CIRCLE, "CIRCLE", 0, "Circle", ""},
80 {OB_CUBE, "CUBE", 0, "Cube", ""},
81 {OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""},
82 {OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
83 {OB_EMPTY_IMAGE, "IMAGE", 0, "Image", ""},
84 {0, NULL, 0, NULL, NULL}
88 static EnumPropertyItem parent_type_items[] = {
89 {PAROBJECT, "OBJECT", 0, "Object", "The object is parented to an object"},
90 {PARSKEL, "ARMATURE", 0, "Armature", ""},
91 {PARSKEL, "LATTICE", 0, "Lattice", "The object is parented to a lattice"}, /* PARSKEL reuse will give issues */
92 {PARVERT1, "VERTEX", 0, "Vertex", "The object is parented to a vertex"},
93 {PARVERT3, "VERTEX_3", 0, "3 Vertices", ""},
94 {PARBONE, "BONE", 0, "Bone", "The object is parented to a bone"},
95 {0, NULL, 0, NULL, NULL}
99 static EnumPropertyItem dupli_items[] = {
100 {0, "NONE", 0, "None", ""},
101 {OB_DUPLIFRAMES, "FRAMES", 0, "Frames", "Make copy of object for every frame"},
102 {OB_DUPLIVERTS, "VERTS", 0, "Verts", "Duplicate child objects on all vertices"},
103 {OB_DUPLIFACES, "FACES", 0, "Faces", "Duplicate child objects on all faces"},
104 {OB_DUPLIGROUP, "GROUP", 0, "Group", "Enable group instancing"},
105 {0, NULL, 0, NULL, NULL}
109 static EnumPropertyItem collision_bounds_items[] = {
110 {OB_BOUND_BOX, "BOX", ICON_MESH_CUBE, "Box", ""},
111 {OB_BOUND_SPHERE, "SPHERE", ICON_MESH_UVSPHERE, "Sphere", ""},
112 {OB_BOUND_CYLINDER, "CYLINDER", ICON_MESH_CYLINDER, "Cylinder", ""},
113 {OB_BOUND_CONE, "CONE", ICON_MESH_CONE, "Cone", ""},
114 {OB_BOUND_CONVEX_HULL, "CONVEX_HULL", ICON_MESH_ICOSPHERE, "Convex Hull", ""},
115 {OB_BOUND_TRIANGLE_MESH, "TRIANGLE_MESH", ICON_MESH_MONKEY, "Triangle Mesh", ""},
116 {OB_BOUND_CAPSULE, "CAPSULE", ICON_MESH_CAPSULE, "Capsule", ""},
117 /*{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""}, */
118 {0, NULL, 0, NULL, NULL}
121 EnumPropertyItem metaelem_type_items[] = {
122 {MB_BALL, "BALL", ICON_META_BALL, "Ball", ""},
123 {MB_TUBE, "CAPSULE", ICON_META_CAPSULE, "Capsule", ""},
124 {MB_PLANE, "PLANE", ICON_META_PLANE, "Plane", ""},
125 {MB_ELIPSOID, "ELLIPSOID", ICON_META_ELLIPSOID, "Ellipsoid", ""}, /* NOTE: typo at original definition! */
126 {MB_CUBE, "CUBE", ICON_META_CUBE, "Cube", ""},
127 {0, NULL, 0, NULL, NULL}
130 /* used for 2 enums */
131 #define OBTYPE_CU_CURVE {OB_CURVE, "CURVE", 0, "Curve", ""}
132 #define OBTYPE_CU_SURF {OB_SURF, "SURFACE", 0, "Surface", ""}
133 #define OBTYPE_CU_FONT {OB_FONT, "FONT", 0, "Font", ""}
135 EnumPropertyItem object_type_items[] = {
136 {OB_MESH, "MESH", 0, "Mesh", ""},
139 {OB_MBALL, "META", 0, "Meta", ""},
141 {0, "", 0, NULL, NULL},
142 {OB_ARMATURE, "ARMATURE", 0, "Armature", ""},
143 {OB_LATTICE, "LATTICE", 0, "Lattice", ""},
144 {OB_EMPTY, "EMPTY", 0, "Empty", ""},
145 {0, "", 0, NULL, NULL},
146 {OB_CAMERA, "CAMERA", 0, "Camera", ""},
147 {OB_LAMP, "LAMP", 0, "Lamp", ""},
148 {OB_SPEAKER, "SPEAKER", 0, "Speaker", ""},
149 {0, NULL, 0, NULL, NULL}
152 EnumPropertyItem object_type_curve_items[] = {
156 {0, NULL, 0, NULL, NULL}
159 EnumPropertyItem object_axis_items[] = {
160 {OB_POSX, "POS_X", 0, "+X", ""},
161 {OB_POSY, "POS_Y", 0, "+Y", ""},
162 {OB_POSZ, "POS_Z", 0, "+Z", ""},
163 {OB_NEGX, "NEG_X", 0, "-X", ""},
164 {OB_NEGY, "NEG_Y", 0, "-Y", ""},
165 {OB_NEGZ, "NEG_Z", 0, "-Z", ""},
166 {0, NULL, 0, NULL, NULL}
169 /* for general use (not just object) */
170 EnumPropertyItem object_axis_unsigned_items[] = {
171 {0, "X", 0, "X", ""},
172 {1, "Y", 0, "Y", ""},
173 {2, "Z", 0, "Z", ""},
174 {0, NULL, 0, NULL, NULL}
179 #include "BLI_math.h"
181 #include "DNA_key_types.h"
182 #include "DNA_constraint_types.h"
183 #include "DNA_lattice_types.h"
184 #include "DNA_node_types.h"
186 #include "BKE_armature.h"
187 #include "BKE_bullet.h"
188 #include "BKE_constraint.h"
189 #include "BKE_context.h"
190 #include "BKE_curve.h"
191 #include "BKE_depsgraph.h"
192 #include "BKE_effect.h"
193 #include "BKE_global.h"
195 #include "BKE_object.h"
196 #include "BKE_material.h"
197 #include "BKE_mesh.h"
198 #include "BKE_particle.h"
199 #include "BKE_scene.h"
200 #include "BKE_deform.h"
202 #include "ED_object.h"
203 #include "ED_particle.h"
204 #include "ED_curve.h"
205 #include "ED_lattice.h"
207 static void rna_Object_internal_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
209 DAG_id_tag_update(ptr->id.data, OB_RECALC_OB);
212 static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
214 /* don't use compat so we get predictable rotation */
215 BKE_object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat, false, true);
216 rna_Object_internal_update(bmain, scene, ptr);
219 static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
221 DAG_id_type_tag(bmain, ID_OB);
224 static void rna_Object_matrix_local_get(PointerRNA *ptr, float values[16])
226 Object *ob = ptr->id.data;
227 BKE_object_matrix_local_get(ob, (float(*)[4])values);
230 static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16])
232 Object *ob = ptr->id.data;
233 float local_mat[4][4];
235 /* localspace matrix is truly relative to the parent, but parameters stored in object are
236 * relative to parentinv matrix. Undo the parent inverse part before applying it as local matrix. */
239 invert_m4_m4(invmat, ob->parentinv);
240 mul_m4_m4m4(local_mat, invmat, (float(*)[4])values);
243 copy_m4_m4(local_mat, (float(*)[4])values);
246 /* don't use compat so we get predictable rotation, and do not use parenting either, because it's a local matrix! */
247 BKE_object_apply_mat4(ob, local_mat, false, false);
250 static void rna_Object_matrix_basis_get(PointerRNA *ptr, float values[16])
252 Object *ob = ptr->id.data;
253 BKE_object_to_mat4(ob, (float(*)[4])values);
256 static void rna_Object_matrix_basis_set(PointerRNA *ptr, const float values[16])
258 Object *ob = ptr->id.data;
259 BKE_object_apply_mat4(ob, (float(*)[4])values, false, false);
262 void rna_Object_internal_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
264 DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
265 WM_main_add_notifier(NC_OBJECT | ND_DRAW, ptr->id.data);
268 static void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
270 Object *ob = ptr->id.data;
272 if (scene->obedit == ob) {
273 /* exit/enter editmode to get new shape */
277 EDBM_mesh_make(scene->toolsettings, ob);
278 EDBM_mesh_normals_update(((Mesh *)ob->data)->edit_btmesh);
279 BKE_editmesh_tessface_calc(((Mesh *)ob->data)->edit_btmesh);
293 rna_Object_internal_update_data(bmain, scene, ptr);
296 static void rna_Object_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
298 DAG_id_tag_update(ptr->id.data, OB_RECALC_OB);
299 DAG_relations_tag_update(bmain);
300 WM_main_add_notifier(NC_OBJECT | ND_PARENT, ptr->id.data);
303 /* when changing the selection flag the scene needs updating */
304 static void rna_Object_select_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
307 Object *ob = (Object *)ptr->id.data;
308 short mode = ob->flag & SELECT ? BA_SELECT : BA_DESELECT;
309 ED_base_object_select(BKE_scene_base_find(scene, ob), mode);
313 static void rna_Base_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
315 Base *base = (Base *)ptr->data;
316 short mode = base->flag & BA_SELECT ? BA_SELECT : BA_DESELECT;
317 ED_base_object_select(base, mode);
320 static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, Base *base, Object *ob)
322 /* try to avoid scene sort */
324 /* pass - unlikely but when running scripts on startup it happens */
326 else if ((ob->lay & scene->lay) && (base->lay & scene->lay)) {
329 else if ((ob->lay & scene->lay) == 0 && (base->lay & scene->lay) == 0) {
333 DAG_relations_tag_update(bmain);
336 DAG_id_type_tag(bmain, ID_OB);
339 static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
341 Object *ob = (Object *)ptr->id.data;
344 base = scene ? BKE_scene_base_find(scene, ob) : NULL;
348 SWAP(unsigned int, base->lay, ob->lay);
350 rna_Object_layer_update__internal(bmain, scene, base, ob);
353 WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, scene);
356 static void rna_Base_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
358 Base *base = (Base *)ptr->data;
359 Object *ob = (Object *)base->object;
361 rna_Object_layer_update__internal(bmain, scene, base, ob);
364 WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, scene);
367 static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
369 Object *ob = (Object *)ptr->data;
372 if (ob->mode & OB_MODE_EDIT) {
376 /* assigning NULL only for empties */
377 if ((id == NULL) && (ob->type != OB_EMPTY)) {
381 if (ob->type == OB_EMPTY) {
383 id_us_min((ID *)ob->data);
387 if (!id || GS(id->name) == ID_IM) {
392 else if (ob->type == OB_MESH) {
393 BKE_mesh_assign_object(ob, (Mesh *)id);
397 id_us_min((ID *)ob->data);
400 /* no need to type-check here ID. this is done in the _typef() function */
401 BLI_assert(OB_DATA_SUPPORT_ID(GS(id->name)));
405 test_object_materials(G.main, id);
407 if (GS(id->name) == ID_CU)
408 BKE_curve_type_test(ob);
409 else if (ob->type == OB_ARMATURE)
410 BKE_pose_rebuild(ob, ob->data);
414 static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
416 Object *ob = (Object *)ptr->data;
418 /* keep in sync with OB_DATA_SUPPORT_ID() macro */
420 case OB_EMPTY: return &RNA_Image;
421 case OB_MESH: return &RNA_Mesh;
422 case OB_CURVE: return &RNA_Curve;
423 case OB_SURF: return &RNA_Curve;
424 case OB_FONT: return &RNA_Curve;
425 case OB_MBALL: return &RNA_MetaBall;
426 case OB_LAMP: return &RNA_Lamp;
427 case OB_CAMERA: return &RNA_Camera;
428 case OB_LATTICE: return &RNA_Lattice;
429 case OB_ARMATURE: return &RNA_Armature;
430 case OB_SPEAKER: return &RNA_Speaker;
431 default: return &RNA_ID;
435 static void rna_Object_parent_set(PointerRNA *ptr, PointerRNA value)
437 Object *ob = (Object *)ptr->data;
438 Object *par = (Object *)value.data;
441 /* NOTE: this dummy check here prevents this method causing weird runtime errors on mingw 4.6.2 */
445 ED_object_parent(ob, par, ob->partype, ob->parsubstr);
449 static void rna_Object_parent_type_set(PointerRNA *ptr, int value)
451 Object *ob = (Object *)ptr->data;
453 ED_object_parent(ob, ob->parent, value, ob->parsubstr);
456 static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), PointerRNA *ptr,
457 PropertyRNA *UNUSED(prop), bool *r_free)
459 Object *ob = (Object *)ptr->data;
460 EnumPropertyItem *item = NULL;
463 RNA_enum_items_add_value(&item, &totitem, parent_type_items, PAROBJECT);
466 Object *par = ob->parent;
468 if (par->type == OB_LATTICE) {
469 /* special hack: prevents this overriding others */
470 RNA_enum_items_add_value(&item, &totitem, &parent_type_items[2], PARSKEL);
472 else if (par->type == OB_ARMATURE) {
473 /* special hack: prevents this being overrided */
474 RNA_enum_items_add_value(&item, &totitem, &parent_type_items[1], PARSKEL);
475 RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARBONE);
478 if (OB_TYPE_SUPPORT_PARVERT(par->type)) {
479 RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT1);
480 RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT3);
484 RNA_enum_item_end(&item, &totitem);
490 static void rna_Object_empty_draw_type_set(PointerRNA *ptr, int value)
492 Object *ob = (Object *)ptr->data;
494 BKE_object_empty_draw_type_set(ob, value);
497 static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), PointerRNA *ptr,
498 PropertyRNA *UNUSED(prop), bool *r_free)
500 Object *ob = (Object *)ptr->data;
501 EnumPropertyItem *item = NULL;
504 if (ob->body_type != OB_BODY_TYPE_CHARACTER) {
505 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_TRIANGLE_MESH);
507 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CONVEX_HULL);
509 if (ob->body_type != OB_BODY_TYPE_SOFT) {
510 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CONE);
511 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CYLINDER);
512 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_SPHERE);
513 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_BOX);
514 RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CAPSULE);
517 RNA_enum_item_end(&item, &totitem);
523 static void rna_Object_parent_bone_set(PointerRNA *ptr, const char *value)
525 Object *ob = (Object *)ptr->data;
527 ED_object_parent(ob, ob->parent, ob->partype, value);
530 static void rna_Object_dup_group_set(PointerRNA *ptr, PointerRNA value)
532 Object *ob = (Object *)ptr->data;
533 Group *grp = (Group *)value.data;
535 /* must not let this be set if the object belongs in this group already,
536 * thus causing a cycle/infinite-recursion leading to crashes on load [#25298]
538 if (BKE_group_object_exists(grp, ob) == 0)
541 BKE_report(NULL, RPT_ERROR,
542 "Cannot set dupli-group as object belongs in group being instanced, thus causing a cycle");
545 static void rna_VertexGroup_name_set(PointerRNA *ptr, const char *value)
547 Object *ob = (Object *)ptr->id.data;
548 bDeformGroup *dg = (bDeformGroup *)ptr->data;
549 BLI_strncpy_utf8(dg->name, value, sizeof(dg->name));
550 defgroup_unique_name(dg, ob);
553 static int rna_VertexGroup_index_get(PointerRNA *ptr)
555 Object *ob = (Object *)ptr->id.data;
557 return BLI_findindex(&ob->defbase, ptr->data);
560 static PointerRNA rna_Object_active_vertex_group_get(PointerRNA *ptr)
562 Object *ob = (Object *)ptr->id.data;
563 return rna_pointer_inherit_refine(ptr, &RNA_VertexGroup, BLI_findlink(&ob->defbase, ob->actdef - 1));
566 static int rna_Object_active_vertex_group_index_get(PointerRNA *ptr)
568 Object *ob = (Object *)ptr->id.data;
569 return ob->actdef - 1;
572 static void rna_Object_active_vertex_group_index_set(PointerRNA *ptr, int value)
574 Object *ob = (Object *)ptr->id.data;
575 ob->actdef = value + 1;
578 static void rna_Object_active_vertex_group_index_range(PointerRNA *ptr, int *min, int *max,
579 int *UNUSED(softmin), int *UNUSED(softmax))
581 Object *ob = (Object *)ptr->id.data;
584 *max = max_ii(0, BLI_listbase_count(&ob->defbase) - 1);
587 void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
589 Object *ob = (Object *)ptr->id.data;
592 dg = BLI_findlink(&ob->defbase, index - 1);
594 if (dg) BLI_strncpy(value, dg->name, sizeof(dg->name));
595 else value[0] = '\0';
598 int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index)
600 Object *ob = (Object *)ptr->id.data;
603 dg = BLI_findlink(&ob->defbase, index - 1);
604 return (dg) ? strlen(dg->name) : 0;
607 void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
609 Object *ob = (Object *)ptr->id.data;
610 *index = defgroup_name_index(ob, value) + 1;
613 void rna_object_vgroup_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
615 Object *ob = (Object *)ptr->id.data;
616 bDeformGroup *dg = defgroup_find_name(ob, value);
618 BLI_strncpy(result, value, maxlen); /* no need for BLI_strncpy_utf8, since this matches an existing group */
625 void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
627 Object *ob = (Object *)ptr->id.data;
629 CustomDataLayer *layer;
632 if (ob->type == OB_MESH && ob->data) {
633 me = (Mesh *)ob->data;
635 for (a = 0; a < me->pdata.totlayer; a++) {
636 layer = &me->pdata.layers[a];
638 if (layer->type == CD_MTEXPOLY && STREQ(layer->name, value)) {
639 BLI_strncpy(result, value, maxlen);
648 void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
650 Object *ob = (Object *)ptr->id.data;
652 CustomDataLayer *layer;
655 if (ob->type == OB_MESH && ob->data) {
656 me = (Mesh *)ob->data;
658 for (a = 0; a < me->fdata.totlayer; a++) {
659 layer = &me->fdata.layers[a];
661 if (layer->type == CD_MCOL && STREQ(layer->name, value)) {
662 BLI_strncpy(result, value, maxlen);
671 static int rna_Object_active_material_index_get(PointerRNA *ptr)
673 Object *ob = (Object *)ptr->id.data;
674 return MAX2(ob->actcol - 1, 0);
677 static void rna_Object_active_material_index_set(PointerRNA *ptr, int value)
679 Object *ob = (Object *)ptr->id.data;
680 ob->actcol = value + 1;
682 if (ob->type == OB_MESH) {
686 me->edit_btmesh->mat_nr = value;
690 static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, int *max,
691 int *UNUSED(softmin), int *UNUSED(softmax))
693 Object *ob = (Object *)ptr->id.data;
695 *max = max_ii(ob->totcol - 1, 0);
698 /* returns active base material */
699 static PointerRNA rna_Object_active_material_get(PointerRNA *ptr)
701 Object *ob = (Object *)ptr->id.data;
704 ma = (ob->totcol) ? give_current_material(ob, ob->actcol) : NULL;
705 return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
708 static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value)
710 Object *ob = (Object *)ptr->id.data;
712 DAG_id_tag_update(value.data, 0);
713 assign_material(ob, value.data, ob->actcol, BKE_MAT_ASSIGN_EXISTING);
716 static int rna_Object_active_material_editable(PointerRNA *ptr)
718 Object *ob = (Object *)ptr->id.data;
721 if ((ob->matbits == NULL) || (ob->actcol == 0) || ob->matbits[ob->actcol - 1]) {
722 is_editable = (ob->id.lib == NULL);
725 is_editable = ob->data ? (((ID *)ob->data)->lib == NULL) : false;
728 return is_editable ? PROP_EDITABLE : 0;
732 static void rna_Object_active_particle_system_index_range(PointerRNA *ptr, int *min, int *max,
733 int *UNUSED(softmin), int *UNUSED(softmax))
735 Object *ob = (Object *)ptr->id.data;
737 *max = max_ii(0, BLI_listbase_count(&ob->particlesystem) - 1);
740 static int rna_Object_active_particle_system_index_get(PointerRNA *ptr)
742 Object *ob = (Object *)ptr->id.data;
743 return psys_get_current_num(ob);
746 static void rna_Object_active_particle_system_index_set(PointerRNA *ptr, int value)
748 Object *ob = (Object *)ptr->id.data;
749 psys_set_current_num(ob, value);
752 static void rna_Object_particle_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
754 Object *ob = (Object *)ptr->id.data;
756 PE_current_changed(scene, ob);
759 /* rotation - axis-angle */
760 static void rna_Object_rotation_axis_angle_get(PointerRNA *ptr, float *value)
762 Object *ob = ptr->data;
764 /* for now, assume that rotation mode is axis-angle */
765 value[0] = ob->rotAngle;
766 copy_v3_v3(&value[1], ob->rotAxis);
769 /* rotation - axis-angle */
770 static void rna_Object_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
772 Object *ob = ptr->data;
774 /* for now, assume that rotation mode is axis-angle */
775 ob->rotAngle = value[0];
776 copy_v3_v3(ob->rotAxis, &value[1]);
778 /* TODO: validate axis? */
781 static void rna_Object_rotation_mode_set(PointerRNA *ptr, int value)
783 Object *ob = ptr->data;
785 /* use API Method for conversions... */
786 BKE_rotMode_change_values(ob->quat, ob->rot, ob->rotAxis, &ob->rotAngle, ob->rotmode, (short)value);
788 /* finally, set the new rotation type */
792 static void rna_Object_dimensions_get(PointerRNA *ptr, float *value)
794 Object *ob = ptr->data;
795 BKE_object_dimensions_get(ob, value);
798 static void rna_Object_dimensions_set(PointerRNA *ptr, const float *value)
800 Object *ob = ptr->data;
801 BKE_object_dimensions_set(ob, value);
804 static int rna_Object_location_editable(PointerRNA *ptr, int index)
806 Object *ob = (Object *)ptr->data;
808 /* only if the axis in question is locked, not editable... */
809 if ((index == 0) && (ob->protectflag & OB_LOCK_LOCX))
811 else if ((index == 1) && (ob->protectflag & OB_LOCK_LOCY))
813 else if ((index == 2) && (ob->protectflag & OB_LOCK_LOCZ))
816 return PROP_EDITABLE;
819 static int rna_Object_scale_editable(PointerRNA *ptr, int index)
821 Object *ob = (Object *)ptr->data;
823 /* only if the axis in question is locked, not editable... */
824 if ((index == 0) && (ob->protectflag & OB_LOCK_SCALEX))
826 else if ((index == 1) && (ob->protectflag & OB_LOCK_SCALEY))
828 else if ((index == 2) && (ob->protectflag & OB_LOCK_SCALEZ))
831 return PROP_EDITABLE;
834 static int rna_Object_rotation_euler_editable(PointerRNA *ptr, int index)
836 Object *ob = (Object *)ptr->data;
838 /* only if the axis in question is locked, not editable... */
839 if ((index == 0) && (ob->protectflag & OB_LOCK_ROTX))
841 else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTY))
843 else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTZ))
846 return PROP_EDITABLE;
849 static int rna_Object_rotation_4d_editable(PointerRNA *ptr, int index)
851 Object *ob = (Object *)ptr->data;
853 /* only consider locks if locking components individually... */
854 if (ob->protectflag & OB_LOCK_ROT4D) {
855 /* only if the axis in question is locked, not editable... */
856 if ((index == 0) && (ob->protectflag & OB_LOCK_ROTW))
858 else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTX))
860 else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTY))
862 else if ((index == 3) && (ob->protectflag & OB_LOCK_ROTZ))
866 return PROP_EDITABLE;
870 static PointerRNA rna_MaterialSlot_material_get(PointerRNA *ptr)
872 Object *ob = (Object *)ptr->id.data;
874 int index = (Material **)ptr->data - ob->mat;
876 ma = give_current_material(ob, index + 1);
877 return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
880 static void rna_MaterialSlot_material_set(PointerRNA *ptr, PointerRNA value)
882 Object *ob = (Object *)ptr->id.data;
883 int index = (Material **)ptr->data - ob->mat;
885 assign_material(ob, value.data, index + 1, BKE_MAT_ASSIGN_EXISTING);
888 static int rna_MaterialSlot_link_get(PointerRNA *ptr)
890 Object *ob = (Object *)ptr->id.data;
891 int index = (Material **)ptr->data - ob->mat;
893 return ob->matbits[index] != 0;
896 static void rna_MaterialSlot_link_set(PointerRNA *ptr, int value)
898 Object *ob = (Object *)ptr->id.data;
899 int index = (Material **)ptr->data - ob->mat;
902 ob->matbits[index] = 1;
903 /* ob->colbits |= (1 << index); */ /* DEPRECATED */
906 ob->matbits[index] = 0;
907 /* ob->colbits &= ~(1 << index); */ /* DEPRECATED */
911 static int rna_MaterialSlot_name_length(PointerRNA *ptr)
913 Object *ob = (Object *)ptr->id.data;
915 int index = (Material **)ptr->data - ob->mat;
917 ma = give_current_material(ob, index + 1);
920 return strlen(ma->id.name + 2);
925 static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str)
927 Object *ob = (Object *)ptr->id.data;
929 int index = (Material **)ptr->data - ob->mat;
931 ma = give_current_material(ob, index + 1);
934 strcpy(str, ma->id.name + 2);
939 static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr)
941 rna_Object_internal_update(bmain, scene, ptr);
943 WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, ptr->id.data);
944 WM_main_add_notifier(NC_MATERIAL | ND_SHADING_LINKS, NULL);
945 DAG_relations_tag_update(bmain);
948 static char *rna_MaterialSlot_path(PointerRNA *ptr)
950 Object *ob = (Object *)ptr->id.data;
951 int index = (Material **)ptr->data - ob->mat;
953 /* from armature... */
954 return BLI_sprintfN("material_slots[%d]", index);
957 /* why does this have to be so complicated?, can't all this crap be
958 * moved to in BGE conversion function? - Campbell *
960 * logic from check_body_type()
962 static int rna_GameObjectSettings_physics_type_get(PointerRNA *ptr)
964 Object *ob = (Object *)ptr->id.data;
966 /* determine the body_type setting based on flags */
967 if (!(ob->gameflag & OB_COLLISION)) {
968 if (ob->gameflag & OB_OCCLUDER) {
969 ob->body_type = OB_BODY_TYPE_OCCLUDER;
971 else if (ob->gameflag & OB_NAVMESH) {
972 ob->body_type = OB_BODY_TYPE_NAVMESH;
975 ob->body_type = OB_BODY_TYPE_NO_COLLISION;
978 else if (ob->gameflag & OB_CHARACTER) {
979 ob->body_type = OB_BODY_TYPE_CHARACTER;
981 else if (ob->gameflag & OB_SENSOR) {
982 ob->body_type = OB_BODY_TYPE_SENSOR;
984 else if (!(ob->gameflag & OB_DYNAMIC)) {
985 ob->body_type = OB_BODY_TYPE_STATIC;
987 else if (!(ob->gameflag & (OB_RIGID_BODY | OB_SOFT_BODY))) {
988 ob->body_type = OB_BODY_TYPE_DYNAMIC;
990 else if (ob->gameflag & OB_RIGID_BODY) {
991 ob->body_type = OB_BODY_TYPE_RIGID;
994 ob->body_type = OB_BODY_TYPE_SOFT;
995 /* create the structure here because we display soft body buttons in the main panel */
997 ob->bsoft = bsbNew();
1000 return ob->body_type;
1003 static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
1005 Object *ob = (Object *)ptr->id.data;
1006 const int gameflag_prev = ob->gameflag;
1007 ob->body_type = value;
1009 switch (ob->body_type) {
1010 case OB_BODY_TYPE_SENSOR:
1011 ob->gameflag |= OB_SENSOR | OB_COLLISION;
1012 ob->gameflag &= ~(OB_OCCLUDER | OB_CHARACTER | OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_ACTOR |
1013 OB_ANISOTROPIC_FRICTION | OB_DO_FH | OB_ROT_FH | OB_COLLISION_RESPONSE | OB_NAVMESH);
1015 case OB_BODY_TYPE_OCCLUDER:
1016 ob->gameflag |= OB_OCCLUDER;
1017 ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_CHARACTER | OB_DYNAMIC | OB_NAVMESH);
1019 case OB_BODY_TYPE_NAVMESH:
1020 ob->gameflag |= OB_NAVMESH;
1021 ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_CHARACTER | OB_DYNAMIC | OB_OCCLUDER);
1023 if (ob->type == OB_MESH) {
1024 /* could be moved into mesh UI but for now ensure mesh data layer */
1025 BKE_mesh_ensure_navmesh(ob->data);
1029 case OB_BODY_TYPE_NO_COLLISION:
1030 ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_CHARACTER | OB_OCCLUDER | OB_DYNAMIC | OB_NAVMESH);
1032 case OB_BODY_TYPE_CHARACTER:
1033 ob->gameflag |= OB_COLLISION | OB_CHARACTER;
1034 ob->gameflag &= ~(OB_SENSOR | OB_OCCLUDER | OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_ACTOR |
1035 OB_ANISOTROPIC_FRICTION | OB_DO_FH | OB_ROT_FH | OB_COLLISION_RESPONSE | OB_NAVMESH);
1037 case OB_BODY_TYPE_STATIC:
1038 ob->gameflag |= OB_COLLISION;
1039 ob->gameflag &= ~(OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH);
1041 case OB_BODY_TYPE_DYNAMIC:
1042 ob->gameflag |= OB_COLLISION | OB_DYNAMIC | OB_ACTOR;
1043 ob->gameflag &= ~(OB_RIGID_BODY | OB_SOFT_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH);
1045 case OB_BODY_TYPE_RIGID:
1046 ob->gameflag |= OB_COLLISION | OB_DYNAMIC | OB_RIGID_BODY | OB_ACTOR;
1047 ob->gameflag &= ~(OB_SOFT_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH);
1050 case OB_BODY_TYPE_SOFT:
1051 ob->gameflag |= OB_COLLISION | OB_DYNAMIC | OB_SOFT_BODY | OB_ACTOR;
1052 ob->gameflag &= ~(OB_RIGID_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH);
1054 /* assume triangle mesh, if no bounds chosen for soft body */
1055 if ((ob->gameflag & OB_BOUNDS) && (ob->boundtype < OB_BOUND_TRIANGLE_MESH)) {
1056 ob->boundtype = OB_BOUND_TRIANGLE_MESH;
1058 /* create a BulletSoftBody structure if not already existing */
1060 ob->bsoft = bsbNew();
1064 if ((gameflag_prev & OB_NAVMESH) != (ob->gameflag & OB_NAVMESH)) {
1065 if (ob->type == OB_MESH) {
1066 /* this is needed to refresh the derived meshes draw func */
1067 DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
1071 WM_main_add_notifier(NC_OBJECT | ND_DRAW, ptr->id.data);
1074 static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr)
1076 Object *ob = (Object *)ptr->id.data;
1077 ParticleSystem *psys = psys_get_current(ob);
1078 return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem, psys);
1081 static PointerRNA rna_Object_game_settings_get(PointerRNA *ptr)
1083 return rna_pointer_inherit_refine(ptr, &RNA_GameObjectSettings, ptr->id.data);
1087 static unsigned int rna_Object_layer_validate__internal(const int *values, unsigned int lay)
1091 /* ensure we always have some layer selected */
1092 for (i = 0; i < 20; i++)
1099 for (i = 0; i < 20; i++) {
1100 if (values[i]) lay |= (1 << i);
1101 else lay &= ~(1 << i);
1107 static void rna_Object_layer_set(PointerRNA *ptr, const int *values)
1109 Object *ob = (Object *)ptr->data;
1112 lay = rna_Object_layer_validate__internal(values, ob->lay);
1117 static void rna_Base_layer_set(PointerRNA *ptr, const int *values)
1119 Base *base = (Base *)ptr->data;
1122 lay = rna_Object_layer_validate__internal(values, base->lay);
1126 /* rna_Base_layer_update updates the objects layer */
1129 static void rna_GameObjectSettings_state_get(PointerRNA *ptr, int *values)
1131 Object *ob = (Object *)ptr->data;
1133 int all_states = (ob->scaflag & OB_ALLSTATE ? 1 : 0);
1135 memset(values, 0, sizeof(int) * OB_MAX_STATES);
1136 for (i = 0; i < OB_MAX_STATES; i++) {
1137 values[i] = (ob->state & (1 << i)) ? 1 : 0 | all_states;
1141 static void rna_GameObjectSettings_state_set(PointerRNA *ptr, const int *values)
1143 Object *ob = (Object *)ptr->data;
1146 /* ensure we always have some state selected */
1147 for (i = 0; i < OB_MAX_STATES; i++)
1154 for (i = 0; i < OB_MAX_STATES; i++) {
1155 if (values[i]) ob->state |= (1 << i);
1156 else ob->state &= ~(1 << i);
1160 static void rna_GameObjectSettings_used_state_get(PointerRNA *ptr, int *values)
1162 Object *ob = (Object *)ptr->data;
1165 memset(values, 0, sizeof(int) * OB_MAX_STATES);
1166 for (cont = ob->controllers.first; cont; cont = cont->next) {
1169 for (i = 0; i < OB_MAX_STATES; i++) {
1170 if (cont->state_mask & (1 << i))
1176 static void rna_GameObjectSettings_col_group_get(PointerRNA *ptr, int *values)
1178 Object *ob = (Object *)ptr->data;
1181 for (i = 0; i < OB_MAX_COL_MASKS; i++) {
1182 values[i] = (ob->col_group & (1 << i)) != 0;
1186 static void rna_GameObjectSettings_col_group_set(PointerRNA *ptr, const int *values)
1188 Object *ob = (Object *)ptr->data;
1191 /* ensure we always have some group selected */
1192 for (i = 0; i < OB_MAX_COL_MASKS; i++)
1199 for (i = 0; i < OB_MAX_COL_MASKS; i++) {
1200 if (values[i]) ob->col_group |= (1 << i);
1201 else ob->col_group &= ~(1 << i);
1205 static void rna_GameObjectSettings_col_mask_get(PointerRNA *ptr, int *values)
1207 Object *ob = (Object *)ptr->data;
1210 for (i = 0; i < OB_MAX_COL_MASKS; i++) {
1211 values[i] = (ob->col_mask & (1 << i)) != 0;
1215 static void rna_GameObjectSettings_col_mask_set(PointerRNA *ptr, const int *values)
1217 Object *ob = (Object *)ptr->data;
1220 /* ensure we always have some mask selected */
1221 for (i = 0; i < OB_MAX_COL_MASKS; i++)
1228 for (i = 0; i < OB_MAX_COL_MASKS; i++) {
1229 if (values[i]) ob->col_mask |= (1 << i);
1230 else ob->col_mask &= ~(1 << i);
1235 static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, int *max,
1236 int *UNUSED(softmin), int *UNUSED(softmax))
1238 Object *ob = (Object *)ptr->id.data;
1239 Key *key = BKE_key_from_object(ob);
1243 *max = BLI_listbase_count(&key->block) - 1;
1244 if (*max < 0) *max = 0;
1251 static int rna_Object_active_shape_key_index_get(PointerRNA *ptr)
1253 Object *ob = (Object *)ptr->id.data;
1255 return MAX2(ob->shapenr - 1, 0);
1258 static void rna_Object_active_shape_key_index_set(PointerRNA *ptr, int value)
1260 Object *ob = (Object *)ptr->id.data;
1262 ob->shapenr = value + 1;
1265 static PointerRNA rna_Object_active_shape_key_get(PointerRNA *ptr)
1267 Object *ob = (Object *)ptr->id.data;
1268 Key *key = BKE_key_from_object(ob);
1273 return PointerRNA_NULL;
1275 kb = BLI_findlink(&key->block, ob->shapenr - 1);
1276 RNA_pointer_create((ID *)key, &RNA_ShapeKey, kb, &keyptr);
1280 static PointerRNA rna_Object_field_get(PointerRNA *ptr)
1282 Object *ob = (Object *)ptr->id.data;
1286 ob->pd = object_add_collision_fields(0);
1288 return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, ob->pd);
1291 static PointerRNA rna_Object_collision_get(PointerRNA *ptr)
1293 Object *ob = (Object *)ptr->id.data;
1295 if (ob->type != OB_MESH)
1296 return PointerRNA_NULL;
1300 ob->pd = object_add_collision_fields(0);
1302 return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd);
1305 static PointerRNA rna_Object_active_constraint_get(PointerRNA *ptr)
1307 Object *ob = (Object *)ptr->id.data;
1308 bConstraint *con = BKE_constraints_active_get(&ob->constraints);
1309 return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con);
1312 static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value)
1314 Object *ob = (Object *)ptr->id.data;
1315 BKE_constraints_active_set(&ob->constraints, (bConstraint *)value.data);
1318 static bConstraint *rna_Object_constraints_new(Object *object, int type)
1320 WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, object);
1321 return BKE_constraint_add_for_object(object, NULL, type);
1324 static void rna_Object_constraints_remove(Object *object, ReportList *reports, PointerRNA *con_ptr)
1326 bConstraint *con = con_ptr->data;
1327 if (BLI_findindex(&object->constraints, con) == -1) {
1328 BKE_reportf(reports, RPT_ERROR, "Constraint '%s' not found in object '%s'", con->name, object->id.name + 2);
1332 BKE_constraint_remove(&object->constraints, con);
1333 RNA_POINTER_INVALIDATE(con_ptr);
1335 ED_object_constraint_update(object);
1336 ED_object_constraint_set_active(object, NULL);
1337 WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, object);
1340 static void rna_Object_constraints_clear(Object *object)
1342 BKE_constraints_free(&object->constraints);
1344 ED_object_constraint_update(object);
1345 ED_object_constraint_set_active(object, NULL);
1347 WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, object);
1350 static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports,
1351 const char *name, int type)
1353 return ED_object_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
1356 static void rna_Object_modifier_remove(Object *object, bContext *C, ReportList *reports, PointerRNA *md_ptr)
1358 ModifierData *md = md_ptr->data;
1359 if (ED_object_modifier_remove(reports, CTX_data_main(C), object, md) == false) {
1360 /* error is already set */
1364 RNA_POINTER_INVALIDATE(md_ptr);
1366 WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
1369 static void rna_Object_modifier_clear(Object *object, bContext *C)
1371 ED_object_modifier_clear(CTX_data_main(C), object);
1373 WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
1376 static void rna_Object_boundbox_get(PointerRNA *ptr, float *values)
1378 Object *ob = (Object *)ptr->id.data;
1379 BoundBox *bb = BKE_object_boundbox_get(ob);
1381 memcpy(values, bb->vec, sizeof(bb->vec));
1384 copy_vn_fl(values, sizeof(bb->vec) / sizeof(float), 0.0f);
1389 static bDeformGroup *rna_Object_vgroup_new(Object *ob, const char *name)
1391 bDeformGroup *defgroup = BKE_object_defgroup_add_name(ob, name);
1393 WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
1398 static void rna_Object_vgroup_remove(Object *ob, ReportList *reports, PointerRNA *defgroup_ptr)
1400 bDeformGroup *defgroup = defgroup_ptr->data;
1401 if (BLI_findindex(&ob->defbase, defgroup) == -1) {
1402 BKE_reportf(reports, RPT_ERROR, "DeformGroup '%s' not in object '%s'", defgroup->name, ob->id.name + 2);
1406 BKE_object_defgroup_remove(ob, defgroup);
1407 RNA_POINTER_INVALIDATE(defgroup_ptr);
1409 WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
1412 static void rna_Object_vgroup_clear(Object *ob)
1414 BKE_object_defgroup_remove_all(ob);
1416 WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
1419 static void rna_VertexGroup_vertex_add(ID *id, bDeformGroup *def, ReportList *reports, int index_len,
1420 int *index, float weight, int assignmode)
1422 Object *ob = (Object *)id;
1424 if (BKE_object_is_in_editmode_vgroup(ob)) {
1425 BKE_report(reports, RPT_ERROR, "VertexGroup.add(): cannot be called while object is in edit mode");
1430 ED_vgroup_vert_add(ob, def, *index++, weight, assignmode); /* XXX, not efficient calling within loop*/
1432 WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data);
1435 static void rna_VertexGroup_vertex_remove(ID *id, bDeformGroup *dg, ReportList *reports, int index_len, int *index)
1437 Object *ob = (Object *)id;
1439 if (BKE_object_is_in_editmode_vgroup(ob)) {
1440 BKE_report(reports, RPT_ERROR, "VertexGroup.remove(): cannot be called while object is in edit mode");
1445 ED_vgroup_vert_remove(ob, dg, *index++);
1447 WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data);
1450 static float rna_VertexGroup_weight(ID *id, bDeformGroup *dg, ReportList *reports, int index)
1452 float weight = ED_vgroup_vert_weight((Object *)id, dg, index);
1455 BKE_report(reports, RPT_ERROR, "Vertex not in group");
1460 /* generic poll functions */
1461 int rna_Lattice_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
1463 return ((Object *)value.id.data)->type == OB_LATTICE;
1466 int rna_Curve_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
1468 return ((Object *)value.id.data)->type == OB_CURVE;
1471 int rna_Armature_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
1473 return ((Object *)value.id.data)->type == OB_ARMATURE;
1476 int rna_Mesh_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
1478 return ((Object *)value.id.data)->type == OB_MESH;
1481 int rna_Camera_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
1483 return ((Object *)value.id.data)->type == OB_CAMERA;
1486 int rna_Lamp_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
1488 return ((Object *)value.id.data)->type == OB_LAMP;
1491 int rna_DupliObject_index_get(PointerRNA *ptr)
1493 DupliObject *dob = (DupliObject *)ptr->data;
1494 return dob->persistent_id[0];
1497 int rna_Object_use_dynamic_topology_sculpting_get(PointerRNA *ptr)
1499 SculptSession *ss = ((Object *)ptr->id.data)->sculpt;
1500 return (ss && ss->bm);
1503 static void rna_Object_lod_distance_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1505 Object *ob = (Object *)ptr->id.data;
1507 #ifdef WITH_GAMEENGINE
1508 BKE_object_lod_sort(ob);
1515 static void rna_def_vertex_group(BlenderRNA *brna)
1521 static EnumPropertyItem assign_mode_items[] = {
1522 {WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"},
1523 {WEIGHT_ADD, "ADD", 0, "Add", "Add"},
1524 {WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"},
1525 {0, NULL, 0, NULL, NULL}
1528 srna = RNA_def_struct(brna, "VertexGroup", NULL);
1529 RNA_def_struct_sdna(srna, "bDeformGroup");
1530 RNA_def_struct_ui_text(srna, "Vertex Group", "Group of vertices, used for armature deform and other purposes");
1531 RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
1533 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1534 RNA_def_property_ui_text(prop, "Name", "Vertex group name");
1535 RNA_def_struct_name_property(srna, prop);
1536 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_VertexGroup_name_set");
1537 /* update data because modifiers may use [#24761] */
1538 RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
1540 prop = RNA_def_property(srna, "lock_weight", PROP_BOOLEAN, PROP_NONE);
1541 RNA_def_property_ui_text(prop, "", "Maintain the relative weights for the group");
1542 RNA_def_property_boolean_sdna(prop, NULL, "flag", 0);
1543 /* update data because modifiers may use [#24761] */
1544 RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
1546 prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
1547 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1548 RNA_def_property_int_funcs(prop, "rna_VertexGroup_index_get", NULL, NULL);
1549 RNA_def_property_ui_text(prop, "Index", "Index number of the vertex group");
1551 func = RNA_def_function(srna, "add", "rna_VertexGroup_vertex_add");
1552 RNA_def_function_ui_description(func, "Add vertices to the group");
1553 RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
1554 /* TODO, see how array size of 0 works, this shouldnt be used */
1555 prop = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
1556 RNA_def_property_flag(prop, PROP_DYNAMIC | PROP_REQUIRED);
1557 prop = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
1558 RNA_def_property_flag(prop, PROP_REQUIRED);
1559 prop = RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode");
1560 RNA_def_property_flag(prop, PROP_REQUIRED);
1562 func = RNA_def_function(srna, "remove", "rna_VertexGroup_vertex_remove");
1563 RNA_def_function_ui_description(func, "Remove a vertex from the group");
1564 RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
1565 /* TODO, see how array size of 0 works, this shouldnt be used */
1566 prop = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
1567 RNA_def_property_flag(prop, PROP_DYNAMIC | PROP_REQUIRED);
1569 func = RNA_def_function(srna, "weight", "rna_VertexGroup_weight");
1570 RNA_def_function_ui_description(func, "Get a vertex weight from the group");
1571 RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
1572 prop = RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "The index of the vertex", 0, INT_MAX);
1573 RNA_def_property_flag(prop, PROP_REQUIRED);
1574 prop = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
1575 RNA_def_function_return(func, prop);
1578 static void rna_def_material_slot(BlenderRNA *brna)
1583 static EnumPropertyItem link_items[] = {
1584 {1, "OBJECT", 0, "Object", ""},
1585 {0, "DATA", 0, "Data", ""},
1586 {0, NULL, 0, NULL, NULL}
1589 /* NOTE: there is no MaterialSlot equivalent in DNA, so the internal
1590 * pointer data points to ob->mat + index, and we manually implement
1591 * get/set for the properties. */
1593 srna = RNA_def_struct(brna, "MaterialSlot", NULL);
1594 RNA_def_struct_ui_text(srna, "Material Slot", "Material slot in an object");
1595 RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
1597 prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
1598 RNA_def_property_struct_type(prop, "Material");
1599 RNA_def_property_flag(prop, PROP_EDITABLE);
1600 RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", "rna_MaterialSlot_material_set", NULL, NULL);
1601 RNA_def_property_ui_text(prop, "Material", "Material datablock used by this material slot");
1602 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
1604 prop = RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
1605 RNA_def_property_enum_items(prop, link_items);
1606 RNA_def_property_enum_funcs(prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL);
1607 RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data");
1608 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
1610 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1611 RNA_def_property_string_funcs(prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL);
1612 RNA_def_property_ui_text(prop, "Name", "Material slot name");
1613 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1614 RNA_def_struct_name_property(srna, prop);
1616 RNA_def_struct_path_func(srna, "rna_MaterialSlot_path");
1619 static void rna_def_object_game_settings(BlenderRNA *brna)
1624 static EnumPropertyItem body_type_items[] = {
1625 {OB_BODY_TYPE_NO_COLLISION, "NO_COLLISION", 0, "No Collision", "Disable collision for this object"},
1626 {OB_BODY_TYPE_STATIC, "STATIC", 0, "Static", "Stationary object"},
1627 {OB_BODY_TYPE_DYNAMIC, "DYNAMIC", 0, "Dynamic", "Linear physics"},
1628 {OB_BODY_TYPE_RIGID, "RIGID_BODY", 0, "Rigid Body", "Linear and angular physics"},
1629 {OB_BODY_TYPE_SOFT, "SOFT_BODY", 0, "Soft Body", "Soft body"},
1630 {OB_BODY_TYPE_OCCLUDER, "OCCLUDER", 0, "Occluder", "Occluder for optimizing scene rendering"},
1631 {OB_BODY_TYPE_SENSOR, "SENSOR", 0, "Sensor",
1632 "Collision Sensor, detects static and dynamic objects but not the other "
1633 "collision sensor objects"},
1634 {OB_BODY_TYPE_NAVMESH, "NAVMESH", 0, "Navigation Mesh", "Navigation mesh"},
1635 {OB_BODY_TYPE_CHARACTER, "CHARACTER", 0, "Character",
1636 "Simple kinematic physics appropriate for game characters"},
1637 {0, NULL, 0, NULL, NULL}
1640 srna = RNA_def_struct(brna, "GameObjectSettings", NULL);
1641 RNA_def_struct_sdna(srna, "Object");
1642 RNA_def_struct_nested(brna, srna, "Object");
1643 RNA_def_struct_ui_text(srna, "Game Object Settings", "Game engine related settings for the object");
1644 RNA_def_struct_ui_icon(srna, ICON_GAME);
1648 prop = RNA_def_property(srna, "sensors", PROP_COLLECTION, PROP_NONE);
1649 RNA_def_property_struct_type(prop, "Sensor");
1650 RNA_def_property_ui_text(prop, "Sensors", "Game engine sensor to detect events");
1652 prop = RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE);
1653 RNA_def_property_struct_type(prop, "Controller");
1654 RNA_def_property_ui_text(prop, "Controllers",
1655 "Game engine controllers to process events, connecting sensors to actuators");
1657 prop = RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE);
1658 RNA_def_property_struct_type(prop, "Actuator");
1659 RNA_def_property_ui_text(prop, "Actuators", "Game engine actuators to act on events");
1661 prop = RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
1662 RNA_def_property_collection_sdna(prop, NULL, "prop", NULL);
1663 RNA_def_property_struct_type(prop, "GameProperty"); /* rna_property.c */
1664 RNA_def_property_ui_text(prop, "Properties", "Game engine properties");
1666 prop = RNA_def_property(srna, "show_sensors", PROP_BOOLEAN, PROP_NONE);
1667 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWSENS);
1668 RNA_def_property_ui_text(prop, "Show Sensors", "Shows sensors for this object in the user interface");
1670 prop = RNA_def_property(srna, "show_controllers", PROP_BOOLEAN, PROP_NONE);
1671 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWCONT);
1672 RNA_def_property_ui_text(prop, "Show Controllers", "Shows controllers for this object in the user interface");
1674 prop = RNA_def_property(srna, "show_actuators", PROP_BOOLEAN, PROP_NONE);
1675 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWACT);
1676 RNA_def_property_ui_text(prop, "Show Actuators", "Shows actuators for this object in the user interface");
1680 prop = RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
1681 RNA_def_property_enum_sdna(prop, NULL, "body_type");
1682 RNA_def_property_enum_items(prop, body_type_items);
1683 RNA_def_property_enum_default(prop, OB_BODY_TYPE_STATIC);
1684 RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get",
1685 "rna_GameObjectSettings_physics_type_set", NULL);
1686 RNA_def_property_ui_text(prop, "Physics Type", "Select the type of physical representation");
1687 RNA_def_property_update(prop, NC_LOGIC, NULL);
1689 prop = RNA_def_property(srna, "use_record_animation", PROP_BOOLEAN, PROP_NONE);
1690 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_RECORD_ANIMATION);
1691 RNA_def_property_ui_text(prop, "Record Animation", "Record animation objects without physics");
1693 prop = RNA_def_property(srna, "use_actor", PROP_BOOLEAN, PROP_NONE);
1694 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ACTOR);
1695 RNA_def_property_ui_text(prop, "Actor", "Object is detected by the Near and Radar sensor");
1697 prop = RNA_def_property(srna, "use_ghost", PROP_BOOLEAN, PROP_NONE);
1698 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_GHOST);
1699 RNA_def_property_ui_text(prop, "Ghost", "Object does not react to collisions, like a ghost");
1701 prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
1702 RNA_def_property_range(prop, 0.01, 10000.0);
1703 RNA_def_property_float_default(prop, 1.0f);
1704 RNA_def_property_ui_text(prop, "Mass", "Mass of the object");
1706 prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
1707 RNA_def_property_float_sdna(prop, NULL, "inertia");
1708 RNA_def_property_range(prop, 0.01f, FLT_MAX);
1709 RNA_def_property_ui_range(prop, 0.01f, 10.0f, 1, 3);
1710 RNA_def_property_float_default(prop, 1.0f);
1711 RNA_def_property_ui_text(prop, "Radius", "Radius of bounding sphere and material physics");
1712 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
1714 prop = RNA_def_property(srna, "use_sleep", PROP_BOOLEAN, PROP_NONE);
1715 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_COLLISION_RESPONSE);
1716 RNA_def_property_ui_text(prop, "No Sleeping", "Disable auto (de)activation in physics simulation");
1718 prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
1719 RNA_def_property_float_sdna(prop, NULL, "damping");
1720 RNA_def_property_range(prop, 0.0, 1.0);
1721 RNA_def_property_float_default(prop, 0.04f);
1722 RNA_def_property_ui_text(prop, "Damping", "General movement damping");
1724 prop = RNA_def_property(srna, "rotation_damping", PROP_FLOAT, PROP_NONE);
1725 RNA_def_property_float_sdna(prop, NULL, "rdamping");
1726 RNA_def_property_range(prop, 0.0, 1.0);
1727 RNA_def_property_float_default(prop, 0.1f);
1728 RNA_def_property_ui_text(prop, "Rotation Damping", "General rotation damping");
1730 prop = RNA_def_property(srna, "velocity_min", PROP_FLOAT, PROP_DISTANCE);
1731 RNA_def_property_float_sdna(prop, NULL, "min_vel");
1732 RNA_def_property_range(prop, 0.0, 1000.0);
1733 RNA_def_property_ui_text(prop, "Velocity Min", "Clamp velocity to this minimum speed (except when totally still), "
1734 "in distance per second");
1736 prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_DISTANCE);
1737 RNA_def_property_float_sdna(prop, NULL, "max_vel");
1738 RNA_def_property_range(prop, 0.0, 1000.0);
1739 RNA_def_property_ui_text(prop, "Velocity Max", "Clamp velocity to this maximum speed, "
1740 "in distance per second");
1742 prop = RNA_def_property(srna, "angular_velocity_min", PROP_FLOAT, PROP_ANGLE);
1743 RNA_def_property_float_sdna(prop, NULL, "min_angvel");
1744 RNA_def_property_range(prop, 0.0, 1000.0);
1745 RNA_def_property_ui_text(prop, "Angular Velocity Min",
1746 "Clamp angular velocity to this minimum speed (except when totally still), "
1747 "in angle per second");
1749 prop = RNA_def_property(srna, "angular_velocity_max", PROP_FLOAT, PROP_ANGLE);
1750 RNA_def_property_float_sdna(prop, NULL, "max_angvel");
1751 RNA_def_property_range(prop, 0.0, 1000.0);
1752 RNA_def_property_ui_text(prop, "Angular Velocity Max", "Clamp angular velocity to this maximum speed, "
1753 "in angle per second");
1755 /* Character physics */
1756 prop = RNA_def_property(srna, "step_height", PROP_FLOAT, PROP_NONE);
1757 RNA_def_property_float_sdna(prop, NULL, "step_height");
1758 RNA_def_property_range(prop, 0.01, 1.0);
1759 RNA_def_property_float_default(prop, 0.15f);
1760 RNA_def_property_ui_text(prop, "Step Height", "Maximum height of steps the character can run over");
1762 prop = RNA_def_property(srna, "jump_speed", PROP_FLOAT, PROP_NONE);
1763 RNA_def_property_float_sdna(prop, NULL, "jump_speed");
1764 RNA_def_property_range(prop, 0.0, 1000.0);
1765 RNA_def_property_float_default(prop, 10.0f);
1766 RNA_def_property_ui_text(prop, "Jump Force", "Upward velocity applied to the character when jumping");
1768 prop = RNA_def_property(srna, "fall_speed", PROP_FLOAT, PROP_NONE);
1769 RNA_def_property_float_sdna(prop, NULL, "fall_speed");
1770 RNA_def_property_range(prop, 0.0, 1000.0);
1771 RNA_def_property_float_default(prop, 55.0f);
1772 RNA_def_property_ui_text(prop, "Fall Speed Max", "Maximum speed at which the character will fall");
1774 /* Collision Masks */
1775 prop = RNA_def_property(srna, "collision_group", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1776 RNA_def_property_boolean_sdna(prop, NULL, "col_group", 1);
1777 RNA_def_property_array(prop, OB_MAX_COL_MASKS);
1778 RNA_def_property_ui_text(prop, "Collision Group", "The collision group of the object");
1779 RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_col_group_get", "rna_GameObjectSettings_col_group_set");
1781 prop = RNA_def_property(srna, "collision_mask", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1782 RNA_def_property_boolean_sdna(prop, NULL, "col_mask", 1);
1783 RNA_def_property_array(prop, OB_MAX_COL_MASKS);
1784 RNA_def_property_ui_text(prop, "Collision Mask", "The groups this object can collide with");
1785 RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_col_mask_get", "rna_GameObjectSettings_col_mask_set");
1788 prop = RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
1789 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_AXIS);
1790 RNA_def_property_ui_text(prop, "Lock X Axis", "Disable simulation of linear motion along the X axis");
1792 prop = RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE);
1793 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_AXIS);
1794 RNA_def_property_ui_text(prop, "Lock Y Axis", "Disable simulation of linear motion along the Y axis");
1796 prop = RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE);
1797 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_AXIS);
1798 RNA_def_property_ui_text(prop, "Lock Z Axis", "Disable simulation of linear motion along the Z axis");
1802 prop = RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
1803 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_ROT_AXIS);
1804 RNA_def_property_ui_text(prop, "Lock X Rotation Axis", "Disable simulation of angular motion along the X axis");
1806 prop = RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
1807 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_ROT_AXIS);
1808 RNA_def_property_ui_text(prop, "Lock Y Rotation Axis", "Disable simulation of angular motion along the Y axis");
1810 prop = RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
1811 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_ROT_AXIS);
1812 RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis");
1814 /* is this used anywhere ? */
1815 prop = RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
1816 RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflag2", OB_NEVER_DO_ACTIVITY_CULLING);
1817 RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis");
1820 prop = RNA_def_property(srna, "use_material_physics_fh", PROP_BOOLEAN, PROP_NONE);
1821 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_DO_FH);
1822 RNA_def_property_ui_text(prop, "Use Material Force Field", "React to force field physics settings in materials");
1824 prop = RNA_def_property(srna, "use_rotate_from_normal", PROP_BOOLEAN, PROP_NONE);
1825 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ROT_FH);
1826 RNA_def_property_ui_text(prop, "Rotate From Normal",
1827 "Use face normal to rotate object, so that it points away from the surface");
1829 prop = RNA_def_property(srna, "form_factor", PROP_FLOAT, PROP_NONE);
1830 RNA_def_property_float_sdna(prop, NULL, "formfactor");
1831 RNA_def_property_range(prop, 0.0, 1.0);
1832 RNA_def_property_float_default(prop, 0.4f);
1833 RNA_def_property_ui_text(prop, "Form Factor", "Form factor scales the inertia tensor");
1835 prop = RNA_def_property(srna, "use_anisotropic_friction", PROP_BOOLEAN, PROP_NONE);
1836 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ANISOTROPIC_FRICTION);
1837 RNA_def_property_ui_text(prop, "Anisotropic Friction", "Enable anisotropic friction");
1839 prop = RNA_def_property(srna, "friction_coefficients", PROP_FLOAT, PROP_XYZ);
1840 RNA_def_property_float_sdna(prop, NULL, "anisotropicFriction");
1841 RNA_def_property_range(prop, 0.0, 1.0);
1842 RNA_def_property_ui_text(prop, "Friction Coefficients",
1843 "Relative friction coefficients in the in the X, Y and Z directions, "
1844 "when anisotropic friction is enabled");
1846 prop = RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE);
1847 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_BOUNDS);
1848 RNA_def_property_ui_text(prop, "Use Collision Bounds", "Specify a collision bounds type other than the default");
1849 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
1851 prop = RNA_def_property(srna, "collision_bounds_type", PROP_ENUM, PROP_NONE);
1852 RNA_def_property_enum_sdna(prop, NULL, "collision_boundtype");
1853 RNA_def_property_enum_items(prop, collision_bounds_items);
1854 RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Object_collision_bounds_itemf");
1855 RNA_def_property_ui_text(prop, "Collision Shape", "Select the collision shape that better fits the object");
1856 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
1858 prop = RNA_def_property(srna, "use_collision_compound", PROP_BOOLEAN, PROP_NONE);
1859 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_CHILD);
1860 RNA_def_property_ui_text(prop, "Collision Compound", "Add children to form a compound collision object");
1862 prop = RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
1863 RNA_def_property_float_sdna(prop, NULL, "margin");
1864 RNA_def_property_range(prop, 0.0, 1.0);
1865 RNA_def_property_float_default(prop, 0.04f);
1866 RNA_def_property_ui_text(prop, "Collision Margin",
1867 "Extra margin around object for collision detection, small amount required "
1870 prop = RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
1871 RNA_def_property_pointer_sdna(prop, NULL, "bsoft");
1872 RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for Bullet soft body simulation");
1874 prop = RNA_def_property(srna, "use_obstacle_create", PROP_BOOLEAN, PROP_NONE);
1875 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_HASOBSTACLE);
1876 RNA_def_property_ui_text(prop, "Create obstacle", "Create representation for obstacle simulation");
1878 prop = RNA_def_property(srna, "obstacle_radius", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
1879 RNA_def_property_float_sdna(prop, NULL, "obstacleRad");
1880 RNA_def_property_range(prop, 0.0, 1000.0);
1881 RNA_def_property_float_default(prop, 1.0f);
1882 RNA_def_property_ui_text(prop, "Obstacle Radius", "Radius of object representation in obstacle simulation");
1886 prop = RNA_def_property(srna, "states_visible", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1887 RNA_def_property_boolean_sdna(prop, NULL, "state", 1);
1888 RNA_def_property_array(prop, OB_MAX_STATES);
1889 RNA_def_property_ui_text(prop, "State", "State determining which controllers are displayed");
1890 RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_state_get", "rna_GameObjectSettings_state_set");
1892 prop = RNA_def_property(srna, "used_states", PROP_BOOLEAN, PROP_LAYER_MEMBER);
1893 RNA_def_property_array(prop, OB_MAX_STATES);
1894 RNA_def_property_ui_text(prop, "Used State", "States which are being used by controllers");
1895 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1896 RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_used_state_get", NULL);
1898 prop = RNA_def_property(srna, "states_initial", PROP_BOOLEAN, PROP_NONE);
1899 RNA_def_property_boolean_sdna(prop, NULL, "init_state", 1);
1900 RNA_def_property_array(prop, OB_MAX_STATES);
1901 RNA_def_property_ui_text(prop, "Initial State", "Initial state when the game starts");
1903 prop = RNA_def_property(srna, "show_debug_state", PROP_BOOLEAN, PROP_NONE);
1904 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_DEBUGSTATE);
1905 RNA_def_property_ui_text(prop, "Debug State", "Print state debug info in the game engine");
1906 RNA_def_property_ui_icon(prop, ICON_INFO, 0);
1908 prop = RNA_def_property(srna, "use_all_states", PROP_BOOLEAN, PROP_NONE);
1909 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_ALLSTATE);
1910 RNA_def_property_ui_text(prop, "All", "Set all state bits");
1912 prop = RNA_def_property(srna, "show_state_panel", PROP_BOOLEAN, PROP_NONE);
1913 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWSTATE);
1914 RNA_def_property_ui_text(prop, "States", "Show state panel");
1915 RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
1918 static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop)
1926 RNA_def_property_srna(cprop, "ObjectConstraints");
1927 srna = RNA_def_struct(brna, "ObjectConstraints", NULL);
1928 RNA_def_struct_sdna(srna, "Object");
1929 RNA_def_struct_ui_text(srna, "Object Constraints", "Collection of object constraints");
1932 /* Collection active property */
1933 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1934 RNA_def_property_struct_type(prop, "Constraint");
1935 RNA_def_property_pointer_funcs(prop, "rna_Object_active_constraint_get",
1936 "rna_Object_active_constraint_set", NULL, NULL);
1937 RNA_def_property_flag(prop, PROP_EDITABLE);
1938 RNA_def_property_ui_text(prop, "Active Constraint", "Active Object constraint");
1941 /* Constraint collection */
1942 func = RNA_def_function(srna, "new", "rna_Object_constraints_new");
1943 RNA_def_function_ui_description(func, "Add a new constraint to this object");
1945 parm = RNA_def_enum(func, "type", constraint_type_items, 1, "", "Constraint type to add");
1946 RNA_def_property_flag(parm, PROP_REQUIRED);
1948 parm = RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
1949 RNA_def_function_return(func, parm);
1951 func = RNA_def_function(srna, "remove", "rna_Object_constraints_remove");
1952 RNA_def_function_ui_description(func, "Remove a constraint from this object");
1953 RNA_def_function_flag(func, FUNC_USE_REPORTS);
1954 /* constraint to remove */
1955 parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
1956 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
1957 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
1959 func = RNA_def_function(srna, "clear", "rna_Object_constraints_clear");
1960 RNA_def_function_ui_description(func, "Remove all constraint from this object");
1963 /* object.modifiers */
1964 static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
1971 RNA_def_property_srna(cprop, "ObjectModifiers");
1972 srna = RNA_def_struct(brna, "ObjectModifiers", NULL);
1973 RNA_def_struct_sdna(srna, "Object");
1974 RNA_def_struct_ui_text(srna, "Object Modifiers", "Collection of object modifiers");
1977 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1978 RNA_def_property_struct_type(prop, "EditBone");
1979 RNA_def_property_pointer_sdna(prop, NULL, "act_edbone");
1980 RNA_def_property_flag(prop, PROP_EDITABLE);
1981 RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone");
1982 /*RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update"); */
1983 RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_edit_bone_set", NULL, NULL);
1986 /* RNA_def_property_collection_active(prop, prop_act); */
1990 func = RNA_def_function(srna, "new", "rna_Object_modifier_new");
1991 RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
1992 RNA_def_function_ui_description(func, "Add a new modifier");
1993 parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the modifier");
1994 RNA_def_property_flag(parm, PROP_REQUIRED);
1995 /* modifier to add */
1996 parm = RNA_def_enum(func, "type", modifier_type_items, 1, "", "Modifier type to add");
1997 RNA_def_property_flag(parm, PROP_REQUIRED);
1999 parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Newly created modifier");
2000 RNA_def_function_return(func, parm);
2002 /* remove modifier */
2003 func = RNA_def_function(srna, "remove", "rna_Object_modifier_remove");
2004 RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
2005 RNA_def_function_ui_description(func, "Remove an existing modifier from the object");
2006 /* modifier to remove */
2007 parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Modifier to remove");
2008 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
2009 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
2011 /* clear all modifiers */
2012 func = RNA_def_function(srna, "clear", "rna_Object_modifier_clear");
2013 RNA_def_function_flag(func, FUNC_USE_CONTEXT);
2014 RNA_def_function_ui_description(func, "Remove all modifiers from the object");
2017 /* object.particle_systems */
2018 static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop)
2024 /* FunctionRNA *func; */
2025 /* PropertyRNA *parm; */
2027 RNA_def_property_srna(cprop, "ParticleSystems");
2028 srna = RNA_def_struct(brna, "ParticleSystems", NULL);
2029 RNA_def_struct_sdna(srna, "Object");
2030 RNA_def_struct_ui_text(srna, "Particle Systems", "Collection of particle systems");
2032 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2033 RNA_def_property_struct_type(prop, "ParticleSystem");
2034 RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL, NULL);
2035 RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed");
2036 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2038 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2039 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2040 RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get",
2041 "rna_Object_active_particle_system_index_set",
2042 "rna_Object_active_particle_system_index_range");
2043 RNA_def_property_ui_text(prop, "Active Particle System Index", "Index of active particle system slot");
2044 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_particle_update");
2048 /* object.vertex_groups */
2049 static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
2058 RNA_def_property_srna(cprop, "VertexGroups");
2059 srna = RNA_def_struct(brna, "VertexGroups", NULL);
2060 RNA_def_struct_sdna(srna, "Object");
2061 RNA_def_struct_ui_text(srna, "Vertex Groups", "Collection of vertex groups");
2063 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2064 RNA_def_property_struct_type(prop, "VertexGroup");
2065 RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get",
2066 "rna_Object_active_vertex_group_set", NULL, NULL);
2067 RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object");
2068 RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
2070 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
2071 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2072 RNA_def_property_int_sdna(prop, NULL, "actdef");
2073 RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get",
2074 "rna_Object_active_vertex_group_index_set",
2075 "rna_Object_active_vertex_group_index_range");
2076 RNA_def_property_ui_text(prop, "Active Vertex Group Index", "Active index in vertex group array");
2077 RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
2079 /* vertex groups */ /* add_vertex_group */
2080 func = RNA_def_function(srna, "new", "rna_Object_vgroup_new");
2081 RNA_def_function_ui_description(func, "Add vertex group to object");
2082 RNA_def_string(func, "name", "Group", 0, "", "Vertex group name"); /* optional */
2083 parm = RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group");
2084 RNA_def_function_return(func, parm);
2086 func = RNA_def_function(srna, "remove", "rna_Object_vgroup_remove");
2087 RNA_def_function_flag(func, FUNC_USE_REPORTS);
2088 RNA_def_function_ui_description(func, "Delete vertex group from object");
2089 parm = RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to remove");
2090 RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR);
2091 RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
2093 func = RNA_def_function(srna, "clear", "rna_Object_vgroup_clear");
2094 RNA_def_function_ui_description(func, "Delete all vertex groups from object");
2098 static void rna_def_object_lodlevel(BlenderRNA *brna)
2103 srna = RNA_def_struct(brna, "LodLevel", NULL);
2104 RNA_def_struct_sdna(srna, "LodLevel");
2106 prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
2107 RNA_def_property_float_sdna(prop, NULL, "distance");
2108 RNA_def_property_range(prop, 0.0, FLT_MAX);
2109 RNA_def_property_ui_text(prop, "Distance", "Distance to begin using this level of detail");
2110 RNA_def_property_update(prop, NC_OBJECT | ND_LOD, "rna_Object_lod_distance_update");
2112 prop = RNA_def_property(srna, "object_hysteresis_percentage", PROP_INT, PROP_PERCENTAGE);
2113 RNA_def_property_int_sdna(prop, NULL, "obhysteresis");
2114 RNA_def_property_range(prop, 0, 100);
2115 RNA_def_property_ui_range(prop, 0, 100, 10, 1);
2116 RNA_def_property_ui_text(prop, "Hysteresis %",
2117 "Minimum distance change required to transition to the previous level of detail");
2118 RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL);
2120 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2121 RNA_def_property_pointer_sdna(prop, NULL, "source");
2122 RNA_def_property_struct_type(prop, "Object");
2123 RNA_def_property_flag(prop, PROP_EDITABLE);
2124 RNA_def_property_ui_text(prop, "Object", "Object to use for this level of detail");
2125 RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL);
2127 prop = RNA_def_property(srna, "use_mesh", PROP_BOOLEAN, PROP_NONE);
2128 RNA_def_property_boolean_sdna(prop, NULL, "flags", OB_LOD_USE_MESH);
2129 RNA_def_property_ui_text(prop, "Use Mesh", "Use the mesh from this object at this level of detail");
2130 RNA_def_property_ui_icon(prop, ICON_MESH_DATA, 0);
2131 RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL);
2133 prop = RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE);
2134 RNA_def_property_boolean_sdna(prop, NULL, "flags", OB_LOD_USE_MAT);
2135 RNA_def_property_ui_text(prop, "Use Material", "Use the material from this object at this level of detail");
2136 RNA_def_property_ui_icon(prop, ICON_MATERIAL, 0);
2137 RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL);
2139 prop = RNA_def_property(srna, "use_object_hysteresis", PROP_BOOLEAN, PROP_NONE);
2140 RNA_def_property_boolean_sdna(prop, NULL, "flags", OB_LOD_USE_HYST);
2141 RNA_def_property_ui_text(prop, "Hysteresis Override", "Override LoD Hysteresis scene setting for this LoD level");
2142 RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL);
2146 static void rna_def_object(BlenderRNA *brna)
2151 static EnumPropertyItem up_items[] = {
2152 {OB_POSX, "X", 0, "X", ""},
2153 {OB_POSY, "Y", 0, "Y", ""},
2154 {OB_POSZ, "Z", 0, "Z", ""},
2155 {0, NULL, 0, NULL, NULL}
2158 static EnumPropertyItem drawtype_items[] = {
2159 {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Draw the bounds of the object"},
2160 {OB_WIRE, "WIRE", 0, "Wire", "Draw the object as a wireframe"},
2161 {OB_SOLID, "SOLID", 0, "Solid", "Draw the object as a solid (if solid drawing is enabled in the viewport)"},
2162 {OB_TEXTURE, "TEXTURED", 0, "Textured",
2163 "Draw the object with textures (if textures are enabled in the viewport)"},
2164 {0, NULL, 0, NULL, NULL}
2167 static EnumPropertyItem boundtype_items[] = {
2168 {OB_BOUND_BOX, "BOX", 0, "Box", "Draw bounds as box"},
2169 {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", "Draw bounds as sphere"},
2170 {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Draw bounds as cylinder"},
2171 {OB_BOUND_CONE, "CONE", 0, "Cone", "Draw bounds as cone"},
2172 {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", "Draw bounds as capsule"},
2173 {0, NULL, 0, NULL, NULL}
2177 /* XXX: this RNA enum define is currently duplicated for objects,
2178 * since there is some text here which is not applicable */
2179 static EnumPropertyItem prop_rotmode_items[] = {
2180 {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock"},
2181 {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order - prone to Gimbal Lock (default)"},
2182 {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order - prone to Gimbal Lock"},
2183 {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order - prone to Gimbal Lock"},
2184 {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order - prone to Gimbal Lock"},
2185 {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order - prone to Gimbal Lock"},
2186 {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order - prone to Gimbal Lock"},
2187 {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle",
2188 "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"},
2189 {0, NULL, 0, NULL, NULL}
2192 static float default_quat[4] = {1, 0, 0, 0}; /* default quaternion values */
2193 static float default_axisAngle[4] = {0, 0, 1, 0}; /* default axis-angle rotation values */
2194 static float default_scale[3] = {1, 1, 1}; /* default scale values */
2195 static int boundbox_dimsize[] = {8, 3};
2197 srna = RNA_def_struct(brna, "Object", "ID");
2198 RNA_def_struct_ui_text(srna, "Object", "Object datablock defining an object in a scene");
2199 RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
2200 RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
2202 prop = RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
2203 RNA_def_property_struct_type(prop, "ID");
2204 RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_data_set", "rna_Object_data_typef", NULL);
2205 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
2206 RNA_def_property_ui_text(prop, "Data", "Object data");
2207 RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
2209 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2210 RNA_def_property_enum_sdna(prop, NULL, "type");
2211 RNA_def_property_enum_items(prop, object_type_items);
2212 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2213 RNA_def_property_ui_text(prop, "Type", "Type of Object");
2215 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
2216 RNA_def_property_enum_sdna(prop, NULL, "mode");
2217 RNA_def_property_enum_items(prop, object_mode_items);
2218 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2219 RNA_def_property_ui_text(prop, "Mode", "Object interaction mode");
2221 prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
2222 RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
2223 RNA_def_property_array(prop, 20);
2224 RNA_def_property_ui_text(prop, "Layers", "Layers the object is on");
2225 RNA_def_property_boolean_funcs(prop, NULL, "rna_Object_layer_set");
2226 RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
2227 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_layer_update");
2228 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2230 prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER);
2231 RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000);
2232 RNA_def_property_array(prop, 8);
2233 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2234 RNA_def_property_ui_text(prop, "Local View Layers", "3D local view layers the object is on");
2236 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
2237 RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
2238 RNA_def_property_ui_text(prop, "Select", "Object selection state");
2239 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_select_update");
2241 /* for data access */
2242 prop = RNA_def_property(srna, "bound_box", PROP_FLOAT, PROP_NONE);
2243 RNA_def_property_multi_array(prop, 2, boundbox_dimsize);
2244 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2245 RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL);
2246 RNA_def_property_ui_text(prop, "Bounding Box",
2247 "Object's bounding box in object-space coordinates, all values are -1.0 when "
2251 prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
2252 RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_parent_set", NULL, NULL);
2253 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2254 RNA_def_property_ui_text(prop, "Parent", "Parent Object");
2255 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
2257 prop = RNA_def_property(srna, "parent_type", PROP_ENUM, PROP_NONE);
2258 RNA_def_property_enum_bitflag_sdna(prop, NULL, "partype");
2259 RNA_def_property_enum_items(prop, parent_type_items);
2260 RNA_def_property_enum_funcs(prop, NULL, "rna_Object_parent_type_set", "rna_Object_parent_type_itemf");
2261 RNA_def_property_ui_text(prop, "Parent Type", "Type of parent relation");
2262 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
2264 prop = RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED);
2265 RNA_def_property_int_sdna(prop, NULL, "par1");
2266 RNA_def_property_array(prop, 3);
2267 RNA_def_property_ui_text(prop, "Parent Vertices", "Indices of vertices in case of a vertex parenting relation");
2268 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
2270 prop = RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
2271 RNA_def_property_string_sdna(prop, NULL, "parsubstr");
2272 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Object_parent_bone_set");
2273 RNA_def_property_ui_text(prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation");
2274 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
2276 /* Track and Up flags */
2277 /* XXX: these have been saved here for a bit longer (after old track was removed),
2278 * since some other tools still refer to this */
2279 prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
2280 RNA_def_property_enum_sdna(prop, NULL, "trackflag");
2281 RNA_def_property_enum_items(prop, object_axis_items);
2282 RNA_def_property_ui_text(prop, "Track Axis",
2283 "Axis that points in 'forward' direction (applies to DupliFrame when "
2284 "parent 'Follow' is enabled)");
2285 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
2287 prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
2288 RNA_def_property_enum_sdna(prop, NULL, "upflag");
2289 RNA_def_property_enum_items(prop, up_items);
2290 RNA_def_property_ui_text(prop, "Up Axis",
2291 "Axis that points in the upward direction (applies to DupliFrame when "
2292 "parent 'Follow' is enabled)");
2293 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
2296 prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
2297 RNA_def_property_ui_text(prop, "Proxy", "Library object this proxy object controls");
2299 prop = RNA_def_property(srna, "proxy_group", PROP_POINTER, PROP_NONE);
2300 RNA_def_property_ui_text(prop, "Proxy Group", "Library group duplicator object this proxy object controls");
2303 prop = RNA_def_property(srna, "material_slots", PROP_COLLECTION, PROP_NONE);
2304 RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
2305 RNA_def_property_struct_type(prop, "MaterialSlot");
2306 /* don't dereference pointer! */
2307 RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL, NULL);
2308 RNA_def_property_ui_text(prop, "Material Slots", "Material slots in the object");
2310 prop = RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
2311 RNA_def_property_struct_type(prop, "Material");
2312 RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get",
2313 "rna_Object_active_material_set", NULL, NULL);
2314 RNA_def_property_flag(prop, PROP_EDITABLE);
2315 RNA_def_property_editable_func(prop, "rna_Object_active_material_editable");
2316 RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed");
2317 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
2319 prop = RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
2320 RNA_def_property_int_sdna(prop, NULL, "actcol");
2321 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2322 RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set",
2323 "rna_Object_active_material_index_range");
2324 RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot");
2325 RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, NULL);
2328 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
2329 RNA_def_property_float_sdna(prop, NULL, "loc");
2330 RNA_def_property_editable_array_func(prop, "rna_Object_location_editable");
2331 RNA_def_property_ui_text(prop, "Location", "Location of the object");
2332 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
2333 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2335 prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
2336 RNA_def_property_float_sdna(prop, NULL, "quat");
2337 RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
2338 RNA_def_property_float_array_default(prop, default_quat);
2339 RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
2340 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2342 /* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
2343 * having a single one is better for Keyframing and other property-management situations...
2345 prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
2346 RNA_def_property_array(prop, 4);
2347 RNA_def_property_float_funcs(prop, "rna_Object_rotation_axis_angle_get",
2348 "rna_Object_rotation_axis_angle_set", NULL);
2349 RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
2350 RNA_def_property_float_array_default(prop, default_axisAngle);
2351 RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
2352 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2354 prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
2355 RNA_def_property_float_sdna(prop, NULL, "rot");
2356 RNA_def_property_editable_array_func(prop, "rna_Object_rotation_euler_editable");
2357 RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
2358 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2360 prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
2361 RNA_def_property_enum_sdna(prop, NULL, "rotmode");
2362 RNA_def_property_enum_items(prop, prop_rotmode_items); /* XXX move to using a single define of this someday */
2363 RNA_def_property_enum_funcs(prop, NULL, "rna_Object_rotation_mode_set", NULL);
2364 RNA_def_property_ui_text(prop, "Rotation Mode", "");
2365 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2367 prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
2368 RNA_def_property_float_sdna(prop, NULL, "size");
2369 RNA_def_property_flag(prop, PROP_PROPORTIONAL);
2370 RNA_def_property_editable_array_func(prop, "rna_Object_scale_editable");
2371 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
2372 RNA_def_property_float_array_default(prop, default_scale);
2373 RNA_def_property_ui_text(prop, "Scale", "Scaling of the object");
2374 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2376 prop = RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
2377 RNA_def_property_array(prop, 3);
2378 RNA_def_property_float_funcs(prop, "rna_Object_dimensions_get", "rna_Object_dimensions_set", NULL);
2379 RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3);
2380 RNA_def_property_ui_text(prop, "Dimensions", "Absolute bounding box dimensions of the object");
2381 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2384 /* delta transforms */
2385 prop = RNA_def_property(srna, "delta_location", PROP_FLOAT, PROP_TRANSLATION);
2386 RNA_def_property_float_sdna(prop, NULL, "dloc");
2387 RNA_def_property_ui_text(prop, "Delta Location", "Extra translation added to the location of the object");
2388 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
2389 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2391 prop = RNA_def_property(srna, "delta_rotation_euler", PROP_FLOAT, PROP_EULER);
2392 RNA_def_property_float_sdna(prop, NULL, "drot");
2393 RNA_def_property_ui_text(prop, "Delta Rotation (Euler)",
2394 "Extra rotation added to the rotation of the object (when using Euler rotations)");
2395 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2397 prop = RNA_def_property(srna, "delta_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
2398 RNA_def_property_float_sdna(prop, NULL, "dquat");
2399 RNA_def_property_float_array_default(prop, default_quat);
2400 RNA_def_property_ui_text(prop, "Delta Rotation (Quaternion)",
2401 "Extra rotation added to the rotation of the object (when using Quaternion rotations)");
2402 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2404 #if 0 /* XXX not supported well yet... */
2405 prop = RNA_def_property(srna, "delta_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
2406 /* FIXME: this is not a single field any more! (drotAxis and drotAngle) */
2407 RNA_def_property_float_sdna(prop, NULL, "dquat");
2408 RNA_def_property_float_array_default(prop, default_axisAngle);
2409 RNA_def_property_ui_text(prop, "Delta Rotation (Axis Angle)",
2410 "Extra rotation added to the rotation of the object (when using Axis-Angle rotations)");
2411 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2414 prop = RNA_def_property(srna, "delta_scale", PROP_FLOAT, PROP_XYZ);
2415 RNA_def_property_float_sdna(prop, NULL, "dscale");
2416 RNA_def_property_flag(prop, PROP_PROPORTIONAL);
2417 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
2418 RNA_def_property_float_array_default(prop, default_scale);
2419 RNA_def_property_ui_text(prop, "Delta Scale", "Extra scaling added to the scale of the object");
2420 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2422 /* transform locks */
2423 prop = RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_NONE);
2424 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX);
2425 RNA_def_property_array(prop, 3);
2426 RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location in the interface");
2427 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
2428 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2430 prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
2431 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX);
2432 RNA_def_property_array(prop, 3);
2433 RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation in the interface");
2434 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
2435 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2437 /* XXX this is sub-optimal - it really should be included above,
2438 * but due to technical reasons we can't do this! */
2439 prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
2440 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW);
2441 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
2442 RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)",
2443 "Lock editing of 'angle' component of four-component rotations in the interface");
2444 /* XXX this needs a better name */
2445 prop = RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
2446 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D);
2447 RNA_def_property_ui_text(prop, "Lock Rotations (4D)",
2448 "Lock editing of four component rotations by components (instead of as Eulers)");
2450 prop = RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_NONE);
2451 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX);
2452 RNA_def_property_array(prop, 3);
2453 RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface");
2454 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
2455 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2458 prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
2459 RNA_def_property_float_sdna(prop, NULL, "obmat");
2460 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2461 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2462 RNA_def_property_ui_text(prop, "Matrix World", "Worldspace transformation matrix");
2463 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_matrix_world_update");
2465 prop = RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
2466 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2467 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2468 RNA_def_property_ui_text(prop, "Local Matrix", "Parent relative transformation matrix - "
2469 "WARNING: Only takes into account 'Object' parenting, so e.g. in case of bone parenting "
2470 "you get a matrix relative to the Armature object, not to the actual parent bone");
2471 RNA_def_property_float_funcs(prop, "rna_Object_matrix_local_get", "rna_Object_matrix_local_set", NULL);
2472 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, NULL);
2474 prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
2475 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2476 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2477 RNA_def_property_ui_text(prop, "Input Matrix",
2478 "Matrix access to location, rotation and scale (including deltas), "
2479 "before constraints and parenting are applied");
2480 RNA_def_property_float_funcs(prop, "rna_Object_matrix_basis_get", "rna_Object_matrix_basis_set", NULL);
2481 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2484 prop = RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX);
2485 RNA_def_property_float_sdna(prop, NULL, "parentinv");
2486 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2487 RNA_def_property_ui_text(prop, "Matrix", "Inverse of object's parent matrix at time of parenting");
2488 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2491 prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
2492 RNA_def_property_struct_type(prop, "Modifier");
2493 RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the geometric data of the object");
2494 rna_def_object_modifiers(brna, prop);
2497 prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
2498 RNA_def_property_struct_type(prop, "Constraint");
2499 RNA_def_property_ui_text(prop, "Constraints", "Constraints affecting the transformation of the object");
2500 /* RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "constraints__add", "constraints__remove"); */
2501 rna_def_object_constraints(brna, prop);
2504 prop = RNA_def_property(srna, "game", PROP_POINTER, PROP_NONE);
2505 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2506 RNA_def_property_struct_type(prop, "GameObjectSettings");
2507 RNA_def_property_pointer_funcs(prop, "rna_Object_game_settings_get", NULL, NULL, NULL);
2508 RNA_def_property_ui_text(prop, "Game Settings", "Game engine related settings for the object");
2511 prop = RNA_def_property(srna, "vertex_groups", PROP_COLLECTION, PROP_NONE);
2512 RNA_def_property_collection_sdna(prop, NULL, "defbase", NULL);
2513 RNA_def_property_struct_type(prop, "VertexGroup");
2514 RNA_def_property_ui_text(prop, "Vertex Groups", "Vertex groups of the object");
2515 rna_def_object_vertex_groups(brna, prop);
2518 prop = RNA_def_property(srna, "empty_draw_type", PROP_ENUM, PROP_NONE);
2519 RNA_def_property_enum_sdna(prop, NULL, "empty_drawtype");
2520 RNA_def_property_enum_items(prop, object_empty_drawtype_items);
2521 RNA_def_property_enum_funcs(prop, NULL, "rna_Object_empty_draw_type_set", NULL);
2522 RNA_def_property_ui_text(prop, "Empty Display Type", "Viewport display style for empties");
2523 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2525 prop = RNA_def_property(srna, "empty_draw_size", PROP_FLOAT, PROP_DISTANCE);
2526 RNA_def_property_float_sdna(prop, NULL, "empty_drawsize");
2527 RNA_def_property_range(prop, 0.0001f, 1000.0f);
2528 RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
2529 RNA_def_property_ui_text(prop, "Empty Display Size", "Size of display for empties in the viewport");
2530 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2532 prop = RNA_def_property(srna, "empty_image_offset", PROP_FLOAT, PROP_NONE);
2533 RNA_def_property_float_sdna(prop, NULL, "ima_ofs");
2534 RNA_def_property_ui_text(prop, "Origin Offset", "Origin offset distance");
2535 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 0.1f, 2);
2536 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2538 prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
2539 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2540 RNA_def_property_pointer_sdna(prop, NULL, "iuser");
2541 RNA_def_property_ui_text(prop, "Image User",
2542 "Parameters defining which layer, pass and frame of the image is displayed");
2543 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2546 prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
2547 RNA_def_property_int_sdna(prop, NULL, "index");
2548 RNA_def_property_ui_text(prop, "Pass Index", "Index number for the IndexOB render pass");
2549 RNA_def_property_update(prop, NC_OBJECT, "rna_Object_internal_update");
2551 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
2552 RNA_def_property_float_sdna(prop, NULL, "col");
2553 RNA_def_property_ui_text(prop, "Color", "Object color and alpha, used when faces have the ObColor mode enabled");
2554 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2557 prop = RNA_def_property(srna, "field", PROP_POINTER, PROP_NONE);
2558 RNA_def_property_pointer_sdna(prop, NULL, "pd");
2559 RNA_def_property_struct_type(prop, "FieldSettings");
2560 RNA_def_property_pointer_funcs(prop, "rna_Object_field_get", NULL, NULL, NULL);
2561 RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the object as a field in physics simulation");
2563 prop = RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE);
2564 RNA_def_property_pointer_sdna(prop, NULL, "pd");
2565 RNA_def_property_struct_type(prop, "CollisionSettings");
2566 RNA_def_property_pointer_funcs(prop, "rna_Object_collision_get", NULL, NULL, NULL);
2567 RNA_def_property_ui_text(prop, "Collision Settings",
2568 "Settings for using the object as a collider in physics simulation");
2570 prop = RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
2571 RNA_def_property_pointer_sdna(prop, NULL, "soft");
2572 RNA_def_property_struct_type(prop, "SoftBodySettings");
2573 RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for soft body simulation");
2575 prop = RNA_def_property(srna, "particle_systems", PROP_COLLECTION, PROP_NONE);
2576 RNA_def_property_collection_sdna(prop, NULL, "particlesystem", NULL);
2577 RNA_def_property_struct_type(prop, "ParticleSystem");
2578 RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
2579 rna_def_object_particle_systems(brna, prop);
2582 prop = RNA_def_property(srna, "rigid_body", PROP_POINTER, PROP_NONE);
2583 RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_object");
2584 RNA_def_property_struct_type(prop, "RigidBodyObject");
2585 RNA_def_property_ui_text(prop, "Rigid Body Settings", "Settings for rigid body simulation");
2587 prop = RNA_def_property(srna, "rigid_body_constraint", PROP_POINTER, PROP_NONE);
2588 RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_constraint");
2589 RNA_def_property_struct_type(prop, "RigidBodyConstraint");
2590 RNA_def_property_ui_text(prop, "Rigid Body Constraint", "Constraint constraining rigid bodies");
2593 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
2594 RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEW);
2595 RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport");
2596 RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
2597 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
2599 prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
2600 RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT);
2601 RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport");
2602 RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1);
2603 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2605 prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
2606 RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER);
2607 RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability");
2608 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
2609 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
2612 rna_def_animdata_common(srna);
2614 rna_def_animviz_common(srna);
2615 rna_def_motionpath_common(srna);
2617 /* slow parenting */
2618 /* XXX: evil old crap */
2619 prop = RNA_def_property(srna, "use_slow_parent", PROP_BOOLEAN, PROP_NONE);
2620 RNA_def_property_boolean_sdna(prop, NULL, "partype", PARSLOW);
2621 RNA_def_property_ui_text(prop, "Slow Parent",
2622 "Create a delay in the parent relationship (beware: this isn't renderfarm "
2623 "safe and may be invalid after jumping around the timeline)");
2624 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
2626 prop = RNA_def_property(srna, "slow_parent_offset", PROP_FLOAT, PROP_NONE | PROP_UNIT_TIME);
2627 RNA_def_property_float_sdna(prop, NULL, "sf");
2628 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
2629 RNA_def_property_ui_text(prop, "Slow Parent Offset", "Delay in the parent relationship");
2630 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
2632 /* depsgraph hack */
2633 prop = RNA_def_property(srna, "use_extra_recalc_object", PROP_BOOLEAN, PROP_NONE);
2634 RNA_def_property_boolean_sdna(prop, NULL, "depsflag", OB_DEPS_EXTRA_OB_RECALC);
2635 RNA_def_property_ui_text(prop, "Extra Object Update", "Refresh this object again on frame changes, dependency graph hack");
2637 prop = RNA_def_property(srna, "use_extra_recalc_data", PROP_BOOLEAN, PROP_NONE);
2638 RNA_def_property_boolean_sdna(prop, NULL, "depsflag", OB_DEPS_EXTRA_DATA_RECALC);
2639 RNA_def_property_ui_text(prop, "Extra Data Update", "Refresh this object's data again on frame changes, dependency graph hack");
2642 prop = RNA_def_property(srna, "dupli_type", PROP_ENUM, PROP_NONE);
2643 RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag");
2644 RNA_def_property_enum_items(prop, dupli_items);
2645 RNA_def_property_ui_text(prop, "Dupli Type", "If not None, object duplication method to use");
2646 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
2648 prop = RNA_def_property(srna, "use_dupli_frames_speed", PROP_BOOLEAN, PROP_NONE);
2649 RNA_def_property_boolean_negative_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED);
2650 RNA_def_property_ui_text(prop, "Dupli Frames Speed",
2651 "Set dupliframes to use the current frame instead of parent curve's evaluation time");
2652 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
2654 prop = RNA_def_property(srna, "use_dupli_vertices_rotation", PROP_BOOLEAN, PROP_NONE);
2655 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT);
2656 RNA_def_property_ui_text(prop, "Dupli Verts Rotation", "Rotate dupli according to vertex normal");
2657 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2659 prop = RNA_def_property(srna, "use_dupli_faces_scale", PROP_BOOLEAN, PROP_NONE);
2660 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIFACES_SCALE);
2661 RNA_def_property_ui_text(prop, "Dupli Faces Inherit Scale", "Scale dupli based on face size");
2662 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
2664 prop = RNA_def_property(srna, "dupli_faces_scale", PROP_FLOAT, PROP_NONE);
2665 RNA_def_property_float_sdna(prop, NULL, "dupfacesca");
2666 RNA_def_property_range(prop, 0.001f, 10000.0f);
2667 RNA_def_property_ui_text(prop, "Dupli Faces Scale", "Scale the DupliFace objects");
2668 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
2670 prop = RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
2671 RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
2672 RNA_def_property_flag(prop, PROP_EDITABLE);
2673 RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_dup_group_set", NULL, NULL);
2674 RNA_def_property_ui_text(prop, "Dupli Group", "Instance an existing group");
2675 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
2677 prop = RNA_def_property(srna, "dupli_frames_start", PROP_INT, PROP_NONE | PROP_UNIT_TIME);
2678 RNA_def_property_int_sdna(prop, NULL, "dupsta");
2679 RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
2680 RNA_def_property_ui_text(prop, "Dupli Frames Start", "Start frame for DupliFrames");
2681 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
2683 prop = RNA_def_property(srna, "dupli_frames_end", PROP_INT, PROP_NONE | PROP_UNIT_TIME);
2684 RNA_def_property_int_sdna(prop, NULL, "dupend");
2685 RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
2686 RNA_def_property_ui_text(prop, "Dupli Frames End", "End frame for DupliFrames");
2687 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
2689 prop = RNA_def_property(srna, "dupli_frames_on", PROP_INT, PROP_NONE | PROP_UNIT_TIME);
2690 RNA_def_property_int_sdna(prop, NULL, "dupon");
2691 RNA_def_property_range(prop, MINFRAME, MAXFRAME);
2692 RNA_def_property_ui_range(prop, 1, 1500, 1, -1);
2693 RNA_def_property_ui_text(prop, "Dupli Frames On", "Number of frames to use between DupOff frames");
2694 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
2696 prop = RNA_def_property(srna, "dupli_frames_off", PROP_INT, PROP_NONE | PROP_UNIT_TIME);
2697 RNA_def_property_int_sdna(prop, NULL, "dupoff");
2698 RNA_def_property_range(prop, 0, MAXFRAME);
2699 RNA_def_property_ui_range(prop, 0, 1500, 1, -1);
2700 RNA_def_property_ui_text(prop, "Dupli Frames Off", "Recurring frames to exclude from the Dupliframes");
2701 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
2703 prop = RNA_def_property(srna, "dupli_list", PROP_COLLECTION, PROP_NONE);
2704 RNA_def_property_collection_sdna(prop, NULL, "duplilist", NULL);
2705 RNA_def_property_struct_type(prop, "DupliObject");
2706 RNA_def_property_ui_text(prop, "Dupli list", "Object duplis");
2708 prop = RNA_def_property(srna, "is_duplicator", PROP_BOOLEAN, PROP_NONE);
2709 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLI);
2710 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2713 prop = RNA_def_property(srna, "draw_type", PROP_ENUM, PROP_NONE);
2714 RNA_def_property_enum_sdna(prop, NULL, "dt");
2715 RNA_def_property_enum_items(prop, drawtype_items);
2716 RNA_def_property_ui_text(prop, "Maximum Draw Type", "Maximum draw type to display object with in viewport");
2717 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
2719 prop = RNA_def_property(srna, "show_bounds", PROP_BOOLEAN, PROP_NONE);
2720 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWBOUNDOX);
2721 RNA_def_property_ui_text(prop, "Draw Bounds", "Display the object's bounds");
2722 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2724 prop = RNA_def_property(srna, "draw_bounds_type", PROP_ENUM, PROP_NONE);
2725 RNA_def_property_enum_sdna(prop, NULL, "boundtype");
2726 RNA_def_property_enum_items(prop, boundtype_items);
2727 RNA_def_property_ui_text(prop, "Draw Bounds Type", "Object boundary display type");
2728 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2730 prop = RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
2731 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWNAME);
2732 RNA_def_property_ui_text(prop, "Draw Name", "Display the object's name");
2733 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2735 prop = RNA_def_property(srna, "show_axis", PROP_BOOLEAN, PROP_NONE);
2736 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_AXIS);
2737 RNA_def_property_ui_text(prop, "Draw Axes", "Display the object's origin and axes");
2738 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2740 prop = RNA_def_property(srna, "show_texture_space", PROP_BOOLEAN, PROP_NONE);
2741 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_TEXSPACE);
2742 RNA_def_property_ui_text(prop, "Draw Texture Space", "Display the object's texture space");
2743 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2745 prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
2746 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWWIRE);
2747 RNA_def_property_ui_text(prop, "Draw Wire", "Add the object's wireframe over solid drawing");
2748 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2750 prop = RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE);
2751 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAW_ALL_EDGES);
2752 RNA_def_property_ui_text(prop, "Draw All Edges", "Display all edges for mesh objects");
2753 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2755 prop = RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE);
2756 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP);
2757 RNA_def_property_ui_text(prop, "Draw Transparent",
2758 "Display material transparency in the object (unsupported for duplicator drawing)");
2759 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2761 prop = RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE);
2762 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY);
2763 RNA_def_property_ui_text(prop, "X-Ray",
2764 "Make the object draw in front of others (unsupported for duplicator drawing)");
2765 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2768 prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
2769 RNA_def_property_pointer_sdna(prop, NULL, "gpd");
2770 RNA_def_property_struct_type(prop, "GreasePencil");
2771 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
2772 RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil datablock");
2773 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
2776 prop = RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE);
2777 RNA_def_property_pointer_sdna(prop, NULL, "poselib");
2778 RNA_def_property_struct_type(prop, "Action");
2779 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
2780 RNA_def_property_ui_text(prop, "Pose Library", "Action used as a pose library for armatures");
2782 prop = RNA_def_property(srna, "pose", PROP_POINTER, PROP_NONE);
2783 RNA_def_property_pointer_sdna(prop, NULL, "pose");
2784 RNA_def_property_struct_type(prop, "Pose");
2785 RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures");
2788 prop = RNA_def_property(srna, "show_only_shape_key", PROP_BOOLEAN, PROP_NONE);
2789 RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_LOCK);
2790 RNA_def_property_ui_text(prop, "Shape Key Lock", "Always show the current Shape for this Object");
2791 RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
2792 RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
2794 prop = RNA_def_property(srna, "use_shape_key_edit_mode", PROP_BOOLEAN, PROP_NONE);
2795 RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_EDIT_MODE);
2796 RNA_def_property_ui_text(prop, "Shape Key Edit Mode", "Apply shape keys in edit mode (for Meshes only)");
2797 RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
2798 RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
2800 prop = RNA_def_property(srna, "active_shape_key", PROP_POINTER, PROP_NONE);
2801 RNA_def_property_struct_type(prop, "ShapeKey");
2802 RNA_def_property_pointer_funcs(prop, "rna_Object_active_shape_key_get", NULL, NULL, NULL);
2803 RNA_def_property_ui_text(prop, "Active Shape Key", "Current shape key");
2805 prop = RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE);
2806 RNA_def_property_int_sdna(prop, NULL, "shapenr");
2807 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* XXX this is really unpredictable... */
2808 RNA_def_property_int_funcs(prop, "rna_Object_active_shape_key_index_get", "rna_Object_active_shape_key_index_set",
2809 "rna_Object_active_shape_key_index_range");
2810 RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index");
2811 RNA_def_property_update(prop, 0, "rna_Object_active_shape_update");
2814 prop = RNA_def_property(srna, "use_dynamic_topology_sculpting", PROP_BOOLEAN, PROP_NONE);
2815 RNA_def_property_boolean_funcs(prop, "rna_Object_use_dynamic_topology_sculpting_get", NULL);
2816 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2817 RNA_def_property_ui_text(prop, "Dynamic Topology Sculpting", NULL);
2819 /* Levels of Detail */
2820 prop = RNA_def_property(srna, "lod_levels", PROP_COLLECTION, PROP_NONE);
2821 RNA_def_property_collection_sdna(prop, NULL, "lodlevels", NULL);
2822 RNA_def_property_struct_type(prop, "LodLevel");
2823 RNA_def_property_ui_text(prop, "Level of Detail Levels", "A collection of detail levels to automatically switch between");
2824 RNA_def_property_update(prop, NC_OBJECT | ND_LOD, NULL);
2826 RNA_api_object(srna);
2829 static void rna_def_dupli_object(BlenderRNA *brna)
2834 srna = RNA_def_struct(brna, "DupliObject", NULL);
2835 RNA_def_struct_sdna(srna, "DupliObject");
2836 RNA_def_struct_ui_text(srna, "Object Duplicate", "An object duplicate");
2837 /* RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA); */
2839 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2840 RNA_def_property_pointer_sdna(prop, NULL, "ob");
2841 /* RNA_def_property_pointer_funcs(prop, "rna_DupliObject_object_get", NULL, NULL, NULL); */
2842 RNA_def_property_ui_text(prop, "Object", "Object being duplicated");
2844 prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
2845 RNA_def_property_float_sdna(prop, NULL, "mat");
2846 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
2847 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
2848 RNA_def_property_ui_text(prop, "Object Duplicate Matrix", "Object duplicate transformation matrix");
2850 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
2851 RNA_def_property_boolean_sdna(prop, NULL, "no_draw", 0);
2852 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
2853 RNA_def_property_ui_text(prop, "Hide", "Don't show dupli object in viewport or render");
2855 prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
2856 RNA_def_property_int_funcs(prop, "rna_DupliObject_index_get", NULL, NULL);
2857 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
2858 RNA_def_property_ui_text(prop, "Index", "Index in the lowest-level dupli list");
2860 prop = RNA_def_property(srna, "persistent_id", PROP_INT, PROP_NONE);
2861 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
2862 RNA_def_property_ui_text(prop, "Persistent ID", "Persistent identifier for inter-frame matching of objects with motion blur");
2864 prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
2865 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
2866 RNA_def_property_ui_text(prop, "Particle System", "Particle system that this dupli object was instanced from");
2868 prop = RNA_def_property(srna, "orco", PROP_FLOAT, PROP_TRANSLATION);
2869 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
2870 RNA_def_property_ui_text(prop, "Generated Coordinates", "Generated coordinates in parent object space");
2872 prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_NONE);
2873 RNA_def_property_array(prop, 2);
2874 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
2875 RNA_def_property_ui_text(prop, "UV Coordinates", "UV coordinates in parent object space");
2877 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2878 RNA_def_property_enum_items(prop, dupli_items);
2879 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
2880 RNA_def_property_ui_text(prop, "Dupli Type", "Duplicator type that generated this dupli object");
2883 static void rna_def_object_base(BlenderRNA *brna)
2888 srna = RNA_def_struct(brna, "ObjectBase", NULL);
2889 RNA_def_struct_sdna(srna, "Base");
2890 RNA_def_struct_ui_text(srna, "Object Base", "An object instance in a scene");
2891 RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
2893 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2894 RNA_def_property_pointer_sdna(prop, NULL, "object");
2895 RNA_def_property_ui_text(prop, "Object", "Object this base links to");
2897 /* same as object layer */
2898 prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
2899 RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
2900 RNA_def_property_array(prop, 20);
2901 RNA_def_property_ui_text(prop, "Layers", "Layers the object base is on");
2902 RNA_def_property_boolean_funcs(prop, NULL, "rna_Base_layer_set");
2903 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Base_layer_update");
2905 prop = RNA_def_property(srna, "layers_local_view", PROP_BOOLEAN, PROP_LAYER_MEMBER);
2906 RNA_def_property_boolean_sdna(prop, NULL, "lay", 0x01000000);
2907 RNA_def_property_array(prop, 8);
2908 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2909 RNA_def_property_ui_text(prop, "Local View Layers", "3D local view layers the object base is on");
2911 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
2912 RNA_def_property_boolean_sdna(prop, NULL, "flag", BA_SELECT);
2913 RNA_def_property_ui_text(prop, "Select", "Object base selection state");
2914 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Base_select_update");
2916 RNA_api_object_base(srna);
2919 void RNA_def_object(BlenderRNA *brna)
2921 rna_def_object(brna);
2923 RNA_define_animate_sdna(false);
2924 rna_def_object_game_settings(brna);
2925 rna_def_object_base(brna);
2926 rna_def_vertex_group(brna);
2927 rna_def_material_slot(brna);
2928 rna_def_dupli_object(brna);
2929 RNA_define_animate_sdna(true);
2930 rna_def_object_lodlevel(brna);