diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_object.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 251 |
1 files changed, 185 insertions, 66 deletions
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 3938f4c1538..d1c184441b6 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -34,12 +34,16 @@ #include "DNA_action_types.h" #include "DNA_customdata_types.h" #include "DNA_controller_types.h" +#include "DNA_group_types.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" #include "DNA_object_force.h" #include "DNA_object_types.h" #include "DNA_property_types.h" #include "DNA_scene_types.h" +#include "DNA_meta_types.h" + +#include "BKE_group.h" /* needed for object_in_group() */ #include "BLO_sys_types.h" /* needed for intptr_t used in ED_mesh.h */ #include "ED_mesh.h" @@ -80,17 +84,25 @@ static EnumPropertyItem collision_bounds_items[] = { //{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""}, {0, NULL, 0, NULL, NULL}}; +EnumPropertyItem metaelem_type_items[] = { + {MB_BALL, "BALL", ICON_META_BALL, "Ball", ""}, + {MB_TUBE, "CAPSULE", ICON_META_CAPSULE, "Capsule", ""}, + {MB_PLANE, "PLANE", ICON_META_PLANE, "Plane", ""}, + {MB_ELIPSOID, "ELLIPSOID", ICON_META_ELLIPSOID, "Ellipsoid", ""}, // NOTE: typo at original definition! + {MB_CUBE, "CUBE", ICON_META_CUBE, "Cube", ""}, + {0, NULL, 0, NULL, NULL}}; + /* used for 2 enums */ #define OBTYPE_CU_CURVE {OB_CURVE, "CURVE", 0, "Curve", ""} #define OBTYPE_CU_SURF {OB_SURF, "SURFACE", 0, "Surface", ""} -#define OBTYPE_CU_TEXT {OB_FONT, "TEXT", 0, "Text", ""} +#define OBTYPE_CU_FONT {OB_FONT, "FONT", 0, "Font", ""} EnumPropertyItem object_type_items[] = { {OB_MESH, "MESH", 0, "Mesh", ""}, OBTYPE_CU_CURVE, OBTYPE_CU_SURF, {OB_MBALL, "META", 0, "Meta", ""}, - OBTYPE_CU_TEXT, + OBTYPE_CU_FONT, {0, "", 0, NULL, NULL}, {OB_ARMATURE, "ARMATURE", 0, "Armature", ""}, {OB_LATTICE, "LATTICE", 0, "Lattice", ""}, @@ -103,15 +115,17 @@ EnumPropertyItem object_type_items[] = { EnumPropertyItem object_type_curve_items[] = { OBTYPE_CU_CURVE, OBTYPE_CU_SURF, - OBTYPE_CU_TEXT, + OBTYPE_CU_FONT, {0, NULL, 0, NULL, NULL}}; - + + #ifdef RNA_RUNTIME #include "BLI_math.h" #include "DNA_key_types.h" #include "DNA_constraint_types.h" +#include "DNA_lattice_types.h" #include "BKE_armature.h" #include "BKE_bullet.h" @@ -138,12 +152,13 @@ EnumPropertyItem object_type_curve_items[] = { static void rna_Object_internal_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_id_flush_update(ptr->id.data, OB_RECALC_OB); + DAG_id_tag_update(ptr->id.data, OB_RECALC_OB); } static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat); + /* dont use compat so we get predictable rotation */ + object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat, FALSE, TRUE); rna_Object_internal_update(bmain, scene, ptr); } @@ -177,12 +192,25 @@ static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16]) copy_m4_m4(ob->obmat, (float(*)[4])values); } - object_apply_mat4(ob, ob->obmat); + /* dont use compat so we get predictable rotation */ + object_apply_mat4(ob, ob->obmat, FALSE, FALSE); +} + +static void rna_Object_matrix_basis_get(PointerRNA *ptr, float values[16]) +{ + Object *ob= ptr->id.data; + object_to_mat4(ob, (float(*)[4])values); +} + +static void rna_Object_matrix_basis_set(PointerRNA *ptr, const float values[16]) +{ + Object *ob= ptr->id.data; + object_apply_mat4(ob, (float(*)[4])values, FALSE, FALSE); } void rna_Object_internal_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA); + DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA); WM_main_add_notifier(NC_OBJECT|ND_DRAW, ptr->id.data); } @@ -214,7 +242,7 @@ void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Object_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_id_flush_update(ptr->id.data, OB_RECALC_OB); + DAG_id_tag_update(ptr->id.data, OB_RECALC_OB); DAG_scene_sort(bmain, scene); WM_main_add_notifier(NC_OBJECT|ND_PARENT, ptr->id.data); } @@ -402,6 +430,20 @@ static void rna_Object_parent_bone_set(PointerRNA *ptr, const char *value) ED_object_parent(ob, ob->parent, ob->partype, value); } +static void rna_Object_dup_group_set(PointerRNA *ptr, PointerRNA value) +{ + Object *ob= (Object *)ptr->data; + Group *grp = (Group *)value.data; + + /* must not let this be set if the object belongs in this group already, + * thus causing a cycle/infinite-recursion leading to crashes on load [#25298] + */ + if (object_in_group(ob, grp) == 0) + ob->dup_group = grp; + else + BKE_report(NULL, RPT_ERROR, "Cannot set dupli-group as object belongs in group being instanced thus causing a cycle"); +} + static int rna_VertexGroup_index_get(PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; @@ -546,11 +588,12 @@ static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, in *max= MAX2(ob->totcol-1, 0); } +/* returns active base material */ static PointerRNA rna_Object_active_material_get(PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; Material *ma; - + ma= (ob->totcol)? give_current_material(ob, ob->actcol): NULL; return rna_pointer_inherit_refine(ptr, &RNA_Material, ma); } @@ -559,6 +602,7 @@ static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value) { Object *ob= (Object*)ptr->id.data; + DAG_id_tag_update(value.data, 0); assign_material(ob, value.data, ob->actcol); } @@ -769,6 +813,12 @@ static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str) strcpy(str, ""); } +static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + rna_Object_internal_update(bmain, scene, ptr); + WM_main_add_notifier(NC_OBJECT|ND_OB_SHADING, ptr->id.data); +} + /* why does this have to be so complicated?, can't all this crap be * moved to in BGE conversion function? - Campbell * * @@ -813,7 +863,7 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value) switch (ob->body_type) { case OB_BODY_TYPE_SENSOR: ob->gameflag |= OB_SENSOR|OB_COLLISION|OB_GHOST; - ob->gameflag &= ~(OB_OCCLUDER|OB_NAVMESH|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_ACTOR|OB_ANISOTROPIC_FRICTION|OB_DO_FH|OB_ROT_FH|OB_COLLISION_RESPONSE); + ob->gameflag &= ~(OB_OCCLUDER|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_ACTOR|OB_ANISOTROPIC_FRICTION|OB_DO_FH|OB_ROT_FH|OB_COLLISION_RESPONSE|OB_NAVMESH); break; case OB_BODY_TYPE_OCCLUDER: ob->gameflag |= OB_OCCLUDER; @@ -1048,7 +1098,7 @@ static void rna_Object_constraints_remove(Object *object, ReportList *reports, b WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT, object); } -static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports, char *name, int type) +static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports, const char *name, int type) { return ED_object_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type); } @@ -1066,15 +1116,65 @@ static void rna_Object_boundbox_get(PointerRNA *ptr, float *values) memcpy(values, bb->vec, sizeof(bb->vec)); } else { - memset(values, -1.0f, sizeof(bb->vec)); + fill_vn(values, sizeof(bb->vec)/sizeof(float), 0.0f); } } -static void rna_Object_add_vertex_to_group(Object *ob, int index_len, int *index, bDeformGroup *def, float weight, int assignmode) +static bDeformGroup *rna_Object_vgroup_new(Object *ob, const char *name) +{ + bDeformGroup *defgroup = ED_vgroup_add_name(ob, name); + + WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob); + + return defgroup; +} + +static void rna_Object_vgroup_remove(Object *ob, bDeformGroup *defgroup) +{ + ED_vgroup_delete(ob, defgroup); + + WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob); +} + +static void rna_VertexGroup_vertex_add(ID *id, bDeformGroup *def, ReportList *reports, int index_len, int *index, float weight, int assignmode) { + Object *ob = (Object *)id; + + if(ED_vgroup_object_is_edit_mode(ob)) { + BKE_reportf(reports, RPT_ERROR, "VertexGroup.add(): Can't be called while object is in edit mode."); + return; + } + + while(index_len--) + ED_vgroup_vert_add(ob, def, *index++, weight, assignmode); /* XXX, not efficient calling within loop*/ + + WM_main_add_notifier(NC_GEOM|ND_DATA, (ID *)ob->data); +} + +static void rna_VertexGroup_vertex_remove(ID *id, bDeformGroup *dg, ReportList *reports, int index_len, int *index) +{ + Object *ob = (Object *)id; + + if(ED_vgroup_object_is_edit_mode(ob)) { + BKE_reportf(reports, RPT_ERROR, "VertexGroup.remove(): Can't be called while object is in edit mode."); + return; + } + while(index_len--) - ED_vgroup_vert_add(ob, def, *index++, weight, assignmode); + ED_vgroup_vert_remove(ob, dg, *index++); + + WM_main_add_notifier(NC_GEOM|ND_DATA, (ID *)ob->data); +} + +static float rna_VertexGroup_weight(ID *id, bDeformGroup *dg, ReportList *reports, int index) +{ + float weight = ED_vgroup_vert_weight((Object *)id, dg, index); + + if(weight < 0) { + BKE_reportf(reports, RPT_ERROR, "Vertex not in group"); + } + return weight; } /* generic poll functions */ @@ -1105,10 +1205,20 @@ int rna_Camera_object_poll(PointerRNA *ptr, PointerRNA value) #else +static int rna_matrix_dimsize_4x4[]= {4, 4}; + static void rna_def_vertex_group(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; + FunctionRNA *func; + + static EnumPropertyItem assign_mode_items[] = { + {WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"}, + {WEIGHT_ADD, "ADD", 0, "Add", "Add"}, + {WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"}, + {0, NULL, 0, NULL, NULL} + }; srna= RNA_def_struct(brna, "VertexGroup", NULL); RNA_def_struct_sdna(srna, "bDeformGroup"); @@ -1118,12 +1228,38 @@ static void rna_def_vertex_group(BlenderRNA *brna) prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", "Vertex group name"); RNA_def_struct_name_property(srna, prop); - RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, NULL); + RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, "rna_Object_internal_update_data"); /* update data because modifiers may use [#24761] */ prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_int_funcs(prop, "rna_VertexGroup_index_get", NULL, NULL); RNA_def_property_ui_text(prop, "Index", "Index number of the vertex group"); + + func= RNA_def_function(srna, "add", "rna_VertexGroup_vertex_add"); + RNA_def_function_ui_description(func, "Add vertices to the group."); + RNA_def_function_flag(func, FUNC_USE_REPORTS|FUNC_USE_SELF_ID); + /* TODO, see how array size of 0 works, this shouldnt be used */ + prop= RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List.", 0, 0); + RNA_def_property_flag(prop, PROP_DYNAMIC|PROP_REQUIRED); + prop= RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight.", 0.0f, 1.0f); + RNA_def_property_flag(prop, PROP_REQUIRED); + prop= RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode."); + RNA_def_property_flag(prop, PROP_REQUIRED); + + func= RNA_def_function(srna, "remove", "rna_VertexGroup_vertex_remove"); + RNA_def_function_ui_description(func, "Remove a vertex from the group."); + RNA_def_function_flag(func, FUNC_USE_REPORTS|FUNC_USE_SELF_ID); + /* TODO, see how array size of 0 works, this shouldnt be used */ + prop= RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List.", 0, 0); + RNA_def_property_flag(prop, PROP_DYNAMIC|PROP_REQUIRED); + + func= RNA_def_function(srna, "weight", "rna_VertexGroup_weight"); + RNA_def_function_ui_description(func, "Get a vertex weight from the group."); + RNA_def_function_flag(func, FUNC_USE_REPORTS|FUNC_USE_SELF_ID); + prop=RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "The index of the vertex.", 0, INT_MAX); + RNA_def_property_flag(prop, PROP_REQUIRED); + prop= RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight.", 0.0f, 1.0f); + RNA_def_function_return(func, prop); } static void rna_def_material_slot(BlenderRNA *brna) @@ -1149,13 +1285,13 @@ static void rna_def_material_slot(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", "rna_MaterialSlot_material_set", NULL, NULL); RNA_def_property_ui_text(prop, "Material", "Material datablock used by this material slot"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update"); prop= RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, link_items); RNA_def_property_enum_funcs(prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL); RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update"); prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_string_funcs(prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL); @@ -1355,7 +1491,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "obstacleRad"); RNA_def_property_range(prop, 0.0, 1000.0); RNA_def_property_ui_text(prop, "Obstacle Radius", "Radius of object representation in obstacle simulation"); - + /* state */ prop= RNA_def_property(srna, "states_visible", PROP_BOOLEAN, PROP_LAYER_MEMBER); @@ -1510,13 +1646,6 @@ static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop /* object.vertex_groups */ static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop) { - static EnumPropertyItem assign_mode_items[] = { - {WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"}, - {WEIGHT_ADD, "ADD", 0, "Add", "Add"}, - {WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"}, - {0, NULL, 0, NULL, NULL} - }; - StructRNA *srna; PropertyRNA *prop; @@ -1543,24 +1672,16 @@ static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data"); /* vertex groups */ // add_vertex_group - func= RNA_def_function(srna, "new", "ED_vgroup_add_name"); + func= RNA_def_function(srna, "new", "rna_Object_vgroup_new"); RNA_def_function_ui_description(func, "Add vertex group to object."); - parm= RNA_def_string(func, "name", "Group", 0, "", "Vertex group name."); /* optional */ + RNA_def_string(func, "name", "Group", 0, "", "Vertex group name."); /* optional */ parm= RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group."); RNA_def_function_return(func, parm); - func= RNA_def_function(srna, "assign", "rna_Object_add_vertex_to_group"); - RNA_def_function_ui_description(func, "Add vertex to a vertex group."); - /* TODO, see how array size of 0 works, this shouldnt be used */ - parm= RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List.", 0, 0); - RNA_def_property_flag(parm, PROP_DYNAMIC); - RNA_def_property_flag(parm, PROP_REQUIRED); - parm= RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to add vertex to."); - RNA_def_property_flag(parm, PROP_REQUIRED); - parm= RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight.", 0.0f, 1.0f); - RNA_def_property_flag(parm, PROP_REQUIRED); - parm= RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode."); - RNA_def_property_flag(parm, PROP_REQUIRED); + func= RNA_def_function(srna, "remove", "rna_Object_vgroup_remove"); + RNA_def_function_ui_description(func, "Delete vertex group from object."); + parm= RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); } @@ -1569,23 +1690,10 @@ static void rna_def_object(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem object_type_items[] = { - {OB_EMPTY, "EMPTY", 0, "Empty", ""}, - {OB_MESH, "MESH", 0, "Mesh", ""}, - {OB_CURVE, "CURVE", 0, "Curve", ""}, - {OB_SURF, "SURFACE", 0, "Surface", ""}, - {OB_FONT, "TEXT", 0, "Text", ""}, - {OB_MBALL, "META", 0, "Meta", ""}, - {OB_LAMP, "LAMP", 0, "Lamp", ""}, - {OB_CAMERA, "CAMERA", 0, "Camera", ""}, - {OB_LATTICE, "LATTICE", 0, "Lattice", ""}, - {OB_ARMATURE, "ARMATURE", 0, "Armature", ""}, - {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem empty_drawtype_items[] = { + {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""}, {OB_ARROWS, "ARROWS", 0, "Arrows", ""}, {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""}, - {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""}, {OB_CIRCLE, "CIRCLE", 0, "Circle", ""}, {OB_CUBE, "CUBE", 0, "Cube", ""}, {OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""}, @@ -1647,8 +1755,7 @@ static void rna_def_object(BlenderRNA *brna) static float default_quat[4] = {1,0,0,0}; /* default quaternion values */ static float default_axisAngle[4] = {0,0,1,0}; /* default axis-angle rotation values */ static float default_scale[3] = {1,1,1}; /* default scale values */ - int matrix_dimsize[]= {4, 4}; - int boundbox_dimsize[]= {8, 3}; + static int boundbox_dimsize[]= {8, 3}; srna= RNA_def_struct(brna, "Object", "ID"); RNA_def_struct_ui_text(srna, "Object", "Object datablock defining an object in a scene"); @@ -1659,7 +1766,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_struct_type(prop, "ID"); RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_data_set", "rna_Object_data_typef", NULL); RNA_def_property_editable_func(prop, "rna_Object_data_editable"); - RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK); RNA_def_property_ui_text(prop, "Data", "Object data"); RNA_def_property_update(prop, 0, "rna_Object_internal_update_data"); @@ -1693,7 +1800,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_multi_array(prop, 2, boundbox_dimsize); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL); - RNA_def_property_ui_text(prop, "Bound Box", "Objects bound box in object-space coordinates"); + RNA_def_property_ui_text(prop, "Bound Box", "Objects bound box in object-space coordinates, all values are -1.0 when not available."); /* parent */ prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); @@ -1755,14 +1862,14 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", "rna_Object_active_material_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update"); prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "actcol"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set", "rna_Object_active_material_index_range"); RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot"); - RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); /* transform */ prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION); @@ -1884,16 +1991,25 @@ static void rna_def_object(BlenderRNA *brna) /* matrix */ prop= RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX); RNA_def_property_float_sdna(prop, NULL, "obmat"); - RNA_def_property_multi_array(prop, 2, matrix_dimsize); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Matrix World", "Worldspace transformation matrix"); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_matrix_world_update"); prop= RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX); - RNA_def_property_multi_array(prop, 2, matrix_dimsize); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Local Matrix", "Parent relative transformation matrix"); RNA_def_property_float_funcs(prop, "rna_Object_matrix_local_get", "rna_Object_matrix_local_set", NULL); RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, NULL); + prop= RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Input Matrix", "Matrix access to location, rotation and scale (including deltas), before constraints and parenting are applied."); + RNA_def_property_float_funcs(prop, "rna_Object_matrix_basis_get", "rna_Object_matrix_basis_set", NULL); + RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); + /* collections */ prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Constraint"); @@ -2031,6 +2147,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "dup_group"); RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_dup_group_set", NULL, NULL); RNA_def_property_ui_text(prop, "Dupli Group", "Instance an existing group"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update"); @@ -2135,7 +2252,7 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP); - RNA_def_property_ui_text(prop, "Draw Transparent", "Enables transparent materials for the object (Mesh only)"); + RNA_def_property_ui_text(prop, "Draw Transparent", "Displays material transparency in the object"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE); @@ -2162,7 +2279,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures"); /* shape keys */ - prop= RNA_def_property(srna, "show_shape_key", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "show_only_shape_key", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_LOCK); RNA_def_property_ui_text(prop, "Shape Key Lock", "Always show the current Shape for this Object"); RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1); @@ -2206,12 +2323,14 @@ static void rna_def_dupli_object(BlenderRNA *brna) prop= RNA_def_property(srna, "matrix_original", PROP_FLOAT, PROP_MATRIX); RNA_def_property_float_sdna(prop, NULL, "omat"); - RNA_def_property_array(prop, 16); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Object Matrix", "The original matrix of this object before it was duplicated"); prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX); RNA_def_property_float_sdna(prop, NULL, "mat"); - RNA_def_property_array(prop, 16); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Object Duplicate Matrix", "Object duplicate transformation matrix"); /* TODO: DupliObject has more properties that can be wrapped */ |