diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_texture.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_texture.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index d86e5fd0d9c..009823555f0 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -107,6 +107,7 @@ EnumPropertyItem blend_type_items[] = { #include "RNA_access.h" +#include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_image.h" #include "BKE_texture.h" @@ -167,7 +168,7 @@ static void rna_Texture_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *pt } else if (GS(id->name) == ID_NT) { bNodeTree *ntree = ptr->id.data; - ED_node_generic_update(bmain, ntree, NULL); + ED_node_tag_update_nodetree(bmain, ntree); } } @@ -384,15 +385,18 @@ static void rna_Texture_use_color_ramp_set(PointerRNA *ptr, int value) tex->coba = add_colorband(0); } -static void rna_Texture_use_nodes_set(PointerRNA *ptr, int v) +static void rna_Texture_use_nodes_update(bContext *C, PointerRNA *ptr) { Tex *tex = (Tex *)ptr->data; - tex->use_nodes = v; - tex->type = 0; + if (tex->use_nodes) { + tex->type = 0; + + if (tex->nodetree == NULL) + ED_node_texture_default(C, tex); + } - if (v && tex->nodetree == NULL) - ED_node_texture_default(tex); + rna_Texture_nodes_update(CTX_data_main(C), CTX_data_scene(C), ptr); } static void rna_ImageTexture_mipmap_set(PointerRNA *ptr, int value) @@ -2021,9 +2025,9 @@ static void rna_def_texture(BlenderRNA *brna) /* nodetree */ prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1); - RNA_def_property_boolean_funcs(prop, NULL, "rna_Texture_use_nodes_set"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); RNA_def_property_ui_text(prop, "Use Nodes", "Make this a node-based texture"); - RNA_def_property_update(prop, 0, "rna_Texture_nodes_update"); + RNA_def_property_update(prop, 0, "rna_Texture_use_nodes_update"); prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "nodetree"); |