[Bf-blender-cvs] [005cb901133] blender2.8: Fix T52392: Node materials (Materials and World) not updated in viewport

Dalai Felinto noreply at git.blender.org
Wed Oct 25 13:25:54 CEST 2017


Commit: 005cb90113361356b040337bf5af503d1f4f34a0
Author: Dalai Felinto
Date:   Wed Oct 25 09:24:28 2017 -0200
Branches: blender2.8
https://developer.blender.org/rB005cb90113361356b040337bf5af503d1f4f34a0

Fix T52392: Node materials (Materials and World) not updated in viewport

Depsgraph was not updated after you used "Use Nodes" to create the nodetree.

===================================================================

M	source/blender/makesrna/intern/rna_material.c
M	source/blender/makesrna/intern/rna_world.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index e62832a8b76..7f23cd78779 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -93,6 +93,7 @@ const EnumPropertyItem rna_enum_ramp_blend_items[] = {
 #include "BKE_paint.h"
 
 #include "DEG_depsgraph.h"
+#include "DEG_depsgraph_build.h"
 
 #include "ED_node.h"
 #include "ED_image.h"
@@ -339,11 +340,13 @@ static void rna_Material_use_specular_ramp_set(PointerRNA *ptr, int value)
 static void rna_Material_use_nodes_update(bContext *C, PointerRNA *ptr)
 {
 	Material *ma = (Material *)ptr->data;
+	Main *bmain = CTX_data_main(C);
 
 	if (ma->use_nodes && ma->nodetree == NULL)
 		ED_node_shader_default(C, &ma->id);
-	
-	rna_Material_draw_update(CTX_data_main(C), CTX_data_scene(C), ptr);
+
+	DEG_relations_tag_update(bmain);
+	rna_Material_draw_update(bmain, CTX_data_scene(C), ptr);
 }
 
 static const EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *UNUSED(C), PointerRNA *ptr,
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index 6c6cf24c67e..15fa686a40a 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -47,6 +47,7 @@
 #include "BKE_texture.h"
 
 #include "DEG_depsgraph.h"
+#include "DEG_depsgraph_build.h"
 
 #include "ED_node.h"
 
@@ -115,12 +116,15 @@ static void rna_World_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi
 static void rna_World_use_nodes_update(bContext *C, PointerRNA *ptr)
 {
 	World *wrld = (World *)ptr->data;
+	Main *bmain = CTX_data_main(C);
+	Scene *scene = CTX_data_scene(C);
 
 	if (wrld->use_nodes && wrld->nodetree == NULL)
 		ED_node_shader_default(C, &wrld->id);
-	
-	rna_World_update(CTX_data_main(C), CTX_data_scene(C), ptr);
-	rna_World_draw_update(CTX_data_main(C), CTX_data_scene(C), ptr);
+
+	DEG_relations_tag_update(bmain);
+	rna_World_update(bmain, scene, ptr);
+	rna_World_draw_update(bmain, scene, ptr);
 }
 
 #else



More information about the Bf-blender-cvs mailing list