diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-06-01 20:17:38 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-06-01 20:17:38 +0400 |
commit | 81982140b862c07dc1a7ddc2ce995339b1eb4547 (patch) | |
tree | df361af193a805db8a1898cdb68264693bdfe9ba /source/blender/makesrna/intern/rna_material.c | |
parent | f50fb549dbee9d5ca1aea8a9f07313f2c8cde7f4 (diff) |
Fix #27550: texture node editor header was still showing texture datablock
selector even if there is no active texture slot or node, now it's disabled
in that case.
Diffstat (limited to 'source/blender/makesrna/intern/rna_material.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 8c3be7290f4..b86a91967a6 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -170,6 +170,13 @@ static void rna_Material_active_texture_set(PointerRNA *ptr, PointerRNA value) set_current_material_texture(ma, value.data); } +static int rna_Material_active_texture_editable(PointerRNA *ptr) +{ + Material *ma= (Material*)ptr->id.data; + + return has_current_material_texture(ma); +} + static PointerRNA rna_Material_active_node_material_get(PointerRNA *ptr) { Material *ma= give_node_material((Material*)ptr->data); @@ -1841,7 +1848,8 @@ void RNA_def_material(BlenderRNA *brna) /* common */ rna_def_animdata_common(srna); rna_def_mtex_common(brna, srna, "rna_Material_mtex_begin", "rna_Material_active_texture_get", - "rna_Material_active_texture_set", "MaterialTextureSlot", "MaterialTextureSlots", "rna_Material_update"); + "rna_Material_active_texture_set", "rna_Material_active_texture_editable", + "MaterialTextureSlot", "MaterialTextureSlots", "rna_Material_update"); /* only material has this one */ prop= RNA_def_property(srna, "use_textures", PROP_BOOLEAN, PROP_NONE); @@ -1899,7 +1907,9 @@ static void rna_def_texture_slots(BlenderRNA *brna, PropertyRNA *cprop, const ch RNA_def_property_flag(parm, PROP_REQUIRED); } -void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname, const char *structname_slots, const char *update) +void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin, + const char *activeget, const char *activeset, const char *activeeditable, + const char *structname, const char *structname_slots, const char *update) { PropertyRNA *prop; @@ -1913,6 +1923,8 @@ void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin, c prop= RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Texture"); RNA_def_property_flag(prop, PROP_EDITABLE); + if(activeeditable) + RNA_def_property_editable_func(prop, activeeditable); RNA_def_property_pointer_funcs(prop, activeget, activeset, NULL, NULL); RNA_def_property_ui_text(prop, "Active Texture", "Active texture slot being displayed"); RNA_def_property_update(prop, 0, update); |