diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-09-09 21:39:19 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-09-09 21:39:19 +0400 |
commit | 9e7c4ce806b8d6dc532c40d5aeaa15dc708e2a10 (patch) | |
tree | c5f5e535222b2b5dd25e62dc5cbbc94be1052396 /source/blender/makesrna/intern | |
parent | d4a69283a60ae8f9e834f48ef7c2f3f68b51b73d (diff) |
2.5: Layer Buttons
* Added RNA subtype for layers.
* Shift-click works again.
* uiItemR can now also handle armature/bone layers.
* Also makes Move to Layer popup work as expected.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_armature.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_define.c | 28 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_group.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_rna.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 14 |
7 files changed, 40 insertions, 16 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 907eba4018f..cbfd7d326de 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1394,6 +1394,8 @@ static const char *rna_property_subtypename(PropertyType type) case PROP_XYZ: return "PROP_XYZ"; case PROP_RGB: return "PROP_RGB"; case PROP_NEVER_NULL: return "PROP_NEVER_NULL"; + case PROP_LAYER: return "PROP_LAYER"; + case PROP_LAYER_MEMBER: return "PROP_LAYER_MEMBER"; default: { /* incase we dont have a type preset that includes the subtype */ if(RNA_SUBTYPE_UNIT(type)) { diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 3f4b75508fe..57eb3c1de4a 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -325,7 +325,7 @@ static void rna_def_bone_common(StructRNA *srna, int editbone) RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); /* flags */ - prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_boolean_sdna(prop, NULL, "layer", 1); RNA_def_property_array(prop, 16); if(editbone) RNA_def_property_boolean_funcs(prop, "rna_EditBone_layer_get", "rna_EditBone_layer_set"); @@ -569,7 +569,7 @@ void rna_def_armature(BlenderRNA *brna) /* Boolean values */ /* layer */ - prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_boolean_sdna(prop, NULL, "layer", 1); RNA_def_property_array(prop, 16); RNA_def_property_ui_text(prop, "Visible Layers", "Armature layer visibility."); @@ -578,7 +578,7 @@ void rna_def_armature(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); /* layer protection */ - prop= RNA_def_property(srna, "layer_protection", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "layer_protection", PROP_BOOLEAN, PROP_LAYER); RNA_def_property_boolean_sdna(prop, NULL, "layer_protected", 1); RNA_def_property_array(prop, 16); RNA_def_property_ui_text(prop, "Layer Proxy Protection", "Protected layers in Proxy Instances are restored to Proxy settings on file reload and undo."); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index e415304ab6c..00cfb17dc84 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -1953,6 +1953,34 @@ PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *ident return prop; } +PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value, + const char *ui_name, const char *ui_description) +{ + ContainerRNA *cont= cont_; + PropertyRNA *prop; + + prop= RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_LAYER); + if(len != 0) RNA_def_property_array(prop, len); + if(default_value) RNA_def_property_boolean_array_default(prop, default_value); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + +PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value, + const char *ui_name, const char *ui_description) +{ + ContainerRNA *cont= cont_; + PropertyRNA *prop; + + prop= RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_LAYER_MEMBER); + if(len != 0) RNA_def_property_array(prop, len); + if(default_value) RNA_def_property_boolean_array_default(prop, default_value); + RNA_def_property_ui_text(prop, ui_name, ui_description); + + return prop; +} + PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value, const char *ui_name, const char *ui_description) { diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c index 18c04fbfb50..31bc6ccc74b 100644 --- a/source/blender/makesrna/intern/rna_group.c +++ b/source/blender/makesrna/intern/rna_group.c @@ -63,7 +63,7 @@ void RNA_def_group(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Objects", "A collection of this groups objects."); RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Group_objects_get", 0, 0, 0, 0, 0); - prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_LAYER); RNA_def_property_boolean_sdna(prop, NULL, "layer", 1); RNA_def_property_array(prop, 20); RNA_def_property_ui_text(prop, "Dupli Layers", "Layers visible when this groups is instanced as a dupli."); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index f81b314de6f..ce65ef4d450 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1073,7 +1073,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Mode", "Object interaction mode."); - prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_boolean_sdna(prop, NULL, "lay", 1); RNA_def_property_array(prop, 20); RNA_def_property_ui_text(prop, "Layers", "Layers the object is on."); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 57ed5ccef39..b1644405ff3 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -798,6 +798,8 @@ static void rna_def_property(BlenderRNA *brna) {PROP_XYZ, "XYZ", 0, "XYZ", ""}, {PROP_RGB, "RGB", 0, "RGB", ""}, {PROP_NEVER_NULL, "NEVER_NULL", 0, "Never Null", ""}, + {PROP_LAYER, "LAYER", 0, "Layer", ""}, + {PROP_LAYER_MEMBER, "LAYER_MEMBERSHIP", 0, "Layer Membership", ""}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem unit_items[] = { {PROP_UNIT_NONE, "NONE", 0, "None", ""}, diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index f196001cc9d..965796c6d5b 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -363,12 +363,6 @@ static void rna_SceneRenderLayer_layer_set(PointerRNA *ptr, const int *values) rl->lay= layer_set(rl->lay, values); } -static void rna_SceneRenderLayer_zmask_layer_set(PointerRNA *ptr, const int *values) -{ - SceneRenderLayer *rl= (SceneRenderLayer*)ptr->data; - rl->lay_zmask= layer_set(rl->lay_zmask, values); -} - static void rna_SceneRenderLayer_pass_update(bContext *C, PointerRNA *ptr) { Scene *scene= (Scene*)ptr->id.data; @@ -597,7 +591,7 @@ void rna_def_render_layer_common(StructRNA *srna, int scene) else RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* layers */ - prop= RNA_def_property(srna, "visible_layers", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "visible_layers", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_boolean_sdna(prop, NULL, "lay", 1); RNA_def_property_array(prop, 20); RNA_def_property_ui_text(prop, "Visible Layers", "Scene layers included in this render layer."); @@ -606,12 +600,10 @@ void rna_def_render_layer_common(StructRNA *srna, int scene) if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); - prop= RNA_def_property(srna, "zmask_layers", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "zmask_layers", PROP_BOOLEAN, PROP_LAYER); RNA_def_property_boolean_sdna(prop, NULL, "lay_zmask", 1); RNA_def_property_array(prop, 20); RNA_def_property_ui_text(prop, "Zmask Layers", "Zmask scene layers."); - if(scene) RNA_def_property_boolean_funcs(prop, NULL, "rna_SceneRenderLayer_zmask_layer_set"); - else RNA_def_property_boolean_funcs(prop, NULL, "rna_RenderLayer_zmask_layer_set"); if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -1940,7 +1932,7 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Scene_objects_get", 0, 0, 0, 0, 0); /* Layers */ - prop= RNA_def_property(srna, "visible_layers", PROP_BOOLEAN, PROP_NONE); + prop= RNA_def_property(srna, "visible_layers", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_boolean_sdna(prop, NULL, "lay", 1); RNA_def_property_array(prop, 20); RNA_def_property_ui_text(prop, "Visible Layers", "Layers visible when rendering the scene."); |