diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_object.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 74b2103a198..571f8d36305 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -115,6 +115,7 @@ EnumPropertyItem object_type_items[] = { {0, "", 0, NULL, NULL}, {OB_CAMERA, "CAMERA", 0, "Camera", ""}, {OB_LAMP, "LAMP", 0, "Lamp", ""}, + {OB_SPEAKER, "SPEAKER", 0, "Speaker", ""}, {0, NULL, 0, NULL, NULL}}; EnumPropertyItem object_type_curve_items[] = { @@ -131,6 +132,7 @@ EnumPropertyItem object_type_curve_items[] = { #include "DNA_key_types.h" #include "DNA_constraint_types.h" #include "DNA_lattice_types.h" +#include "DNA_node_types.h" #include "BKE_armature.h" #include "BKE_bullet.h" @@ -270,11 +272,16 @@ static void rna_Base_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Po static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, Base *base, Object *ob) { /* try to avoid scene sort */ - if((ob->lay & scene->lay) && (base->lay & scene->lay)) { + if(scene == NULL) { + /* pass - unlikely but when running scripts on startup it happens */ + } + else if((ob->lay & scene->lay) && (base->lay & scene->lay)) { /* pass */ - } else if((ob->lay & scene->lay)==0 && (base->lay & scene->lay)==0) { + } + else if((ob->lay & scene->lay)==0 && (base->lay & scene->lay)==0) { /* pass */ - } else { + } + else { DAG_scene_sort(bmain, scene); } } @@ -284,7 +291,7 @@ static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) Object *ob= (Object*)ptr->id.data; Base *base; - base= object_in_scene(ob, scene); + base= scene ? object_in_scene(ob, scene) : NULL; if(!base) return; @@ -360,6 +367,7 @@ static StructRNA *rna_Object_data_typef(PointerRNA *ptr) case OB_CAMERA: return &RNA_Camera; case OB_LATTICE: return &RNA_Lattice; case OB_ARMATURE: return &RNA_Armature; + case OB_SPEAKER: return &RNA_Speaker; default: return &RNA_ID; } } @@ -478,7 +486,7 @@ static PointerRNA rna_Object_active_vertex_group_get(PointerRNA *ptr) static int rna_Object_active_vertex_group_index_get(PointerRNA *ptr) { Object *ob= (Object*)ptr->id.data; - return MAX2(ob->actdef-1, 0); + return ob->actdef-1; } static void rna_Object_active_vertex_group_index_set(PointerRNA *ptr, int value) @@ -1030,8 +1038,13 @@ static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, i Key *key= ob_get_key(ob); *min= 0; - *max= (key)? BLI_countlist(&key->block)-1: 0; - *max= MAX2(0, *max); + if(key) { + *max= BLI_countlist(&key->block)-1; + if(*max < 0) *max= 0; + } + else { + *max= 0; + } } static int rna_Object_active_shape_key_index_get(PointerRNA *ptr) @@ -1842,7 +1855,6 @@ static void rna_def_object(BlenderRNA *brna) prop= RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "par1"); RNA_def_property_array(prop, 3); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Parent Vertices", "Indices of vertices in cases of a vertex parenting relation"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update"); @@ -2032,19 +2044,27 @@ static void rna_def_object(BlenderRNA *brna) 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"); - RNA_def_property_ui_text(prop, "Constraints", "Constraints affecting the transformation of the object"); -// RNA_def_property_collection_funcs(prop, 0, 0, 0, 0, 0, 0, 0, "constraints__add", "constraints__remove"); - rna_def_object_constraints(brna, prop); + /*parent_inverse*/ + prop= RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX); + RNA_def_property_float_sdna(prop, NULL, "parentinv"); + RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); + RNA_def_property_ui_text(prop, "Matrix", "Inverse of object's parent matrix at time of parenting"); + RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update"); + + /* modifiers */ prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Modifier"); RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the geometric data of the object"); rna_def_object_modifiers(brna, prop); + /* constraints */ + prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_type(prop, "Constraint"); + RNA_def_property_ui_text(prop, "Constraints", "Constraints affecting the transformation of the object"); +// RNA_def_property_collection_funcs(prop, 0, 0, 0, 0, 0, 0, 0, "constraints__add", "constraints__remove"); + rna_def_object_constraints(brna, prop); + /* game engine */ prop= RNA_def_property(srna, "game", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); @@ -2281,12 +2301,12 @@ 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", "Displays material transparency in the object"); + RNA_def_property_ui_text(prop, "Draw Transparent", "Displays material transparency in the object (unsupported for duplicator drawing)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY); - RNA_def_property_ui_text(prop, "X-Ray", "Makes the object draw in front of others"); + RNA_def_property_ui_text(prop, "X-Ray", "Makes the object draw in front of others (unsupported for duplicator drawing)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); /* Grease Pencil */ @@ -2295,6 +2315,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "GreasePencil"); RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil datablock"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); /* pose */ prop= RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE); |