4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * Contributor(s): Blender Foundation (2008).
22 * ***** END GPL LICENSE BLOCK *****
28 #include "RNA_define.h"
29 #include "RNA_types.h"
31 #include "rna_internal.h"
33 #include "DNA_customdata_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"
45 #include "DNA_key_types.h"
47 #include "BKE_armature.h"
48 #include "BKE_context.h"
49 #include "BKE_curve.h"
50 #include "BKE_depsgraph.h"
52 #include "BKE_material.h"
54 #include "BKE_particle.h"
56 static void rna_Object_update(bContext *C, PointerRNA *ptr)
58 DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB);
61 static void rna_Object_update_data(bContext *C, PointerRNA *ptr)
63 DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_DATA);
66 static void rna_Object_dependency_update(bContext *C, PointerRNA *ptr)
68 DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB);
69 DAG_scene_sort(CTX_data_scene(C));
72 static int rna_Object_data_editable(PointerRNA *ptr)
74 Object *ob= (Object*)ptr->data;
76 return (ob->type == OB_EMPTY)? 0: PROP_EDITABLE;
79 static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
81 Object *ob= (Object*)ptr->data;
84 if(ob->type == OB_EMPTY || id == NULL)
87 if(ob->type == OB_MESH) {
88 set_mesh(ob, (Mesh*)id);
92 id_us_min((ID*)ob->data);
97 test_object_materials(id);
99 if(GS(id->name)==ID_CU)
101 else if(ob->type==OB_ARMATURE)
102 armature_rebuild_pose(ob, ob->data);
106 static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
108 Object *ob= (Object*)ptr->data;
111 case OB_MESH: return &RNA_Mesh;
112 case OB_CURVE: return &RNA_Curve;
113 case OB_SURF: return &RNA_Curve;
114 case OB_FONT: return &RNA_Curve;
115 case OB_MBALL: return &RNA_MetaBall;
116 case OB_LAMP: return &RNA_Lamp;
117 case OB_CAMERA: return &RNA_Camera;
118 case OB_LATTICE: return &RNA_Lattice;
119 case OB_ARMATURE: return &RNA_Armature;
120 default: return &RNA_ID;
124 static int rna_VertexGroup_index_get(PointerRNA *ptr)
126 Object *ob= (Object*)ptr->id.data;
128 return BLI_findindex(&ob->defbase, ptr->data);
131 static PointerRNA rna_Object_active_vertex_group_get(PointerRNA *ptr)
133 Object *ob= (Object*)ptr->id.data;
134 return rna_pointer_inherit_refine(ptr, &RNA_VertexGroup, BLI_findlink(&ob->defbase, ob->actdef));
137 static int rna_Object_active_vertex_group_index_get(PointerRNA *ptr)
139 Object *ob= (Object*)ptr->id.data;
140 return MAX2(ob->actdef-1, 0);
143 static void rna_Object_active_vertex_group_index_set(PointerRNA *ptr, int value)
145 Object *ob= (Object*)ptr->id.data;
149 static void rna_Object_active_vertex_group_index_range(PointerRNA *ptr, int *min, int *max)
151 Object *ob= (Object*)ptr->id.data;
154 *max= BLI_countlist(&ob->defbase)-1;
158 void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
160 Object *ob= (Object*)ptr->id.data;
163 dg= BLI_findlink(&ob->defbase, index-1);
165 if(dg) BLI_strncpy(value, dg->name, sizeof(dg->name));
166 else BLI_strncpy(value, "", sizeof(dg->name));
169 int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index)
171 Object *ob= (Object*)ptr->id.data;
174 dg= BLI_findlink(&ob->defbase, index-1);
175 return (dg)? strlen(dg->name): 0;
178 void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
180 Object *ob= (Object*)ptr->id.data;
184 for(a=1, dg=ob->defbase.first; dg; dg=dg->next, a++) {
185 if(strcmp(dg->name, value) == 0) {
194 void rna_object_vgroup_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
196 Object *ob= (Object*)ptr->id.data;
199 for(dg=ob->defbase.first; dg; dg=dg->next) {
200 if(strcmp(dg->name, value) == 0) {
201 BLI_strncpy(result, value, maxlen);
206 BLI_strncpy(result, "", maxlen);
209 void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
211 Object *ob= (Object*)ptr->id.data;
213 CustomDataLayer *layer;
216 if(ob->type == OB_MESH && ob->data) {
219 for(a=0; a<me->fdata.totlayer; a++) {
220 layer= &me->fdata.layers[a];
222 if(layer->type == CD_MTFACE && strcmp(layer->name, value) == 0) {
223 BLI_strncpy(result, value, maxlen);
229 BLI_strncpy(result, "", maxlen);
232 void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
234 Object *ob= (Object*)ptr->id.data;
236 CustomDataLayer *layer;
239 if(ob->type == OB_MESH && ob->data) {
242 for(a=0; a<me->fdata.totlayer; a++) {
243 layer= &me->fdata.layers[a];
245 if(layer->type == CD_MCOL && strcmp(layer->name, value) == 0) {
246 BLI_strncpy(result, value, maxlen);
252 BLI_strncpy(result, "", maxlen);
255 static int rna_Object_active_material_index_get(PointerRNA *ptr)
257 Object *ob= (Object*)ptr->id.data;
258 return MAX2(ob->actcol-1, 0);
261 static void rna_Object_active_material_index_set(PointerRNA *ptr, int value)
263 Object *ob= (Object*)ptr->id.data;
267 static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, int *max)
269 Object *ob= (Object*)ptr->id.data;
271 *max= MAX2(ob->totcol-1, 0);
274 static PointerRNA rna_Object_active_material_get(PointerRNA *ptr)
276 Object *ob= (Object*)ptr->id.data;
277 return rna_pointer_inherit_refine(ptr, &RNA_MaterialSlot, ob->mat+ob->actcol);
280 static void rna_Object_active_particle_system_index_range(PointerRNA *ptr, int *min, int *max)
282 Object *ob= (Object*)ptr->id.data;
284 *max= BLI_countlist(&ob->particlesystem)-1;
288 static int rna_Object_active_particle_system_index_get(PointerRNA *ptr)
290 Object *ob= (Object*)ptr->id.data;
291 return psys_get_current_num(ob);
294 static void rna_Object_active_particle_system_index_set(struct PointerRNA *ptr, int value)
296 Object *ob= (Object*)ptr->id.data;
297 psys_set_current_num(ob, value);
301 static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value)
303 Object *ob= (Object*)ptr->id.data;
305 assign_material(ob, value.data, ob->actcol);
309 static PointerRNA rna_MaterialSlot_material_get(PointerRNA *ptr)
311 Object *ob= (Object*)ptr->id.data;
313 int index= (Material**)ptr->data - ob->mat;
315 ma= give_current_material(ob, index+1);
316 return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
319 static void rna_MaterialSlot_material_set(PointerRNA *ptr, PointerRNA value)
321 Object *ob= (Object*)ptr->id.data;
322 int index= (Material**)ptr->data - ob->mat;
324 assign_material(ob, value.data, index+1);
327 static int rna_MaterialSlot_link_get(PointerRNA *ptr)
329 Object *ob= (Object*)ptr->id.data;
330 int index= (Material**)ptr->data - ob->mat;
332 return (ob->colbits & (1<<index)) != 0;
335 static void rna_MaterialSlot_link_set(PointerRNA *ptr, int value)
337 Object *ob= (Object*)ptr->id.data;
338 int index= (Material**)ptr->data - ob->mat;
341 ob->colbits |= (1<<index);
343 ob->colbits &= ~(1<<index);
346 static int rna_MaterialSlot_name_length(PointerRNA *ptr)
348 Object *ob= (Object*)ptr->id.data;
350 int index= (Material**)ptr->data - ob->mat;
352 ma= give_current_material(ob, index+1);
355 return strlen(ma->id.name+2);
360 static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str)
362 Object *ob= (Object*)ptr->id.data;
364 int index= (Material**)ptr->data - ob->mat;
366 ma= give_current_material(ob, index+1);
369 strcpy(str, ma->id.name+2);
374 static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr)
376 Object *ob= (Object*)ptr->id.data;
377 ParticleSystem *psys= psys_get_current(ob);
378 return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem, psys);
381 static PointerRNA rna_Object_game_settings_get(PointerRNA *ptr)
383 return rna_pointer_inherit_refine(ptr, &RNA_GameObjectSettings, ptr->id.data);
386 static void rna_Object_layer_set(PointerRNA *ptr, const int *values)
388 Object *ob= (Object*)ptr->data;
391 /* ensure we always have some layer selected */
399 for(i=0; i<20; i++) {
400 if(values[i]) ob->lay |= (1<<i);
401 else ob->lay &= ~(1<<i);
405 static void rna_GameObjectSettings_state_set(PointerRNA *ptr, const int *values)
407 Object *ob= (Object*)ptr->data;
410 /* ensure we always have some state selected */
418 for(i=0; i<20; i++) {
419 if(values[i]) ob->state |= (1<<i);
420 else ob->state &= ~(1<<i);
424 static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, int *max)
426 Object *ob= (Object*)ptr->id.data;
427 Key *key= ob_get_key(ob);
430 *max= (key)? BLI_countlist(&key->block)-1: 0;
434 static int rna_Object_active_shape_key_index_get(PointerRNA *ptr)
436 Object *ob= (Object*)ptr->id.data;
438 return MAX2(ob->shapenr-1, 0);
441 static void rna_Object_active_shape_key_index_set(PointerRNA *ptr, int value)
443 Object *ob= (Object*)ptr->id.data;
445 ob->shapenr= value+1;
446 ob->shapeflag |= OB_SHAPE_TEMPLOCK;
449 static void rna_Object_shape_key_lock_set(PointerRNA *ptr, int value)
451 Object *ob= (Object*)ptr->id.data;
453 if(value) ob->shapeflag |= OB_SHAPE_LOCK;
454 else ob->shapeflag &= ~OB_SHAPE_LOCK;
456 ob->shapeflag &= ~OB_SHAPE_TEMPLOCK;
461 static void rna_def_vertex_group(BlenderRNA *brna)
466 srna= RNA_def_struct(brna, "VertexGroup", NULL);
467 RNA_def_struct_sdna(srna, "bDeformGroup");
468 RNA_def_struct_ui_text(srna, "Vertex Group", "Group of vertices, used for armature deform and other purposes.");
469 RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
471 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
472 RNA_def_property_ui_text(prop, "Name", "Vertex group name.");
473 RNA_def_struct_name_property(srna, prop);
475 prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
476 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
477 RNA_def_property_int_funcs(prop, "rna_VertexGroup_index_get", NULL, NULL);
478 RNA_def_property_ui_text(prop, "Index", "Index number of the vertex group.");
481 static void rna_def_material_slot(BlenderRNA *brna)
486 static EnumPropertyItem link_items[] = {
487 {0, "DATA", 0, "Data", ""},
488 {1, "OBJECT", 0, "Object", ""},
489 {0, NULL, 0, NULL, NULL}};
491 /* NOTE: there is no MaterialSlot equivalent in DNA, so the internal
492 * pointer data points to ob->mat + index, and we manually implement
493 * get/set for the properties. */
495 srna= RNA_def_struct(brna, "MaterialSlot", NULL);
496 RNA_def_struct_ui_text(srna, "Material Slot", "Material slot in an object.");
497 RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
499 prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
500 RNA_def_property_struct_type(prop, "Material");
501 RNA_def_property_flag(prop, PROP_EDITABLE);
502 RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", "rna_MaterialSlot_material_set", NULL);
503 RNA_def_property_ui_text(prop, "Material", "Material datablock used by this material slot.");
504 RNA_def_property_update(prop, NC_OBJECT|ND_SHADING, "rna_Object_update");
506 prop= RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
507 RNA_def_property_enum_items(prop, link_items);
508 RNA_def_property_enum_funcs(prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL);
509 RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data.");
510 RNA_def_property_update(prop, NC_OBJECT|ND_SHADING, "rna_Object_update");
512 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
513 RNA_def_property_string_funcs(prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL);
514 RNA_def_property_ui_text(prop, "Name", "Material slot name.");
515 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
516 RNA_def_struct_name_property(srna, prop);
519 static void rna_def_object_game_settings(BlenderRNA *brna)
524 static EnumPropertyItem body_type_items[] = {
525 {OB_BODY_TYPE_NO_COLLISION, "NO_COLLISION", 0, "No Collision", ""},
526 {OB_BODY_TYPE_STATIC, "STATIC", 0, "Static", ""},
527 {OB_BODY_TYPE_DYNAMIC, "DYNAMIC", 0, "Dynamic", ""},
528 {OB_BODY_TYPE_RIGID, "RIGID_BODY", 0, "Rigid Body", ""},
529 {OB_BODY_TYPE_SOFT, "SOFT_BODY", 0, "Soft Body", ""},
530 {0, NULL, 0, NULL, NULL}};
532 static EnumPropertyItem collision_bounds_items[] = {
533 {OB_BOUND_BOX, "BOX", 0, "Box", ""},
534 {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""},
535 {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", ""},
536 {OB_BOUND_CONE, "CONE", 0, "Cone", ""},
537 {OB_BOUND_POLYH, "CONVEX_HULL", 0, "Convex Hull", ""},
538 {OB_BOUND_POLYT, "TRIANGLE_MESH", 0, "Triangle Mesh", ""},
539 //{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""},
540 {0, NULL, 0, NULL, NULL}};
542 srna= RNA_def_struct(brna, "GameObjectSettings", NULL);
543 RNA_def_struct_sdna(srna, "Object");
544 RNA_def_struct_nested(brna, srna, "Object");
545 RNA_def_struct_ui_text(srna, "Game Object Settings", "Game engine related settings for the object.");
546 RNA_def_struct_ui_icon(srna, ICON_GAME);
550 prop= RNA_def_property(srna, "sensors", PROP_COLLECTION, PROP_NONE);
551 RNA_def_property_struct_type(prop, "Sensor");
552 RNA_def_property_ui_text(prop, "Sensors", "Game engine sensor to detect events.");
554 prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE);
555 RNA_def_property_struct_type(prop, "Controller");
556 RNA_def_property_ui_text(prop, "Controllers", "Game engine controllers to process events, connecting sensor to actuators.");
558 prop= RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE);
559 RNA_def_property_struct_type(prop, "Actuator");
560 RNA_def_property_ui_text(prop, "Actuators", "Game engine actuators to act on events.");
562 prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
563 RNA_def_property_collection_sdna(prop, NULL, "prop", NULL);
564 RNA_def_property_struct_type(prop, "GameProperty");
565 RNA_def_property_ui_text(prop, "Properties", "Game engine properties.");
567 prop= RNA_def_property(srna, "show_sensors", PROP_BOOLEAN, PROP_NONE);
568 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWSENS);
569 RNA_def_property_ui_text(prop, "Show Sensors", "Shows sensors for this object in the user interface.");
571 prop= RNA_def_property(srna, "show_controllers", PROP_BOOLEAN, PROP_NONE);
572 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWCONT);
573 RNA_def_property_ui_text(prop, "Show Controllers", "Shows controllers for this object in the user interface.");
575 prop= RNA_def_property(srna, "show_actuators", PROP_BOOLEAN, PROP_NONE);
576 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWACT);
577 RNA_def_property_ui_text(prop, "Show Actuators", "Shows actuators for this object in the user interface.");
581 prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
582 RNA_def_property_enum_sdna(prop, NULL, "body_type");
583 RNA_def_property_enum_items(prop, body_type_items);
584 RNA_def_property_clear_flag(prop, PROP_EDITABLE); // this controls various gameflags
585 RNA_def_property_ui_text(prop, "Physics Type", "Selects the type of physical representation.");
587 prop= RNA_def_property(srna, "actor", PROP_BOOLEAN, PROP_NONE);
588 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ACTOR);
589 RNA_def_property_ui_text(prop, "Actor", "Object is detected by the Near and Radar sensor.");
591 prop= RNA_def_property(srna, "ghost", PROP_BOOLEAN, PROP_NONE);
592 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_GHOST);
593 RNA_def_property_ui_text(prop, "Ghost", "Object does not restitute collisions, like a ghost.");
595 prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
596 RNA_def_property_range(prop, 0.01, 10000.0);
597 RNA_def_property_ui_text(prop, "Mass", "Mass of the object.");
599 prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
600 RNA_def_property_float_sdna(prop, NULL, "inertia");
601 RNA_def_property_range(prop, 0.01, 10.0);
602 RNA_def_property_ui_text(prop, "Radius", "Radius for Bounding sphere and Fh/Fh Rot.");
603 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
605 prop= RNA_def_property(srna, "no_sleeping", PROP_BOOLEAN, PROP_NONE);
606 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_COLLISION_RESPONSE);
607 RNA_def_property_ui_text(prop, "No Sleeping", "Disable auto (de)activation in physics simulation.");
609 prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
610 RNA_def_property_float_sdna(prop, NULL, "damping");
611 RNA_def_property_range(prop, 0.0, 1.0);
612 RNA_def_property_ui_text(prop, "Damping", "General movement damping.");
614 prop= RNA_def_property(srna, "rotation_damping", PROP_FLOAT, PROP_NONE);
615 RNA_def_property_float_sdna(prop, NULL, "rdamping");
616 RNA_def_property_range(prop, 0.0, 1.0);
617 RNA_def_property_ui_text(prop, "Rotation Damping", "General rotation damping.");
619 prop= RNA_def_property(srna, "minimum_velocity", PROP_FLOAT, PROP_NONE);
620 RNA_def_property_float_sdna(prop, NULL, "min_vel");
621 RNA_def_property_range(prop, 0.0, 1000.0);
622 RNA_def_property_ui_text(prop, "Velocity Min", "Clamp velocity to this minimum speed (except when totally still).");
624 prop= RNA_def_property(srna, "maximum_velocity", PROP_FLOAT, PROP_NONE);
625 RNA_def_property_float_sdna(prop, NULL, "max_vel");
626 RNA_def_property_range(prop, 0.0, 1000.0);
627 RNA_def_property_ui_text(prop, "Velocity Max", "Clamp velocity to this maximum speed.");
630 prop= RNA_def_property(srna, "lock_x_axis", PROP_BOOLEAN, PROP_NONE);
631 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_AXIS);
632 RNA_def_property_ui_text(prop, "Lock X Axis", "Disable simulation of linear motion along the X axis.");
634 prop= RNA_def_property(srna, "lock_y_axis", PROP_BOOLEAN, PROP_NONE);
635 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_AXIS);
636 RNA_def_property_ui_text(prop, "Lock Y Axis", "Disable simulation of linear motion along the Y axis.");
638 prop= RNA_def_property(srna, "lock_z_axis", PROP_BOOLEAN, PROP_NONE);
639 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_AXIS);
640 RNA_def_property_ui_text(prop, "Lock Z Axis", "Disable simulation of linear motion along the Z axis.");
644 prop= RNA_def_property(srna, "lock_x_rot_axis", PROP_BOOLEAN, PROP_NONE);
645 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_ROT_AXIS);
646 RNA_def_property_ui_text(prop, "Lock X Rotation Axis", "Disable simulation of angular motion along the X axis.");
648 prop= RNA_def_property(srna, "lock_y_rot_axis", PROP_BOOLEAN, PROP_NONE);
649 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_ROT_AXIS);
650 RNA_def_property_ui_text(prop, "Lock Y Rotation Axis", "Disable simulation of angular motion along the Y axis.");
652 prop= RNA_def_property(srna, "lock_z_rot_axis", PROP_BOOLEAN, PROP_NONE);
653 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_ROT_AXIS);
654 RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis.");
656 /* is this used anywhere ? */
657 prop= RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
658 RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflag2", OB_NEVER_DO_ACTIVITY_CULLING);
659 RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis.");
662 prop= RNA_def_property(srna, "do_fh", PROP_BOOLEAN, PROP_NONE);
663 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_DO_FH);
664 RNA_def_property_ui_text(prop, "Do Fh", "Use Fh settings in materials.");
666 prop= RNA_def_property(srna, "rotation_fh", PROP_BOOLEAN, PROP_NONE);
667 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ROT_FH);
668 RNA_def_property_ui_text(prop, "Rotation Fh", "Use face normal to rotate Object");
670 prop= RNA_def_property(srna, "form_factor", PROP_FLOAT, PROP_NONE);
671 RNA_def_property_float_sdna(prop, NULL, "formfactor");
672 RNA_def_property_range(prop, 0.0, 1.0);
673 RNA_def_property_ui_text(prop, "Form Factor", "Form factor scales the inertia tensor.");
675 prop= RNA_def_property(srna, "anisotropic_friction", PROP_BOOLEAN, PROP_NONE);
676 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ANISOTROPIC_FRICTION);
677 RNA_def_property_ui_text(prop, "Anisotropic Friction", "Enable anisotropic friction.");
679 prop= RNA_def_property(srna, "friction_coefficients", PROP_FLOAT, PROP_VECTOR);
680 RNA_def_property_float_sdna(prop, NULL, "anisotropicFriction");
681 RNA_def_property_range(prop, 0.0, 1.0);
682 RNA_def_property_ui_text(prop, "Friction Coefficients", "Relative friction coefficient in the in the X, Y and Z directions, when anisotropic friction is enabled.");
684 prop= RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE);
685 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_BOUNDS);
686 RNA_def_property_ui_text(prop, "Use Collision Bounds", "Specify a collision bounds type other than the default.");
688 prop= RNA_def_property(srna, "collision_bounds", PROP_ENUM, PROP_NONE);
689 RNA_def_property_enum_sdna(prop, NULL, "boundtype");
690 RNA_def_property_enum_items(prop, collision_bounds_items);
691 RNA_def_property_ui_text(prop, "Collision Bounds", "Selects the collision type.");
693 prop= RNA_def_property(srna, "collision_compound", PROP_BOOLEAN, PROP_NONE);
694 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_CHILD);
695 RNA_def_property_ui_text(prop, "Collison Compound", "Add children to form a compound collision object.");
697 prop= RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE);
698 RNA_def_property_float_sdna(prop, NULL, "margin");
699 RNA_def_property_range(prop, 0.0, 1.0);
700 RNA_def_property_ui_text(prop, "Collision Margin", "Extra margin around object for collision detection, small amount required for stability.");
702 prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
703 RNA_def_property_pointer_sdna(prop, NULL, "bsoft");
704 RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for Bullet soft body simulation.");
708 prop= RNA_def_property(srna, "state", PROP_BOOLEAN, PROP_NONE);
709 RNA_def_property_boolean_sdna(prop, NULL, "state", 1);
710 RNA_def_property_array(prop, 30);
711 RNA_def_property_ui_text(prop, "State", "State determining which controllers are displayed.");
712 RNA_def_property_boolean_funcs(prop, NULL, "rna_GameObjectSettings_state_set");
714 prop= RNA_def_property(srna, "initial_state", PROP_BOOLEAN, PROP_NONE);
715 RNA_def_property_boolean_sdna(prop, NULL, "init_state", 1);
716 RNA_def_property_array(prop, 30);
717 RNA_def_property_ui_text(prop, "Initial State", "Initial state when the game starts.");
719 prop= RNA_def_property(srna, "debug_state", PROP_BOOLEAN, PROP_NONE);
720 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_DEBUGSTATE);
721 RNA_def_property_ui_text(prop, "Debug State", "Print state debug info in the game engine.");
724 static void rna_def_object(BlenderRNA *brna)
729 static EnumPropertyItem parent_type_items[] = {
730 {PAROBJECT, "OBJECT", 0, "Object", ""},
731 {PARCURVE, "CURVE", 0, "Curve", ""},
732 //{PARKEY, "KEY", 0, "Key", ""},
733 {PARSKEL, "ARMATURE", 0, "Armature", ""},
734 {PARSKEL, "LATTICE", 0, "Lattice", ""}, // PARSKEL reuse will give issues
735 {PARVERT1, "VERTEX", 0, "Vertex", ""},
736 {PARVERT3, "VERTEX_3", 0, "3 Vertices", ""},
737 {PARBONE, "BONE", 0, "Bone", ""},
738 {0, NULL, 0, NULL, NULL}};
740 static EnumPropertyItem object_type_items[] = {
741 {OB_EMPTY, "EMPTY", 0, "Empty", ""},
742 {OB_MESH, "MESH", 0, "Mesh", ""},
743 {OB_CURVE, "CURVE", 0, "Curve", ""},
744 {OB_SURF, "SURFACE", 0, "Surface", ""},
745 {OB_FONT, "TEXT", 0, "Text", ""},
746 {OB_MBALL, "META", 0, "Meta", ""},
747 {OB_LAMP, "LAMP", 0, "Lamp", ""},
748 {OB_CAMERA, "CAMERA", 0, "Camera", ""},
749 {OB_WAVE, "WAVE", 0, "Wave", ""},
750 {OB_LATTICE, "LATTICE", 0, "Lattice", ""},
751 {OB_ARMATURE, "ARMATURE", 0, "Armature", ""},
752 {0, NULL, 0, NULL, NULL}};
754 static EnumPropertyItem empty_drawtype_items[] = {
755 {OB_ARROWS, "ARROWS", 0, "Arrows", ""},
756 {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""},
757 {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""},
758 {OB_CIRCLE, "CIRCLE", 0, "Circle", ""},
759 {OB_CUBE, "CUBE", 0, "Cube", ""},
760 {OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""},
761 {OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
762 {0, NULL, 0, NULL, NULL}};
764 static EnumPropertyItem track_items[] = {
765 {OB_POSX, "POSX", 0, "+X", ""},
766 {OB_POSY, "POSY", 0, "+Y", ""},
767 {OB_POSZ, "POSZ", 0, "+Z", ""},
768 {OB_NEGX, "NEGX", 0, "-X", ""},
769 {OB_NEGY, "NEGY", 0, "-Y", ""},
770 {OB_NEGZ, "NEGZ", 0, "-Z", ""},
771 {0, NULL, 0, NULL, NULL}};
773 static EnumPropertyItem up_items[] = {
774 {OB_POSX, "X", 0, "X", ""},
775 {OB_POSY, "Y", 0, "Y", ""},
776 {OB_POSZ, "Z", 0, "Z", ""},
777 {0, NULL, 0, NULL, NULL}};
779 static EnumPropertyItem drawtype_items[] = {
780 {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", ""},
781 {OB_WIRE, "WIRE", 0, "Wire", ""},
782 {OB_SOLID, "SOLID", 0, "Solid", ""},
783 {OB_SHADED, "SHADED", 0, "Shaded", ""},
784 {OB_TEXTURE, "TEXTURED", 0, "Textured", ""},
785 {0, NULL, 0, NULL, NULL}};
787 static EnumPropertyItem boundtype_items[] = {
788 {OB_BOUND_BOX, "BOX", 0, "Box", ""},
789 {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""},
790 {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", ""},
791 {OB_BOUND_CONE, "CONE", 0, "Cone", ""},
792 {OB_BOUND_POLYH, "POLYHEDER", 0, "Polyheder", ""},
793 {0, NULL, 0, NULL, NULL}};
795 static EnumPropertyItem dupli_items[] = {
796 {0, "NONE", 0, "None", ""},
797 {OB_DUPLIFRAMES, "FRAMES", 0, "Frames", "Make copy of object for every frame."},
798 {OB_DUPLIVERTS, "VERTS", 0, "Verts", "Duplicate child objects on all vertices."},
799 {OB_DUPLIFACES, "FACES", 0, "Faces", "Duplicate child objects on all faces."},
800 {OB_DUPLIGROUP, "GROUP", 0, "Group", "Enable group instancing."},
801 {0, NULL, 0, NULL, NULL}};
803 srna= RNA_def_struct(brna, "Object", "ID");
804 RNA_def_struct_ui_text(srna, "Object", "Object datablock defining an object in a scene..");
805 RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
806 RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
808 prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
809 RNA_def_property_struct_type(prop, "ID");
810 RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_data_set", "rna_Object_data_typef");
811 RNA_def_property_editable_func(prop, "rna_Object_data_editable");
812 RNA_def_property_flag(prop, PROP_EDITABLE);
813 RNA_def_property_ui_text(prop, "Data", "Object data.");
814 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update_data");
816 prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_NONE);
817 RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
818 RNA_def_property_array(prop, 20);
819 RNA_def_property_ui_text(prop, "Layers", "Layers the object is on.");
820 RNA_def_property_boolean_funcs(prop, NULL, "rna_Object_layer_set");
822 prop= RNA_def_property(srna, "selected", PROP_BOOLEAN, PROP_NONE);
823 RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
824 RNA_def_property_ui_text(prop, "Selected", "Object selection state.");
826 /* parent and track */
828 prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
829 RNA_def_property_ui_text(prop, "Parent", "Parent Object");
831 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
832 RNA_def_property_enum_sdna(prop, NULL, "type");
833 RNA_def_property_enum_items(prop, object_type_items);
834 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
835 RNA_def_property_ui_text(prop, "Type", "Type of Object.");
837 prop= RNA_def_property(srna, "parent_type", PROP_ENUM, PROP_NONE);
838 RNA_def_property_enum_sdna(prop, NULL, "partype");
839 RNA_def_property_enum_items(prop, parent_type_items);
840 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
841 RNA_def_property_ui_text(prop, "Parent Type", "Type of parent relation.");
843 prop= RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED);
844 RNA_def_property_int_sdna(prop, NULL, "par1");
845 RNA_def_property_array(prop, 3);
846 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
847 RNA_def_property_ui_text(prop, "Parent Vertices", "Indices of vertices in cases of a vertex parenting relation.");
849 prop= RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
850 RNA_def_property_string_sdna(prop, NULL, "parsubstr");
851 RNA_def_property_ui_text(prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation.");
853 prop= RNA_def_property(srna, "track", PROP_POINTER, PROP_NONE);
854 RNA_def_property_flag(prop, PROP_EDITABLE);
855 RNA_def_property_ui_text(prop, "Track", "Object being tracked to define the rotation (Old Track).");
857 prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
858 RNA_def_property_enum_sdna(prop, NULL, "trackflag");
859 RNA_def_property_enum_items(prop, track_items);
860 RNA_def_property_ui_text(prop, "Track Axis", "Tracking axis pointing to the another object.");
862 prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
863 RNA_def_property_enum_sdna(prop, NULL, "upflag");
864 RNA_def_property_enum_items(prop, up_items);
865 RNA_def_property_ui_text(prop, "Up Axis", "Specify the axis that points up.");
869 prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
870 RNA_def_property_ui_text(prop, "Proxy", "Library object this proxy object controls.");
872 prop= RNA_def_property(srna, "proxy_group", PROP_POINTER, PROP_NONE);
873 RNA_def_property_ui_text(prop, "Proxy Group", "Library group duplicator object this proxy object controls.");
876 prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
877 RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
878 RNA_def_property_struct_type(prop, "MaterialSlot");
879 RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", 0, 0, 0, 0, 0); /* don't dereference pointer! */
880 RNA_def_property_ui_text(prop, "Materials", "Material slots in the object.");
882 prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
883 RNA_def_property_struct_type(prop, "MaterialSlot");
884 RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", NULL, NULL);
885 RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed.");
887 prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
888 RNA_def_property_int_sdna(prop, NULL, "actcol");
889 RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set", "rna_Object_active_material_index_range");
890 RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot.");
894 prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_VECTOR);
895 RNA_def_property_float_sdna(prop, NULL, "loc");
896 RNA_def_property_ui_text(prop, "Location", "Location of the object.");
897 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
899 prop= RNA_def_property(srna, "delta_location", PROP_FLOAT, PROP_VECTOR);
900 RNA_def_property_float_sdna(prop, NULL, "dloc");
901 RNA_def_property_ui_text(prop, "Delta Location", "Extra added translation to object location.");
902 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
904 prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ROTATION);
905 RNA_def_property_float_sdna(prop, NULL, "rot");
906 RNA_def_property_ui_text(prop, "Rotation", "Rotation of the object.");
907 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
909 prop= RNA_def_property(srna, "delta_rotation", PROP_FLOAT, PROP_ROTATION);
910 RNA_def_property_float_sdna(prop, NULL, "drot");
911 RNA_def_property_ui_text(prop, "Delta Rotation", "Extra added rotation to the rotation of the object.");
912 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
914 prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_VECTOR);
915 RNA_def_property_float_sdna(prop, NULL, "size");
916 RNA_def_property_ui_text(prop, "Scale", "Scaling of the object.");
917 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
919 prop= RNA_def_property(srna, "delta_scale", PROP_FLOAT, PROP_VECTOR);
920 RNA_def_property_float_sdna(prop, NULL, "dsize");
921 RNA_def_property_ui_text(prop, "Delta Scale", "Extra added scaling to the scale of the object.");
922 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
924 prop= RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_VECTOR);
925 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX);
926 RNA_def_property_array(prop, 3);
927 RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location in the interface.");
929 prop= RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_VECTOR);
930 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX);
931 RNA_def_property_array(prop, 3);
932 RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation in the interface.");
934 prop= RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_VECTOR);
935 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX);
936 RNA_def_property_array(prop, 3);
937 RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface.");
940 prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
941 RNA_def_property_float_sdna(prop, NULL, "obmat");
942 RNA_def_property_array(prop, 16);
943 RNA_def_property_ui_text(prop, "Matrix", "Transformation matrix.");
946 prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
947 RNA_def_property_struct_type(prop, "Constraint");
948 RNA_def_property_ui_text(prop, "Constraints", "Constraints of the object.");
950 prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
951 RNA_def_property_struct_type(prop, "Modifier");
952 RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the geometric data of the Object.");
956 prop= RNA_def_property(srna, "game", PROP_POINTER, PROP_NEVER_NULL);
957 RNA_def_property_struct_type(prop, "GameObjectSettings");
958 RNA_def_property_pointer_funcs(prop, "rna_Object_game_settings_get", NULL, NULL);
959 RNA_def_property_ui_text(prop, "Game Settings", "Game engine related settings for the object.");
963 prop= RNA_def_property(srna, "vertex_groups", PROP_COLLECTION, PROP_NONE);
964 RNA_def_property_collection_sdna(prop, NULL, "defbase", NULL);
965 RNA_def_property_struct_type(prop, "VertexGroup");
966 RNA_def_property_ui_text(prop, "Vertex Groups", "Vertex groups of the object.");
968 prop= RNA_def_property(srna, "active_vertex_group", PROP_POINTER, PROP_NONE);
969 RNA_def_property_struct_type(prop, "VertexGroup");
970 RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", "rna_Object_active_vertex_group_set", NULL);
971 RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object.");
972 RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
974 prop= RNA_def_property(srna, "active_vertex_group_index", PROP_INT, PROP_NONE);
975 RNA_def_property_int_sdna(prop, NULL, "actdef");
976 RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get", "rna_Object_active_vertex_group_index_set", "rna_Object_active_vertex_group_index_range");
977 RNA_def_property_ui_text(prop, "Active Vertex Group Index", "Active index in vertex group array.");
978 RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
982 prop= RNA_def_property(srna, "empty_draw_type", PROP_ENUM, PROP_NONE);
983 RNA_def_property_enum_sdna(prop, NULL, "empty_drawtype");
984 RNA_def_property_enum_items(prop, empty_drawtype_items);
985 RNA_def_property_ui_text(prop, "Empty Draw Type", "Viewport display style for empties.");
986 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
988 prop= RNA_def_property(srna, "empty_draw_size", PROP_FLOAT, PROP_NONE);
989 RNA_def_property_float_sdna(prop, NULL, "empty_drawsize");
990 RNA_def_property_range(prop, 0.01, 10.0);
991 RNA_def_property_ui_text(prop, "Empty Draw Size", "Size of of display for empties in the viewport.");
992 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
996 prop= RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
997 RNA_def_property_int_sdna(prop, NULL, "index");
998 RNA_def_property_ui_text(prop, "Pass Index", "Index # for the IndexOB render pass.");
1000 prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
1001 RNA_def_property_float_sdna(prop, NULL, "col");
1002 RNA_def_property_ui_text(prop, "Color", "Object color and alpha, used when faces have the ObColor mode enabled.");
1006 prop= RNA_def_property(srna, "field", PROP_POINTER, PROP_NONE);
1007 RNA_def_property_pointer_sdna(prop, NULL, "pd");
1008 RNA_def_property_struct_type(prop, "FieldSettings");
1009 RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the objects as a field in physics simulation.");
1011 prop= RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE);
1012 RNA_def_property_pointer_sdna(prop, NULL, "pd");
1013 RNA_def_property_struct_type(prop, "CollisionSettings");
1014 RNA_def_property_ui_text(prop, "Collision Settings", "Settings for using the objects as a collider in physics simulation.");
1016 prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
1017 RNA_def_property_pointer_sdna(prop, NULL, "soft");
1018 RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for soft body simulation.");
1020 prop= RNA_def_property(srna, "particle_systems", PROP_COLLECTION, PROP_NONE);
1021 RNA_def_property_collection_sdna(prop, NULL, "particlesystem", NULL);
1022 RNA_def_property_struct_type(prop, "ParticleSystem");
1023 RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object.");
1025 prop= RNA_def_property(srna, "active_particle_system", PROP_POINTER, PROP_NONE);
1026 RNA_def_property_struct_type(prop, "ParticleSystem");
1027 RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL);
1028 RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed");
1030 prop= RNA_def_property(srna, "active_particle_system_index", PROP_INT, PROP_UNSIGNED);
1031 RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get", "rna_Object_active_particle_system_index_set", "rna_Object_active_particle_system_index_range");
1032 RNA_def_property_ui_text(prop, "Active Particle System Index", "Index of active particle system slot.");
1036 prop= RNA_def_property(srna, "restrict_view", PROP_BOOLEAN, PROP_NONE);
1037 RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEW);
1038 RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport.");
1039 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1041 prop= RNA_def_property(srna, "restrict_select", PROP_BOOLEAN, PROP_NONE);
1042 RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT);
1043 RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport.");
1045 prop= RNA_def_property(srna, "restrict_render", PROP_BOOLEAN, PROP_NONE);
1046 RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER);
1047 RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability.");
1051 rna_def_animdata_common(srna);
1053 prop= RNA_def_property(srna, "draw_keys", PROP_BOOLEAN, PROP_NONE);
1054 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_DRAWKEY);
1055 RNA_def_property_clear_flag(prop, PROP_EDITABLE); // update ipo flag indirect
1056 RNA_def_property_ui_text(prop, "Draw Keys", "Draw object as key positions.");
1058 prop= RNA_def_property(srna, "draw_keys_selected", PROP_BOOLEAN, PROP_NONE);
1059 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_DRAWKEYSEL);
1060 RNA_def_property_ui_text(prop, "Draw Keys Selected", "Limit the drawing of object keys to selected.");
1061 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1063 prop= RNA_def_property(srna, "track_rotation", PROP_BOOLEAN, PROP_NONE);
1064 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_POWERTRACK);
1065 RNA_def_property_ui_text(prop, "Track Rotation", "Switch object rotation of in tracking.");
1067 prop= RNA_def_property(srna, "slow_parent", PROP_BOOLEAN, PROP_NONE);
1068 RNA_def_property_boolean_sdna(prop, NULL, "partype", PARSLOW);
1069 RNA_def_property_ui_text(prop, "Slow Parent", "Create a delay in the parent relationship.");
1071 prop= RNA_def_property(srna, "dupli_type", PROP_ENUM, PROP_NONE);
1072 RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag");
1073 RNA_def_property_enum_items(prop, dupli_items);
1074 RNA_def_property_ui_text(prop, "Dupli Type", "If not None, object duplication method to use.");
1075 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
1077 prop= RNA_def_property(srna, "dupli_frames_no_speed", PROP_BOOLEAN, PROP_NONE);
1078 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED);
1079 RNA_def_property_ui_text(prop, "Dupli Frames No Speed", "Set dupliframes to still, regardless of frame.");
1080 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
1082 prop= RNA_def_property(srna, "dupli_verts_rotation", PROP_BOOLEAN, PROP_NONE);
1083 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT);
1084 RNA_def_property_ui_text(prop, "Dupli Verts Rotation", "Rotate dupli according to vertex normal.");
1085 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1087 prop= RNA_def_property(srna, "dupli_faces_inherit_scale", PROP_BOOLEAN, PROP_NONE);
1088 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT);
1089 RNA_def_property_ui_text(prop, "Dupli Faces Inherit Scale", "Scale dupli based on face size.");
1090 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
1092 prop= RNA_def_property(srna, "dupli_faces_scale", PROP_FLOAT, PROP_NONE);
1093 RNA_def_property_float_sdna(prop, NULL, "dupfacesca");
1094 RNA_def_property_range(prop, 0.001f, 10000.0f);
1095 RNA_def_property_ui_text(prop, "Dupli Faces Scale", "Scale the DupliFace objects.");
1096 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1098 prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
1099 RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
1100 RNA_def_property_flag(prop, PROP_EDITABLE);
1101 RNA_def_property_ui_text(prop, "Dupli Group", "Instance an existing group.");
1102 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
1104 prop= RNA_def_property(srna, "dupli_frames_start", PROP_INT, PROP_NONE);
1105 RNA_def_property_int_sdna(prop, NULL, "dupsta");
1106 RNA_def_property_range(prop, 1, 32767);
1107 RNA_def_property_ui_text(prop, "Dupli Frames Start", "Start frame for DupliFrames.");
1108 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
1110 prop= RNA_def_property(srna, "dupli_frames_end", PROP_INT, PROP_NONE);
1111 RNA_def_property_int_sdna(prop, NULL, "dupend");
1112 RNA_def_property_range(prop, 1, 32767);
1113 RNA_def_property_ui_text(prop, "Dupli Frames End", "End frame for DupliFrames.");
1114 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
1116 prop= RNA_def_property(srna, "dupli_frames_on", PROP_INT, PROP_NONE);
1117 RNA_def_property_int_sdna(prop, NULL, "dupon");
1118 RNA_def_property_range(prop, 1, 1500);
1119 RNA_def_property_ui_text(prop, "Dupli Frames On", "Number of frames to use between DupOff frames.");
1120 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
1122 prop= RNA_def_property(srna, "dupli_frames_off", PROP_INT, PROP_NONE);
1123 RNA_def_property_int_sdna(prop, NULL, "dupoff");
1124 RNA_def_property_range(prop, 0, 1500);
1125 RNA_def_property_ui_text(prop, "Dupli Frames Off", "Recurring frames to exclude from the Dupliframes.");
1126 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
1130 prop= RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE);
1131 RNA_def_property_float_sdna(prop, NULL, "sf");
1132 RNA_def_property_range(prop, -MAXFRAMEF, MAXFRAMEF);
1133 RNA_def_property_ui_text(prop, "Time Offset", "Animation offset in frames for IPO's and dupligroup instances.");
1134 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
1136 prop= RNA_def_property(srna, "time_offset_edit", PROP_BOOLEAN, PROP_NONE);
1137 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_OB);
1138 RNA_def_property_ui_text(prop, "Time Offset Edit", "Use time offset when inserting keys and display time offset for IPO and action views.");
1140 prop= RNA_def_property(srna, "time_offset_parent", PROP_BOOLEAN, PROP_NONE);
1141 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARENT);
1142 RNA_def_property_ui_text(prop, "Time Offset Parent", "Apply the time offset to this objects parent relationship.");
1143 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
1145 prop= RNA_def_property(srna, "time_offset_particle", PROP_BOOLEAN, PROP_NONE);
1146 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARTICLE);
1147 RNA_def_property_ui_text(prop, "Time Offset Particle", "Let the time offset work on the particle effect.");
1148 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
1150 prop= RNA_def_property(srna, "time_offset_add_parent", PROP_BOOLEAN, PROP_NONE);
1151 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARENTADD);
1152 RNA_def_property_ui_text(prop, "Time Offset Add Parent", "Add the parents time offset value");
1153 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
1157 prop= RNA_def_property(srna, "script_link", PROP_POINTER, PROP_NEVER_NULL);
1158 RNA_def_property_pointer_sdna(prop, NULL, "scriptlink");
1159 RNA_def_property_ui_text(prop, "Script Link", "Scripts linked to this object.");
1163 prop= RNA_def_property(srna, "max_draw_type", PROP_ENUM, PROP_NONE);
1164 RNA_def_property_enum_sdna(prop, NULL, "dt");
1165 RNA_def_property_enum_items(prop, drawtype_items);
1166 RNA_def_property_ui_text(prop, "Maximum Draw Type", "Maximum draw type to display object with in viewport.");
1167 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1169 prop= RNA_def_property(srna, "draw_bounds", PROP_BOOLEAN, PROP_NONE);
1170 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_BOUNDBOX);
1171 RNA_def_property_ui_text(prop, "Draw Bounds", "Displays the object's bounds.");
1172 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1174 prop= RNA_def_property(srna, "draw_bounds_type", PROP_ENUM, PROP_NONE);
1175 RNA_def_property_enum_sdna(prop, NULL, "boundtype");
1176 RNA_def_property_enum_items(prop, boundtype_items);
1177 RNA_def_property_ui_text(prop, "Draw Bounds Type", "Object boundary display type.");
1178 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1180 prop= RNA_def_property(srna, "draw_name", PROP_BOOLEAN, PROP_NONE);
1181 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWNAME);
1182 RNA_def_property_ui_text(prop, "Draw Name", "Displays the object's name.");
1183 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1185 prop= RNA_def_property(srna, "draw_axis", PROP_BOOLEAN, PROP_NONE);
1186 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_AXIS);
1187 RNA_def_property_ui_text(prop, "Draw Axis", "Displays the object's center and axis");
1188 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1190 prop= RNA_def_property(srna, "draw_texture_space", PROP_BOOLEAN, PROP_NONE);
1191 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_TEXSPACE);
1192 RNA_def_property_ui_text(prop, "Draw Texture Space", "Displays the object's texture space.");
1193 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1195 prop= RNA_def_property(srna, "draw_wire", PROP_BOOLEAN, PROP_NONE);
1196 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWWIRE);
1197 RNA_def_property_ui_text(prop, "Draw Wire", "Adds the object's wireframe over solid drawing.");
1198 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1200 prop= RNA_def_property(srna, "draw_transparent", PROP_BOOLEAN, PROP_NONE);
1201 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP);
1202 RNA_def_property_ui_text(prop, "Draw Transparent", "Enables transparent materials for the object (Mesh only).");
1203 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1205 prop= RNA_def_property(srna, "x_ray", PROP_BOOLEAN, PROP_NONE);
1206 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY);
1207 RNA_def_property_ui_text(prop, "X-Ray", "Makes the object draw in front of others.");
1208 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1211 prop= RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE);
1212 RNA_def_property_pointer_sdna(prop, NULL, "poselib");
1213 RNA_def_property_struct_type(prop, "Action");
1214 RNA_def_property_ui_text(prop, "Pose Library", "Action used as a pose library for armatures.");
1216 prop= RNA_def_property(srna, "pose", PROP_POINTER, PROP_NONE);
1217 RNA_def_property_pointer_sdna(prop, NULL, "pose");
1218 RNA_def_property_struct_type(prop, "Pose");
1219 RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures.");
1221 prop= RNA_def_property(srna, "pose_mode", PROP_BOOLEAN, PROP_NONE);
1222 RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_POSEMODE);
1223 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1224 RNA_def_property_ui_text(prop, "Pose Mode", "Object with armature data is in pose mode.");
1226 // XXX this stuff should be moved to AnimData...
1228 prop= RNA_def_property(srna, "nla_disable_path", PROP_BOOLEAN, PROP_NONE);
1229 RNA_def_property_boolean_sdna(prop, NULL, "nlaflag", OB_DISABLE_PATH);
1230 RNA_def_property_ui_text(prop, "NLA Disable Path", "Disable path temporally, for editing cycles.");
1232 prop= RNA_def_property(srna, "nla_collapsed", PROP_BOOLEAN, PROP_NONE);
1233 RNA_def_property_boolean_sdna(prop, NULL, "nlaflag", OB_NLA_COLLAPSED);
1234 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1235 RNA_def_property_ui_text(prop, "NLA Collapsed", "");
1237 prop= RNA_def_property(srna, "nla_override", PROP_BOOLEAN, PROP_NONE);
1238 RNA_def_property_boolean_sdna(prop, NULL, "nlaflag", OB_NLA_OVERRIDE);
1239 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1240 RNA_def_property_ui_text(prop, "NLA Override", "");
1242 prop= RNA_def_property(srna, "nla_strips", PROP_COLLECTION, PROP_NONE);
1243 RNA_def_property_collection_sdna(prop, NULL, "nlastrips", NULL);
1244 RNA_def_property_struct_type(prop, "UnknownType");
1245 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1246 RNA_def_property_ui_text(prop, "NLA Strips", "NLA strips of the object.");
1251 prop= RNA_def_property(srna, "shape_key_lock", PROP_BOOLEAN, PROP_NONE);
1252 RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_LOCK);
1253 RNA_def_property_boolean_funcs(prop, NULL, "rna_Object_shape_key_lock_set");
1254 RNA_def_property_ui_text(prop, "Shape Key Lock", "Always show the current Shape for this Object.");
1255 RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
1257 prop= RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE);
1258 RNA_def_property_int_sdna(prop, NULL, "shapenr");
1259 RNA_def_property_int_funcs(prop, "rna_Object_active_shape_key_index_get", "rna_Object_active_shape_key_index_set", "rna_Object_active_shape_key_index_range");
1260 RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index.");
1261 RNA_def_property_update(prop, NC_OBJECT|ND_GEOM_DATA, "rna_Object_update_data");
1263 RNA_api_object(srna);
1266 void RNA_def_object(BlenderRNA *brna)
1268 rna_def_object(brna);
1269 rna_def_object_game_settings(brna);
1270 rna_def_vertex_group(brna);
1271 rna_def_material_slot(brna);