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_types.h"
37 #include "DNA_property_types.h"
38 #include "DNA_scene_types.h"
44 #include "BKE_armature.h"
45 #include "BKE_context.h"
46 #include "BKE_curve.h"
47 #include "BKE_depsgraph.h"
48 #include "BKE_material.h"
50 #include "BKE_particle.h"
52 static void rna_Object_update(bContext *C, PointerRNA *ptr)
54 DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB);
57 static void rna_Object_update_data(bContext *C, PointerRNA *ptr)
59 DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_DATA);
62 static void rna_Object_dependency_update(bContext *C, PointerRNA *ptr)
64 DAG_object_flush_update(CTX_data_scene(C), ptr->id.data, OB_RECALC_OB);
65 DAG_scene_sort(CTX_data_scene(C));
68 static int rna_Object_data_editable(PointerRNA *ptr)
70 Object *ob= (Object*)ptr->data;
72 return (ob->type == OB_EMPTY)? 0: PROP_EDITABLE;
75 static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
77 Object *ob= (Object*)ptr->data;
80 if(ob->type == OB_EMPTY || id == NULL)
83 if(ob->type == OB_MESH) {
84 set_mesh(ob, (Mesh*)id);
88 id_us_min((ID*)ob->data);
93 test_object_materials(id);
95 if(GS(id->name)==ID_CU)
97 else if(ob->type==OB_ARMATURE)
98 armature_rebuild_pose(ob, ob->data);
102 static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
104 Object *ob= (Object*)ptr->data;
107 case OB_MESH: return &RNA_Mesh;
108 case OB_CURVE: return &RNA_Curve;
109 case OB_SURF: return &RNA_Curve;
110 case OB_FONT: return &RNA_Curve;
111 case OB_MBALL: return &RNA_MetaBall;
112 case OB_LAMP: return &RNA_Lamp;
113 case OB_CAMERA: return &RNA_Camera;
114 case OB_LATTICE: return &RNA_Lattice;
115 case OB_ARMATURE: return &RNA_Armature;
116 default: return &RNA_ID;
120 static int rna_VertexGroup_index_get(PointerRNA *ptr)
122 Object *ob= (Object*)ptr->id.data;
124 return BLI_findindex(&ob->defbase, ptr->data);
127 static PointerRNA rna_Object_active_vertex_group_get(PointerRNA *ptr)
129 Object *ob= (Object*)ptr->id.data;
130 return rna_pointer_inherit_refine(ptr, &RNA_VertexGroup, BLI_findlink(&ob->defbase, ob->actdef));
133 void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
135 Object *ob= (Object*)ptr->id.data;
138 dg= BLI_findlink(&ob->defbase, index-1);
140 if(dg) BLI_strncpy(value, dg->name, sizeof(dg->name));
141 else BLI_strncpy(value, "", sizeof(dg->name));
144 int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index)
146 Object *ob= (Object*)ptr->id.data;
149 dg= BLI_findlink(&ob->defbase, index-1);
150 return (dg)? strlen(dg->name): 0;
153 void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
155 Object *ob= (Object*)ptr->id.data;
159 for(a=1, dg=ob->defbase.first; dg; dg=dg->next, a++) {
160 if(strcmp(dg->name, value) == 0) {
169 void rna_object_vgroup_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
171 Object *ob= (Object*)ptr->id.data;
174 for(dg=ob->defbase.first; dg; dg=dg->next) {
175 if(strcmp(dg->name, value) == 0) {
176 BLI_strncpy(result, value, maxlen);
181 BLI_strncpy(result, "", maxlen);
184 void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
186 Object *ob= (Object*)ptr->id.data;
188 CustomDataLayer *layer;
191 if(ob->type == OB_MESH && ob->data) {
194 for(a=0; a<me->fdata.totlayer; a++) {
195 layer= &me->fdata.layers[a];
197 if(layer->type == CD_MTFACE && strcmp(layer->name, value) == 0) {
198 BLI_strncpy(result, value, maxlen);
204 BLI_strncpy(result, "", maxlen);
207 void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
209 Object *ob= (Object*)ptr->id.data;
211 CustomDataLayer *layer;
214 if(ob->type == OB_MESH && ob->data) {
217 for(a=0; a<me->fdata.totlayer; a++) {
218 layer= &me->fdata.layers[a];
220 if(layer->type == CD_MCOL && strcmp(layer->name, value) == 0) {
221 BLI_strncpy(result, value, maxlen);
227 BLI_strncpy(result, "", maxlen);
230 static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, int *max)
232 Object *ob= (Object*)ptr->id.data;
237 static PointerRNA rna_Object_active_material_get(PointerRNA *ptr)
239 Object *ob= (Object*)ptr->id.data;
240 return rna_pointer_inherit_refine(ptr, &RNA_MaterialSlot, ob->mat+ob->actcol);
244 static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value)
246 Object *ob= (Object*)ptr->id.data;
248 assign_material(ob, value.data, ob->actcol);
252 static PointerRNA rna_MaterialSlot_material_get(PointerRNA *ptr)
254 Object *ob= (Object*)ptr->id.data;
256 int index= (Material**)ptr->data - ob->mat;
258 ma= give_current_material(ob, index+1);
259 return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
262 static void rna_MaterialSlot_material_set(PointerRNA *ptr, PointerRNA value)
264 Object *ob= (Object*)ptr->id.data;
265 int index= (Material**)ptr->data - ob->mat;
267 assign_material(ob, value.data, index+1);
270 static int rna_MaterialSlot_link_get(PointerRNA *ptr)
272 Object *ob= (Object*)ptr->id.data;
273 int index= (Material**)ptr->data - ob->mat;
275 return (ob->colbits & (1<<index)) != 0;
278 static void rna_MaterialSlot_link_set(PointerRNA *ptr, int value)
280 Object *ob= (Object*)ptr->id.data;
281 int index= (Material**)ptr->data - ob->mat;
284 ob->colbits |= (1<<index);
286 ob->colbits &= ~(1<<index);
289 static int rna_MaterialSlot_name_length(PointerRNA *ptr)
291 Object *ob= (Object*)ptr->id.data;
293 int index= (Material**)ptr->data - ob->mat;
295 ma= give_current_material(ob, index+1);
298 return strlen(ma->id.name+2);
303 static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str)
305 Object *ob= (Object*)ptr->id.data;
307 int index= (Material**)ptr->data - ob->mat;
309 ma= give_current_material(ob, index+1);
312 strcpy(str, ma->id.name+2);
317 static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr)
319 Object *ob= (Object*)ptr->id.data;
320 ParticleSystem *psys= psys_get_current(ob);
321 return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem, psys);
324 static PointerRNA rna_Object_game_settings_get(PointerRNA *ptr)
326 return rna_pointer_inherit_refine(ptr, &RNA_GameObjectSettings, ptr->id.data);
329 static void rna_Object_layer_set(PointerRNA *ptr, const int *values)
331 Object *ob= (Object*)ptr->data;
334 /* ensure we always have some layer selected */
342 for(i=0; i<20; i++) {
343 if(values[i]) ob->lay |= (1<<i);
344 else ob->lay &= ~(1<<i);
348 static void rna_GameObjectSettings_state_set(PointerRNA *ptr, const int *values)
350 Object *ob= (Object*)ptr->data;
353 /* ensure we always have some state selected */
361 for(i=0; i<20; i++) {
362 if(values[i]) ob->state |= (1<<i);
363 else ob->state &= ~(1<<i);
369 static void rna_def_vertex_group(BlenderRNA *brna)
374 srna= RNA_def_struct(brna, "VertexGroup", NULL);
375 RNA_def_struct_sdna(srna, "bDeformGroup");
376 RNA_def_struct_ui_text(srna, "Vertex Group", "Group of vertices, used for armature deform and other purposes.");
377 RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
379 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
380 RNA_def_property_ui_text(prop, "Name", "Vertex group name.");
381 RNA_def_struct_name_property(srna, prop);
383 prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
384 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
385 RNA_def_property_int_funcs(prop, "rna_VertexGroup_index_get", NULL, NULL);
386 RNA_def_property_ui_text(prop, "Index", "Index number of the vertex group.");
389 static void rna_def_material_slot(BlenderRNA *brna)
394 static EnumPropertyItem link_items[] = {
395 {0, "DATA", 0, "Data", ""},
396 {1, "OBJECT", 0, "Object", ""},
397 {0, NULL, 0, NULL, NULL}};
399 /* NOTE: there is no MaterialSlot equivalent in DNA, so the internal
400 * pointer data points to ob->mat + index, and we manually implement
401 * get/set for the properties. */
403 srna= RNA_def_struct(brna, "MaterialSlot", NULL);
404 RNA_def_struct_ui_text(srna, "Material Slot", "Material slot in an object.");
405 RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
407 prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
408 RNA_def_property_struct_type(prop, "Material");
409 RNA_def_property_flag(prop, PROP_EDITABLE);
410 RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", "rna_MaterialSlot_material_set", NULL);
411 RNA_def_property_ui_text(prop, "Material", "Material datablock used by this material slot.");
413 prop= RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
414 RNA_def_property_enum_items(prop, link_items);
415 RNA_def_property_enum_funcs(prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL);
416 RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data.");
418 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
419 RNA_def_property_string_funcs(prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL);
420 RNA_def_property_ui_text(prop, "Name", "Material slot name.");
421 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
422 RNA_def_struct_name_property(srna, prop);
425 static void rna_def_object_game_settings(BlenderRNA *brna)
430 static EnumPropertyItem body_type_items[] = {
431 {OB_BODY_TYPE_NO_COLLISION, "NO_COLLISION", 0, "No Collision", ""},
432 {OB_BODY_TYPE_STATIC, "STATIC", 0, "Static", ""},
433 {OB_BODY_TYPE_DYNAMIC, "DYNAMIC", 0, "Dynamic", ""},
434 {OB_BODY_TYPE_RIGID, "RIGID_BODY", 0, "Rigid Body", ""},
435 {OB_BODY_TYPE_SOFT, "SOFT_BODY", 0, "Soft Body", ""},
436 {0, NULL, 0, NULL, NULL}};
438 static EnumPropertyItem collision_bounds_items[] = {
439 {OB_BOUND_BOX, "BOX", 0, "Box", ""},
440 {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""},
441 {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", ""},
442 {OB_BOUND_CONE, "CONE", 0, "Cone", ""},
443 {OB_BOUND_POLYH, "CONVEX_HULL", 0, "Convex Hull", ""},
444 {OB_BOUND_POLYT, "TRIANGLE_MESH", 0, "Triangle Mesh", ""},
445 //{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""},
446 {0, NULL, 0, NULL, NULL}};
448 srna= RNA_def_struct(brna, "GameObjectSettings", NULL);
449 RNA_def_struct_sdna(srna, "Object");
450 RNA_def_struct_nested(brna, srna, "Object");
451 RNA_def_struct_ui_text(srna, "Game Object Settings", "Game engine related settings for the object.");
452 RNA_def_struct_ui_icon(srna, ICON_GAME);
456 prop= RNA_def_property(srna, "sensors", PROP_COLLECTION, PROP_NONE);
457 RNA_def_property_struct_type(prop, "Sensor");
458 RNA_def_property_ui_text(prop, "Sensors", "Game engine sensor to detect events.");
460 prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE);
461 RNA_def_property_struct_type(prop, "Controller");
462 RNA_def_property_ui_text(prop, "Controllers", "Game engine controllers to process events, connecting sensor to actuators.");
464 prop= RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE);
465 RNA_def_property_struct_type(prop, "Actuator");
466 RNA_def_property_ui_text(prop, "Actuators", "Game engine actuators to act on events.");
468 prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
469 RNA_def_property_collection_sdna(prop, NULL, "prop", NULL);
470 RNA_def_property_struct_type(prop, "GameProperty");
471 RNA_def_property_ui_text(prop, "Properties", "Game engine properties.");
473 prop= RNA_def_property(srna, "show_sensors", PROP_BOOLEAN, PROP_NONE);
474 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWSENS);
475 RNA_def_property_ui_text(prop, "Show Sensors", "Shows sensors for this object in the user interface.");
477 prop= RNA_def_property(srna, "show_controllers", PROP_BOOLEAN, PROP_NONE);
478 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWCONT);
479 RNA_def_property_ui_text(prop, "Show Controllers", "Shows controllers for this object in the user interface.");
481 prop= RNA_def_property(srna, "show_actuators", PROP_BOOLEAN, PROP_NONE);
482 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWACT);
483 RNA_def_property_ui_text(prop, "Show Actuators", "Shows actuators for this object in the user interface.");
487 prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
488 RNA_def_property_enum_sdna(prop, NULL, "body_type");
489 RNA_def_property_enum_items(prop, body_type_items);
490 RNA_def_property_clear_flag(prop, PROP_EDITABLE); // this controls various gameflags
491 RNA_def_property_ui_text(prop, "Physics Type", "Selects the type of physical representation.");
493 prop= RNA_def_property(srna, "actor", PROP_BOOLEAN, PROP_NONE);
494 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ACTOR);
495 RNA_def_property_ui_text(prop, "Actor", "Object is detected by the Near and Radar sensor.");
497 prop= RNA_def_property(srna, "ghost", PROP_BOOLEAN, PROP_NONE);
498 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_GHOST);
499 RNA_def_property_ui_text(prop, "Ghost", "Object does not restitute collisions, like a ghost.");
501 prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
502 RNA_def_property_range(prop, 0.01, 10000.0);
503 RNA_def_property_ui_text(prop, "Mass", "Mass of the object.");
505 prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
506 RNA_def_property_float_sdna(prop, NULL, "inertia");
507 RNA_def_property_range(prop, 0.01, 10.0);
508 RNA_def_property_ui_text(prop, "Radius", "Radius for Bounding sphere and Fh/Fh Rot.");
509 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
511 prop= RNA_def_property(srna, "no_sleeping", PROP_BOOLEAN, PROP_NONE);
512 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_COLLISION_RESPONSE);
513 RNA_def_property_ui_text(prop, "No Sleeping", "Disable auto (de)activation in physics simulation.");
515 prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
516 RNA_def_property_float_sdna(prop, NULL, "damping");
517 RNA_def_property_range(prop, 0.0, 1.0);
518 RNA_def_property_ui_text(prop, "Damping", "General movement damping.");
520 prop= RNA_def_property(srna, "rotation_damping", PROP_FLOAT, PROP_NONE);
521 RNA_def_property_float_sdna(prop, NULL, "rdamping");
522 RNA_def_property_range(prop, 0.0, 1.0);
523 RNA_def_property_ui_text(prop, "Rotation Damping", "General rotation damping.");
525 prop= RNA_def_property(srna, "minimum_velocity", PROP_FLOAT, PROP_NONE);
526 RNA_def_property_float_sdna(prop, NULL, "min_vel");
527 RNA_def_property_range(prop, 0.0, 1000.0);
528 RNA_def_property_ui_text(prop, "Velocity Min", "Clamp velocity to this minimum speed (except when totally still).");
530 prop= RNA_def_property(srna, "maximum_velocity", PROP_FLOAT, PROP_NONE);
531 RNA_def_property_float_sdna(prop, NULL, "max_vel");
532 RNA_def_property_range(prop, 0.0, 1000.0);
533 RNA_def_property_ui_text(prop, "Velocity Max", "Clamp velocity to this maximum speed.");
536 prop= RNA_def_property(srna, "lock_x_axis", PROP_BOOLEAN, PROP_NONE);
537 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_AXIS);
538 RNA_def_property_ui_text(prop, "Lock X Axis", "Disable simulation of linear motion along the X axis.");
540 prop= RNA_def_property(srna, "lock_y_axis", PROP_BOOLEAN, PROP_NONE);
541 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_AXIS);
542 RNA_def_property_ui_text(prop, "Lock Y Axis", "Disable simulation of linear motion along the Y axis.");
544 prop= RNA_def_property(srna, "lock_z_axis", PROP_BOOLEAN, PROP_NONE);
545 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_AXIS);
546 RNA_def_property_ui_text(prop, "Lock Z Axis", "Disable simulation of linear motion along the Z axis.");
550 prop= RNA_def_property(srna, "lock_x_rot_axis", PROP_BOOLEAN, PROP_NONE);
551 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_ROT_AXIS);
552 RNA_def_property_ui_text(prop, "Lock X Rotation Axis", "Disable simulation of angular motion along the X axis.");
554 prop= RNA_def_property(srna, "lock_y_rot_axis", PROP_BOOLEAN, PROP_NONE);
555 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_ROT_AXIS);
556 RNA_def_property_ui_text(prop, "Lock Y Rotation Axis", "Disable simulation of angular motion along the Y axis.");
558 prop= RNA_def_property(srna, "lock_z_rot_axis", PROP_BOOLEAN, PROP_NONE);
559 RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_ROT_AXIS);
560 RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis.");
562 /* is this used anywhere ? */
563 prop= RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
564 RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflag2", OB_NEVER_DO_ACTIVITY_CULLING);
565 RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis.");
568 prop= RNA_def_property(srna, "do_fh", PROP_BOOLEAN, PROP_NONE);
569 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_DO_FH);
570 RNA_def_property_ui_text(prop, "Do Fh", "Use Fh settings in materials.");
572 prop= RNA_def_property(srna, "rotation_fh", PROP_BOOLEAN, PROP_NONE);
573 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ROT_FH);
574 RNA_def_property_ui_text(prop, "Rotation Fh", "Use face normal to rotate Object");
576 prop= RNA_def_property(srna, "form_factor", PROP_FLOAT, PROP_NONE);
577 RNA_def_property_float_sdna(prop, NULL, "formfactor");
578 RNA_def_property_range(prop, 0.0, 1.0);
579 RNA_def_property_ui_text(prop, "Form Factor", "Form factor scales the inertia tensor.");
581 prop= RNA_def_property(srna, "anisotropic_friction", PROP_BOOLEAN, PROP_NONE);
582 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ANISOTROPIC_FRICTION);
583 RNA_def_property_ui_text(prop, "Anisotropic Friction", "Enable anisotropic friction.");
585 prop= RNA_def_property(srna, "friction_coefficients", PROP_FLOAT, PROP_VECTOR);
586 RNA_def_property_float_sdna(prop, NULL, "anisotropicFriction");
587 RNA_def_property_range(prop, 0.0, 1.0);
588 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.");
590 prop= RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE);
591 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_BOUNDS);
592 RNA_def_property_ui_text(prop, "Use Collision Bounds", "Specify a collision bounds type other than the default.");
594 prop= RNA_def_property(srna, "collision_bounds", PROP_ENUM, PROP_NONE);
595 RNA_def_property_enum_sdna(prop, NULL, "boundtype");
596 RNA_def_property_enum_items(prop, collision_bounds_items);
597 RNA_def_property_ui_text(prop, "Collision Bounds", "Selects the collision type.");
599 prop= RNA_def_property(srna, "collision_compound", PROP_BOOLEAN, PROP_NONE);
600 RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_CHILD);
601 RNA_def_property_ui_text(prop, "Collison Compound", "Add children to form a compound collision object.");
603 prop= RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE);
604 RNA_def_property_float_sdna(prop, NULL, "margin");
605 RNA_def_property_range(prop, 0.0, 1.0);
606 RNA_def_property_ui_text(prop, "Collision Margin", "Extra margin around object for collision detection, small amount required for stability.");
608 prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
609 RNA_def_property_pointer_sdna(prop, NULL, "bsoft");
610 RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for Bullet soft body simulation.");
614 prop= RNA_def_property(srna, "state", PROP_BOOLEAN, PROP_NONE);
615 RNA_def_property_boolean_sdna(prop, NULL, "state", 1);
616 RNA_def_property_array(prop, 30);
617 RNA_def_property_ui_text(prop, "State", "State determining which controllers are displayed.");
618 RNA_def_property_boolean_funcs(prop, NULL, "rna_GameObjectSettings_state_set");
620 prop= RNA_def_property(srna, "initial_state", PROP_BOOLEAN, PROP_NONE);
621 RNA_def_property_boolean_sdna(prop, NULL, "init_state", 1);
622 RNA_def_property_array(prop, 30);
623 RNA_def_property_ui_text(prop, "Initial State", "Initial state when the game starts.");
625 prop= RNA_def_property(srna, "debug_state", PROP_BOOLEAN, PROP_NONE);
626 RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_DEBUGSTATE);
627 RNA_def_property_ui_text(prop, "Debug State", "Print state debug info in the game engine.");
630 static void rna_def_object(BlenderRNA *brna)
635 static EnumPropertyItem parent_type_items[] = {
636 {PAROBJECT, "OBJECT", 0, "Object", ""},
637 {PARCURVE, "CURVE", 0, "Curve", ""},
638 //{PARKEY, "KEY", 0, "Key", ""},
639 {PARSKEL, "ARMATURE", 0, "Armature", ""},
640 {PARSKEL, "LATTICE", 0, "Lattice", ""}, // PARSKEL reuse will give issues
641 {PARVERT1, "VERTEX", 0, "Vertex", ""},
642 {PARVERT3, "VERTEX_3", 0, "3 Vertices", ""},
643 {PARBONE, "BONE", 0, "Bone", ""},
644 {0, NULL, 0, NULL, NULL}};
646 static EnumPropertyItem object_type_items[] = {
647 {OB_EMPTY, "EMPTY", 0, "Empty", ""},
648 {OB_MESH, "MESH", 0, "Mesh", ""},
649 {OB_CURVE, "CURVE", 0, "Curve", ""},
650 {OB_SURF, "SURFACE", 0, "Surface", ""},
651 {OB_FONT, "TEXT", 0, "Text", ""},
652 {OB_MBALL, "META", 0, "Meta", ""},
653 {OB_LAMP, "LAMP", 0, "Lamp", ""},
654 {OB_CAMERA, "CAMERA", 0, "Camera", ""},
655 {OB_WAVE, "WAVE", 0, "Wave", ""},
656 {OB_LATTICE, "LATTICE", 0, "Lattice", ""},
657 {OB_ARMATURE, "ARMATURE", 0, "Armature", ""},
658 {0, NULL, 0, NULL, NULL}};
660 static EnumPropertyItem empty_drawtype_items[] = {
661 {OB_ARROWS, "ARROWS", 0, "Arrows", ""},
662 {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""},
663 {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""},
664 {OB_CIRCLE, "CIRCLE", 0, "Circle", ""},
665 {OB_CUBE, "CUBE", 0, "Cube", ""},
666 {OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""},
667 {OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
668 {0, NULL, 0, NULL, NULL}};
670 static EnumPropertyItem track_items[] = {
671 {OB_POSX, "POSX", 0, "+X", ""},
672 {OB_POSY, "POSY", 0, "+Y", ""},
673 {OB_POSZ, "POSZ", 0, "+Z", ""},
674 {OB_NEGX, "NEGX", 0, "-X", ""},
675 {OB_NEGY, "NEGY", 0, "-Y", ""},
676 {OB_NEGZ, "NEGZ", 0, "-Z", ""},
677 {0, NULL, 0, NULL, NULL}};
679 static EnumPropertyItem up_items[] = {
680 {OB_POSX, "X", 0, "X", ""},
681 {OB_POSY, "Y", 0, "Y", ""},
682 {OB_POSZ, "Z", 0, "Z", ""},
683 {0, NULL, 0, NULL, NULL}};
685 static EnumPropertyItem drawtype_items[] = {
686 {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", ""},
687 {OB_WIRE, "WIRE", 0, "Wire", ""},
688 {OB_SOLID, "SOLID", 0, "Solid", ""},
689 {OB_SHADED, "SHADED", 0, "Shaded", ""},
690 {OB_TEXTURE, "TEXTURED", 0, "Textured", ""},
691 {0, NULL, 0, NULL, NULL}};
693 static EnumPropertyItem boundtype_items[] = {
694 {OB_BOUND_BOX, "BOX", 0, "Box", ""},
695 {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""},
696 {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", ""},
697 {OB_BOUND_CONE, "CONE", 0, "Cone", ""},
698 {OB_BOUND_POLYH, "POLYHEDER", 0, "Polyheder", ""},
699 {0, NULL, 0, NULL, NULL}};
701 static EnumPropertyItem dupli_items[] = {
702 {0, "NONE", 0, "None", ""},
703 {OB_DUPLIFRAMES, "FRAMES", 0, "Frames", "Make copy of object for every frame."},
704 {OB_DUPLIVERTS, "VERTS", 0, "Verts", "Duplicate child objects on all vertices."},
705 {OB_DUPLIFACES, "FACES", 0, "Faces", "Duplicate child objects on all faces."},
706 {OB_DUPLIGROUP, "GROUP", 0, "Group", "Enable group instancing."},
707 {0, NULL, 0, NULL, NULL}};
709 srna= RNA_def_struct(brna, "Object", "ID");
710 RNA_def_struct_ui_text(srna, "Object", "Object datablock defining an object in a scene..");
711 RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
712 RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
714 prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
715 RNA_def_property_struct_type(prop, "ID");
716 RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_data_set", "rna_Object_data_typef");
717 RNA_def_property_editable_func(prop, "rna_Object_data_editable");
718 RNA_def_property_flag(prop, PROP_EDITABLE);
719 RNA_def_property_ui_text(prop, "Data", "Object data.");
720 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update_data");
722 prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_NONE);
723 RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
724 RNA_def_property_array(prop, 20);
725 RNA_def_property_ui_text(prop, "Layers", "Layers the object is on.");
726 RNA_def_property_boolean_funcs(prop, NULL, "rna_Object_layer_set");
728 prop= RNA_def_property(srna, "selected", PROP_BOOLEAN, PROP_NONE);
729 RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
730 RNA_def_property_ui_text(prop, "Selected", "Object selection state.");
732 /* parent and track */
734 prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
735 RNA_def_property_ui_text(prop, "Parent", "Parent Object");
737 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
738 RNA_def_property_enum_sdna(prop, NULL, "type");
739 RNA_def_property_enum_items(prop, object_type_items);
740 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
741 RNA_def_property_ui_text(prop, "Type", "Type of Object.");
743 prop= RNA_def_property(srna, "parent_type", PROP_ENUM, PROP_NONE);
744 RNA_def_property_enum_sdna(prop, NULL, "partype");
745 RNA_def_property_enum_items(prop, parent_type_items);
746 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
747 RNA_def_property_ui_text(prop, "Parent Type", "Type of parent relation.");
749 prop= RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED);
750 RNA_def_property_int_sdna(prop, NULL, "par1");
751 RNA_def_property_array(prop, 3);
752 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
753 RNA_def_property_ui_text(prop, "Parent Vertices", "Indices of vertices in cases of a vertex parenting relation.");
755 prop= RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
756 RNA_def_property_string_sdna(prop, NULL, "parsubstr");
757 RNA_def_property_ui_text(prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation.");
759 prop= RNA_def_property(srna, "track", PROP_POINTER, PROP_NONE);
760 RNA_def_property_flag(prop, PROP_EDITABLE);
761 RNA_def_property_ui_text(prop, "Track", "Object being tracked to define the rotation (Old Track).");
763 prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
764 RNA_def_property_enum_sdna(prop, NULL, "trackflag");
765 RNA_def_property_enum_items(prop, track_items);
766 RNA_def_property_ui_text(prop, "Track Axis", "Tracking axis pointing to the another object.");
768 prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
769 RNA_def_property_enum_sdna(prop, NULL, "upflag");
770 RNA_def_property_enum_items(prop, up_items);
771 RNA_def_property_ui_text(prop, "Up Axis", "Specify the axis that points up.");
775 prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
776 RNA_def_property_ui_text(prop, "Proxy", "Library object this proxy object controls.");
778 prop= RNA_def_property(srna, "proxy_group", PROP_POINTER, PROP_NONE);
779 RNA_def_property_ui_text(prop, "Proxy Group", "Library group duplicator object this proxy object controls.");
782 prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
783 RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
784 RNA_def_property_struct_type(prop, "MaterialSlot");
785 RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", 0, 0, 0, 0, 0); /* don't dereference pointer! */
786 RNA_def_property_ui_text(prop, "Materials", "Material slots in the object.");
788 prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
789 RNA_def_property_struct_type(prop, "MaterialSlot");
790 RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", NULL, NULL);
791 RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed.");
793 prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
794 RNA_def_property_int_sdna(prop, NULL, "actcol");
795 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Object_active_material_index_range");
796 RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot.");
800 prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_VECTOR);
801 RNA_def_property_float_sdna(prop, NULL, "loc");
802 RNA_def_property_ui_text(prop, "Location", "Location of the object.");
803 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
805 prop= RNA_def_property(srna, "delta_location", PROP_FLOAT, PROP_VECTOR);
806 RNA_def_property_float_sdna(prop, NULL, "dloc");
807 RNA_def_property_ui_text(prop, "Delta Location", "Extra added translation to object location.");
808 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
810 prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ROTATION);
811 RNA_def_property_float_sdna(prop, NULL, "rot");
812 RNA_def_property_ui_text(prop, "Rotation", "Rotation of the object.");
813 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
815 prop= RNA_def_property(srna, "delta_rotation", PROP_FLOAT, PROP_ROTATION);
816 RNA_def_property_float_sdna(prop, NULL, "drot");
817 RNA_def_property_ui_text(prop, "Delta Rotation", "Extra added rotation to the rotation of the object.");
818 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
820 prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_VECTOR);
821 RNA_def_property_float_sdna(prop, NULL, "size");
822 RNA_def_property_ui_text(prop, "Scale", "Scaling of the object.");
823 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
825 prop= RNA_def_property(srna, "delta_scale", PROP_FLOAT, PROP_VECTOR);
826 RNA_def_property_float_sdna(prop, NULL, "dsize");
827 RNA_def_property_ui_text(prop, "Delta Scale", "Extra added scaling to the scale of the object.");
828 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
830 prop= RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_VECTOR);
831 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX);
832 RNA_def_property_array(prop, 3);
833 RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location in the interface.");
835 prop= RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_VECTOR);
836 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX);
837 RNA_def_property_array(prop, 3);
838 RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation in the interface.");
840 prop= RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_VECTOR);
841 RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX);
842 RNA_def_property_array(prop, 3);
843 RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface.");
846 prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
847 RNA_def_property_float_sdna(prop, NULL, "obmat");
848 RNA_def_property_array(prop, 16);
849 RNA_def_property_ui_text(prop, "Matrix", "Transformation matrix.");
852 prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
853 RNA_def_property_struct_type(prop, "Constraint");
854 RNA_def_property_ui_text(prop, "Constraints", "Constraints of the object.");
856 prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
857 RNA_def_property_struct_type(prop, "Modifier");
858 RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the geometric data of the Object.");
862 prop= RNA_def_property(srna, "game", PROP_POINTER, PROP_NEVER_NULL);
863 RNA_def_property_struct_type(prop, "GameObjectSettings");
864 RNA_def_property_pointer_funcs(prop, "rna_Object_game_settings_get", NULL, NULL);
865 RNA_def_property_ui_text(prop, "Game Settings", "Game engine related settings for the object.");
869 prop= RNA_def_property(srna, "vertex_groups", PROP_COLLECTION, PROP_NONE);
870 RNA_def_property_collection_sdna(prop, NULL, "defbase", NULL);
871 RNA_def_property_struct_type(prop, "VertexGroup");
872 RNA_def_property_ui_text(prop, "Vertex Groups", "Vertex groups of the object.");
874 prop= RNA_def_property(srna, "active_vertex_group", PROP_POINTER, PROP_NONE);
875 RNA_def_property_struct_type(prop, "VertexGroup");
876 RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", NULL, NULL);
877 RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object.");
881 prop= RNA_def_property(srna, "empty_draw_type", PROP_ENUM, PROP_NONE);
882 RNA_def_property_enum_sdna(prop, NULL, "empty_drawtype");
883 RNA_def_property_enum_items(prop, empty_drawtype_items);
884 RNA_def_property_ui_text(prop, "Empty Draw Type", "Viewport display style for empties.");
885 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
887 prop= RNA_def_property(srna, "empty_draw_size", PROP_FLOAT, PROP_NONE);
888 RNA_def_property_float_sdna(prop, NULL, "empty_drawsize");
889 RNA_def_property_range(prop, 0.01, 10.0);
890 RNA_def_property_ui_text(prop, "Empty Draw Size", "Size of of display for empties in the viewport.");
891 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
895 prop= RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
896 RNA_def_property_int_sdna(prop, NULL, "index");
897 RNA_def_property_ui_text(prop, "Pass Index", "Index # for the IndexOB render pass.");
899 prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
900 RNA_def_property_float_sdna(prop, NULL, "col");
901 RNA_def_property_ui_text(prop, "Color", "Object color and alpha, used when faces have the ObColor mode enabled.");
905 prop= RNA_def_property(srna, "field", PROP_POINTER, PROP_NONE);
906 RNA_def_property_pointer_sdna(prop, NULL, "pd");
907 RNA_def_property_struct_type(prop, "FieldSettings");
908 RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the objects as a field in physics simulation.");
910 prop= RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE);
911 RNA_def_property_pointer_sdna(prop, NULL, "pd");
912 RNA_def_property_struct_type(prop, "CollisionSettings");
913 RNA_def_property_ui_text(prop, "Collision Settings", "Settings for using the objects as a collider in physics simulation.");
915 prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
916 RNA_def_property_pointer_sdna(prop, NULL, "soft");
917 RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for soft body simulation.");
919 prop= RNA_def_property(srna, "particle_systems", PROP_COLLECTION, PROP_NONE);
920 RNA_def_property_collection_sdna(prop, NULL, "particlesystem", NULL);
921 RNA_def_property_struct_type(prop, "ParticleSystem");
922 RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object.");
924 prop= RNA_def_property(srna, "active_particle_system", PROP_POINTER, PROP_NONE);
925 RNA_def_property_struct_type(prop, "ParticleSystem");
926 RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL);
927 RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed");
931 prop= RNA_def_property(srna, "restrict_view", PROP_BOOLEAN, PROP_NONE);
932 RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEW);
933 RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport.");
934 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
936 prop= RNA_def_property(srna, "restrict_select", PROP_BOOLEAN, PROP_NONE);
937 RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT);
938 RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport.");
940 prop= RNA_def_property(srna, "restrict_render", PROP_BOOLEAN, PROP_NONE);
941 RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER);
942 RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability.");
946 rna_def_animdata_common(srna);
948 prop= RNA_def_property(srna, "draw_keys", PROP_BOOLEAN, PROP_NONE);
949 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_DRAWKEY);
950 RNA_def_property_clear_flag(prop, PROP_EDITABLE); // update ipo flag indirect
951 RNA_def_property_ui_text(prop, "Draw Keys", "Draw object as key positions.");
953 prop= RNA_def_property(srna, "draw_keys_selected", PROP_BOOLEAN, PROP_NONE);
954 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_DRAWKEYSEL);
955 RNA_def_property_ui_text(prop, "Draw Keys Selected", "Limit the drawing of object keys to selected.");
956 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
958 prop= RNA_def_property(srna, "track_rotation", PROP_BOOLEAN, PROP_NONE);
959 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_POWERTRACK);
960 RNA_def_property_ui_text(prop, "Track Rotation", "Switch object rotation of in tracking.");
962 prop= RNA_def_property(srna, "slow_parent", PROP_BOOLEAN, PROP_NONE);
963 RNA_def_property_boolean_sdna(prop, NULL, "partype", PARSLOW);
964 RNA_def_property_ui_text(prop, "Slow Parent", "Create a delay in the parent relationship.");
966 prop= RNA_def_property(srna, "dupli_type", PROP_ENUM, PROP_NONE);
967 RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag");
968 RNA_def_property_enum_items(prop, dupli_items);
969 RNA_def_property_ui_text(prop, "Dupli Type", "If not None, object duplication method to use.");
970 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
972 prop= RNA_def_property(srna, "dupli_frames_no_speed", PROP_BOOLEAN, PROP_NONE);
973 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED);
974 RNA_def_property_ui_text(prop, "Dupli Frames No Speed", "Set dupliframes to still, regardless of frame.");
975 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
977 prop= RNA_def_property(srna, "dupli_verts_rotation", PROP_BOOLEAN, PROP_NONE);
978 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT);
979 RNA_def_property_ui_text(prop, "Dupli Verts Rotation", "Rotate dupli according to vertex normal.");
980 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
982 prop= RNA_def_property(srna, "dupli_faces_inherit_scale", PROP_BOOLEAN, PROP_NONE);
983 RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT);
984 RNA_def_property_ui_text(prop, "Dupli Faces Inherit Scale", "Scale dupli based on face size.");
985 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
987 prop= RNA_def_property(srna, "dupli_faces_scale", PROP_FLOAT, PROP_NONE);
988 RNA_def_property_float_sdna(prop, NULL, "dupfacesca");
989 RNA_def_property_range(prop, 0.001f, 10000.0f);
990 RNA_def_property_ui_text(prop, "Dupli Faces Scale", "Scale the DupliFace objects.");
991 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
993 prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
994 RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
995 RNA_def_property_flag(prop, PROP_EDITABLE);
996 RNA_def_property_ui_text(prop, "Dupli Group", "Instance an existing group.");
997 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
999 prop= RNA_def_property(srna, "dupli_frames_start", PROP_INT, PROP_NONE);
1000 RNA_def_property_int_sdna(prop, NULL, "dupsta");
1001 RNA_def_property_range(prop, 1, 32767);
1002 RNA_def_property_ui_text(prop, "Dupli Frames Start", "Start frame for DupliFrames.");
1003 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
1005 prop= RNA_def_property(srna, "dupli_frames_end", PROP_INT, PROP_NONE);
1006 RNA_def_property_int_sdna(prop, NULL, "dupend");
1007 RNA_def_property_range(prop, 1, 32767);
1008 RNA_def_property_ui_text(prop, "Dupli Frames End", "End frame for DupliFrames.");
1009 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
1011 prop= RNA_def_property(srna, "dupli_frames_on", PROP_INT, PROP_NONE);
1012 RNA_def_property_int_sdna(prop, NULL, "dupon");
1013 RNA_def_property_range(prop, 1, 1500);
1014 RNA_def_property_ui_text(prop, "Dupli Frames On", "Number of frames to use between DupOff frames.");
1015 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
1017 prop= RNA_def_property(srna, "dupli_frames_off", PROP_INT, PROP_NONE);
1018 RNA_def_property_int_sdna(prop, NULL, "dupoff");
1019 RNA_def_property_range(prop, 0, 1500);
1020 RNA_def_property_ui_text(prop, "Dupli Frames Off", "Recurring frames to exclude from the Dupliframes.");
1021 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
1025 prop= RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE);
1026 RNA_def_property_float_sdna(prop, NULL, "sf");
1027 RNA_def_property_range(prop, -MAXFRAMEF, MAXFRAMEF);
1028 RNA_def_property_ui_text(prop, "Time Offset", "Animation offset in frames for IPO's and dupligroup instances.");
1029 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
1031 prop= RNA_def_property(srna, "time_offset_edit", PROP_BOOLEAN, PROP_NONE);
1032 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_OB);
1033 RNA_def_property_ui_text(prop, "Time Offset Edit", "Use time offset when inserting keys and display time offset for IPO and action views.");
1035 prop= RNA_def_property(srna, "time_offset_parent", PROP_BOOLEAN, PROP_NONE);
1036 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARENT);
1037 RNA_def_property_ui_text(prop, "Time Offset Parent", "Apply the time offset to this objects parent relationship.");
1038 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
1040 prop= RNA_def_property(srna, "time_offset_particle", PROP_BOOLEAN, PROP_NONE);
1041 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARTICLE);
1042 RNA_def_property_ui_text(prop, "Time Offset Particle", "Let the time offset work on the particle effect.");
1043 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
1045 prop= RNA_def_property(srna, "time_offset_add_parent", PROP_BOOLEAN, PROP_NONE);
1046 RNA_def_property_boolean_sdna(prop, NULL, "ipoflag", OB_OFFS_PARENTADD);
1047 RNA_def_property_ui_text(prop, "Time Offset Add Parent", "Add the parents time offset value");
1048 RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_update");
1052 prop= RNA_def_property(srna, "script_link", PROP_POINTER, PROP_NEVER_NULL);
1053 RNA_def_property_pointer_sdna(prop, NULL, "scriptlink");
1054 RNA_def_property_ui_text(prop, "Script Link", "Scripts linked to this object.");
1058 prop= RNA_def_property(srna, "max_draw_type", PROP_ENUM, PROP_NONE);
1059 RNA_def_property_enum_sdna(prop, NULL, "dt");
1060 RNA_def_property_enum_items(prop, drawtype_items);
1061 RNA_def_property_ui_text(prop, "Maximum Draw Type", "Maximum draw type to display object with in viewport.");
1062 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1064 prop= RNA_def_property(srna, "draw_bounds", PROP_BOOLEAN, PROP_NONE);
1065 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_BOUNDBOX);
1066 RNA_def_property_ui_text(prop, "Draw Bounds", "Displays the object's bounds.");
1067 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1069 prop= RNA_def_property(srna, "draw_bounds_type", PROP_ENUM, PROP_NONE);
1070 RNA_def_property_enum_sdna(prop, NULL, "boundtype");
1071 RNA_def_property_enum_items(prop, boundtype_items);
1072 RNA_def_property_ui_text(prop, "Draw Bounds Type", "Object boundary display type.");
1073 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1075 prop= RNA_def_property(srna, "draw_name", PROP_BOOLEAN, PROP_NONE);
1076 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWNAME);
1077 RNA_def_property_ui_text(prop, "Draw Name", "Displays the object's name.");
1078 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1080 prop= RNA_def_property(srna, "draw_axis", PROP_BOOLEAN, PROP_NONE);
1081 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_AXIS);
1082 RNA_def_property_ui_text(prop, "Draw Axis", "Displays the object's center and axis");
1083 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1085 prop= RNA_def_property(srna, "draw_texture_space", PROP_BOOLEAN, PROP_NONE);
1086 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_TEXSPACE);
1087 RNA_def_property_ui_text(prop, "Draw Texture Space", "Displays the object's texture space.");
1088 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1090 prop= RNA_def_property(srna, "draw_wire", PROP_BOOLEAN, PROP_NONE);
1091 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWWIRE);
1092 RNA_def_property_ui_text(prop, "Draw Wire", "Adds the object's wireframe over solid drawing.");
1093 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1095 prop= RNA_def_property(srna, "draw_transparent", PROP_BOOLEAN, PROP_NONE);
1096 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP);
1097 RNA_def_property_ui_text(prop, "Draw Transparent", "Enables transparent materials for the object (Mesh only).");
1098 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1100 prop= RNA_def_property(srna, "x_ray", PROP_BOOLEAN, PROP_NONE);
1101 RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY);
1102 RNA_def_property_ui_text(prop, "X-Ray", "Makes the object draw in front of others.");
1103 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
1106 prop= RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE);
1107 RNA_def_property_pointer_sdna(prop, NULL, "poselib");
1108 RNA_def_property_struct_type(prop, "Action");
1109 RNA_def_property_ui_text(prop, "Pose Library", "Action used as a pose library for armatures.");
1111 prop= RNA_def_property(srna, "pose", PROP_POINTER, PROP_NONE);
1112 RNA_def_property_pointer_sdna(prop, NULL, "pose");
1113 RNA_def_property_struct_type(prop, "Pose");
1114 RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures.");
1116 prop= RNA_def_property(srna, "pose_mode", PROP_BOOLEAN, PROP_NONE);
1117 RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_POSEMODE);
1118 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1119 RNA_def_property_ui_text(prop, "Pose Mode", "Object with armature data is in pose mode.");
1123 prop= RNA_def_property(srna, "shape_key_lock", PROP_BOOLEAN, PROP_NONE);
1124 RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_LOCK);
1125 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1126 RNA_def_property_ui_text(prop, "Shape Key Lock", "Always show the current Shape for this Object.");
1128 prop= RNA_def_property(srna, "active_shape_key", PROP_INT, PROP_NONE);
1129 RNA_def_property_int_sdna(prop, NULL, "shapenr");
1130 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1131 RNA_def_property_ui_text(prop, "Active Shape Key", "Current shape key index.");
1133 RNA_api_object(srna);
1136 void RNA_def_object(BlenderRNA *brna)
1138 rna_def_object(brna);
1139 rna_def_object_game_settings(brna);
1140 rna_def_vertex_group(brna);
1141 rna_def_material_slot(brna);