3D View missing some material updates #41739

Closed
opened 2014-09-07 09:27:34 +02:00 by Bastien Montagne · 10 comments

Things like enabling/disabling shader nodes, or changing material node’s colors, does not update 3DView in Solid mode, see Blender_Internal_Render_s_Gather_don_t_use_node_s_emit_color..blend.

This patch solves the issue by forcing 3DView redraw for all NC_MATERIAL notifier when 3DView is in solid, texture or material shading mode. Have the feeling this is kinda breaking the purpose of ND_SHADING_DRAW, though, tbh. :/

P139: (An Untitled Masterwork)

diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 8b76ec3..8eb0ca6 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -873,11 +873,8 @@ static void view3d_main_area_listener(bScreen *sc, ScrArea *sa, ARegion *ar, wmN
 				case ND_NODES:
 				{
 					Object *ob = OBACT;
-					if ((v3d->drawtype == OB_MATERIAL) ||
-					    (ob && (ob->mode == OB_MODE_TEXTURE_PAINT)) ||
-					    (v3d->drawtype == OB_TEXTURE &&
-					     (scene->gm.matmode == GAME_MAT_GLSL ||
-					      BKE_scene_use_new_shading_nodes(scene))))
+					if (ELEM(v3d->drawtype, OB_MATERIAL, OB_TEXTURE, OB_SOLID) ||
+					    (ob && (ob->mode == OB_MODE_TEXTURE_PAINT)))
 					{
 						ED_region_tag_redraw(ar);
 					}

Things like enabling/disabling shader nodes, or changing material node’s colors, does not update 3DView in Solid mode, see [Blender_Internal_Render_s_Gather_don_t_use_node_s_emit_color..blend](https://archive.blender.org/developer/F92755/Blender_Internal_Render_s_Gather_don_t_use_node_s_emit_color..blend). This patch solves the issue by forcing 3DView redraw for all NC_MATERIAL notifier when 3DView is in solid, texture or material shading mode. Have the feeling this is kinda breaking the purpose of ND_SHADING_DRAW, though, tbh. :/ [P139: (An Untitled Masterwork)](https://archive.blender.org/developer/P139.txt) ``` diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 8b76ec3..8eb0ca6 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -873,11 +873,8 @@ static void view3d_main_area_listener(bScreen *sc, ScrArea *sa, ARegion *ar, wmN case ND_NODES: { Object *ob = OBACT; - if ((v3d->drawtype == OB_MATERIAL) || - (ob && (ob->mode == OB_MODE_TEXTURE_PAINT)) || - (v3d->drawtype == OB_TEXTURE && - (scene->gm.matmode == GAME_MAT_GLSL || - BKE_scene_use_new_shading_nodes(scene)))) + if (ELEM(v3d->drawtype, OB_MATERIAL, OB_TEXTURE, OB_SOLID) || + (ob && (ob->mode == OB_MODE_TEXTURE_PAINT))) { ED_region_tag_redraw(ar); } ```
Author
Owner

Changed status to: 'Open'

Changed status to: 'Open'
Bastien Montagne self-assigned this 2014-09-07 09:27:34 +02:00
Author
Owner

Added subscribers: @mont29, @Sergey, @ideasman42

Added subscribers: @mont29, @Sergey, @ideasman42
Author
Owner

So new patch, more complex, but avoids refreshing solid 3DView on all NC_MATERIAL | ND_NODES notifiers.

Idea is to allow each socket to define it own custom notifier to send in addition of default, generic one.

P143: #41769

diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index cb96538..e8e33b7 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -102,6 +102,7 @@ typedef struct bNodeSocketTemplate {
 	float min, max;
 	int subtype;  /* would use PropertySubType but this is a bad level include to use RNA */
 	int flag;
+	int custom_notifier;
 	
 	/* after this line is used internal only */
 	struct bNodeSocket *sock;		/* used to hold verified socket */
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index 13e46bc..00aca12 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -31,6 +31,7 @@ set(INC
 	../imbuf
 	../makesdna
 	../makesrna
+	../windowmanager  # Sigh... Because of nodes.
 
 	# For node muting stuff...
 	../nodes
diff --git a/source/blender/gpu/SConscript b/source/blender/gpu/SConscript
index e9320f0..8849fa2 100644
--- a/source/blender/gpu/SConscript
+++ b/source/blender/gpu/SConscript
@@ -46,6 +46,7 @@ incs = [
     '../makesrna',
     '../nodes',
     '../nodes/intern',
+    '../windowmanager',  # Sigh... Because of nodes.
     env['BF_OPENGL_INC'],
     ]
 
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index e0d25e7..7e6af2c 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -108,11 +108,12 @@ typedef struct bNodeSocket {
 	
 	void *default_value;		/* default input value used for unlinked sockets */
 	
+	int custom_notifier;		/* custom notifier to use for this socket (from its template) */
+	
 	/* execution data */
 	short stack_index;			/* local stack index */
 	/* XXX deprecated, kept for forward compatibility */
 	short stack_type  DNA_DEPRECATED;
-	int pad;
 	
 	void *cache;				/* cached data from execution */
 	
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 2e0ad63..1ef39ec 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -340,7 +340,7 @@ static void rna_Material_use_nodes_update(bContext *C, PointerRNA *ptr)
 	if (ma->use_nodes && ma->nodetree == NULL)
 		ED_node_shader_default(C, &ma->id);
 	
-	rna_Material_update(CTX_data_main(C), CTX_data_scene(C), ptr);
+	rna_Material_draw_update(CTX_data_main(C), CTX_data_scene(C), ptr);
 }
 
 static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *UNUSED(C), PointerRNA *ptr,
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index e90de36..44aa845 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -2231,17 +2231,20 @@ static void rna_NodeSocketStandard_vector_range(PointerRNA *ptr, float *min, flo
 /* using a context update function here, to avoid searching the node if possible */
 static void rna_NodeSocketStandard_value_update(struct bContext *C, PointerRNA *ptr)
 {
+	bNodeTree *ntree = ptr->id.data;
 	bNode *node;
+	bNodeSocket *sock = ptr->data;
 	
 	/* default update */
 	rna_NodeSocket_update(CTX_data_main(C), CTX_data_scene(C), ptr);
 	
+	if (sock->custom_notifier) {
+		WM_event_add_notifier(C, sock->custom_notifier, ntree);
+	}
+	
 	/* try to use node from context, faster */
 	node = CTX_data_pointer_get(C, "node").data;
 	if (!node) {
-		bNodeTree *ntree = ptr->id.data;
-		bNodeSocket *sock = ptr->data;
-		
 		/* fall back to searching node in the tree */
 		nodeFindNode(ntree, sock, &node, NULL);
 	}
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 2293415..ebea773 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -36,6 +36,7 @@ set(INC
 	../imbuf
 	../makesdna
 	../makesrna
+	../windowmanager
 	../render/extern/include
 	../../../intern/guardedalloc
 )
diff --git a/source/blender/nodes/SConscript b/source/blender/nodes/SConscript
index becf6e7..06411d9 100644
--- a/source/blender/nodes/SConscript
+++ b/source/blender/nodes/SConscript
@@ -47,6 +47,7 @@ incs = [
     '../imbuf',
     '../makesdna',
     '../makesrna',
+    '../windowmanager',
     '../render/extern/include',
     env['BF_OPENGL_INC'],
     env['BF_ZLIB_INC'],
diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c
index 2ac1a2c..46b55d4 100644
--- a/source/blender/nodes/intern/node_socket.c
+++ b/source/blender/nodes/intern/node_socket.c
@@ -55,6 +55,7 @@ struct bNodeSocket *node_add_socket_from_template(struct bNodeTree *ntree, struc
 	bNodeSocket *sock = nodeAddStaticSocket(ntree, node, in_out, stemp->type, stemp->subtype, stemp->identifier, stemp->name);
 	
 	sock->flag |= stemp->flag;
+	sock->custom_notifier = stemp->custom_notifier;
 	
 	/* initialize default_value */
 	switch (stemp->type) {
@@ -116,6 +117,7 @@ static bNodeSocket *verify_socket_template(bNodeTree *ntree, bNode *node, int in
 		sock->type = stemp->type;
 		sock->limit = (stemp->limit == 0 ? 0xFFF : stemp->limit);
 		sock->flag |= stemp->flag;
+		sock->custom_notifier = stemp->custom_notifier;
 		
 		BLI_remlink(socklist, sock);
 		
diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h
index 64b2028..81b6dd3 100644
--- a/source/blender/nodes/intern/node_util.h
+++ b/source/blender/nodes/intern/node_util.h
@@ -47,6 +47,8 @@
 
 #include "RNA_access.h"
 
+#include "WM_types.h"  /* For notifiers. */
+
 struct bNodeTree;
 struct bNode;
 
diff --git a/source/blender/nodes/shader/node_shader_util.h b/source/blender/nodes/shader/node_shader_util.h
index 8a79603..7077e47 100644
--- a/source/blender/nodes/shader/node_shader_util.h
+++ b/source/blender/nodes/shader/node_shader_util.h
@@ -79,7 +79,6 @@
 
 #include "GPU_material.h"
 
-
 int sh_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree);
 void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag);
 
diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c
index 79d6649..e4c1582 100644
--- a/source/blender/nodes/shader/nodes/node_shader_material.c
+++ b/source/blender/nodes/shader/nodes/node_shader_material.c
@@ -34,10 +34,10 @@
 /* **************** MATERIAL ******************** */
 
 static bNodeSocketTemplate sh_node_material_in[] = {
-	{	SOCK_RGBA, 1, N_("Color"),		0.0f, 0.0f, 0.0f, 1.0f},
-	{	SOCK_RGBA, 1, N_("Spec"),		0.0f, 0.0f, 0.0f, 1.0f},
-	{	SOCK_FLOAT, 1, N_("Refl"),		0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
-	{	SOCK_VECTOR, 1, N_("Normal"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
+	{	SOCK_RGBA, 1, N_("Color"),		0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0, 0, NC_MATERIAL | ND_SHADING_DRAW},
+	{	SOCK_RGBA, 1, N_("Spec"),		0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0, 0, NC_MATERIAL | ND_SHADING_DRAW},
+	{	SOCK_FLOAT, 1, N_("Refl"),		0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE, 0, NC_MATERIAL | ND_SHADING_DRAW},
+	{	SOCK_VECTOR, 1, N_("Normal"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION, 0, NC_MATERIAL | ND_SHADING_DRAW},
 	{	-1, 0, ""	}
 };
 
@@ -51,13 +51,13 @@ static bNodeSocketTemplate sh_node_material_out[] = {
 /* **************** EXTENDED MATERIAL ******************** */
 
 static bNodeSocketTemplate sh_node_material_ext_in[] = {
-	{	SOCK_RGBA, 1, N_("Color"),		0.0f, 0.0f, 0.0f, 1.0f},
-	{	SOCK_RGBA, 1, N_("Spec"),		0.0f, 0.0f, 0.0f, 1.0f},
-	{	SOCK_FLOAT, 1, N_("Refl"),		0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
-	{	SOCK_VECTOR, 1, N_("Normal"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
+	{	SOCK_RGBA, 1, N_("Color"),		0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0, 0, NC_MATERIAL | ND_SHADING_DRAW},
+	{	SOCK_RGBA, 1, N_("Spec"),		0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0, 0, NC_MATERIAL | ND_SHADING_DRAW},
+	{	SOCK_FLOAT, 1, N_("Refl"),		0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE, 0, NC_MATERIAL | ND_SHADING_DRAW},
+	{	SOCK_VECTOR, 1, N_("Normal"),	0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION, 0, NC_MATERIAL | ND_SHADING_DRAW},
 	{	SOCK_RGBA, 1, N_("Mirror"),		0.0f, 0.0f, 0.0f, 1.0f},
-	{	SOCK_FLOAT, 1, N_("Ambient"),	0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
-	{	SOCK_FLOAT, 1, N_("Emit"),		0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
+	{	SOCK_FLOAT, 1, N_("Ambient"),	0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE, 0, NC_MATERIAL | ND_SHADING_DRAW},
+	{	SOCK_FLOAT, 1, N_("Emit"),		0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED, 0, NC_MATERIAL | ND_SHADING_DRAW},
 	{	SOCK_FLOAT, 1, N_("SpecTra"),	0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
 	{	SOCK_FLOAT, 1, N_("Ray Mirror"),	0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
 	{	SOCK_FLOAT, 1, N_("Alpha"),		0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},

Not sure this is better than first patch tbh… :/ Not a 2.72 one anyway, I think!

So new patch, more complex, but avoids refreshing solid 3DView on all NC_MATERIAL | ND_NODES notifiers. Idea is to allow each socket to define it own custom notifier to send in addition of default, generic one. [P143: #41769](https://archive.blender.org/developer/P143.txt) ``` diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index cb96538..e8e33b7 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -102,6 +102,7 @@ typedef struct bNodeSocketTemplate { float min, max; int subtype; /* would use PropertySubType but this is a bad level include to use RNA */ int flag; + int custom_notifier; /* after this line is used internal only */ struct bNodeSocket *sock; /* used to hold verified socket */ diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 13e46bc..00aca12 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -31,6 +31,7 @@ set(INC ../imbuf ../makesdna ../makesrna + ../windowmanager # Sigh... Because of nodes. # For node muting stuff... ../nodes diff --git a/source/blender/gpu/SConscript b/source/blender/gpu/SConscript index e9320f0..8849fa2 100644 --- a/source/blender/gpu/SConscript +++ b/source/blender/gpu/SConscript @@ -46,6 +46,7 @@ incs = [ '../makesrna', '../nodes', '../nodes/intern', + '../windowmanager', # Sigh... Because of nodes. env['BF_OPENGL_INC'], ] diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index e0d25e7..7e6af2c 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -108,11 +108,12 @@ typedef struct bNodeSocket { void *default_value; /* default input value used for unlinked sockets */ + int custom_notifier; /* custom notifier to use for this socket (from its template) */ + /* execution data */ short stack_index; /* local stack index */ /* XXX deprecated, kept for forward compatibility */ short stack_type DNA_DEPRECATED; - int pad; void *cache; /* cached data from execution */ diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 2e0ad63..1ef39ec 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -340,7 +340,7 @@ static void rna_Material_use_nodes_update(bContext *C, PointerRNA *ptr) if (ma->use_nodes && ma->nodetree == NULL) ED_node_shader_default(C, &ma->id); - rna_Material_update(CTX_data_main(C), CTX_data_scene(C), ptr); + rna_Material_draw_update(CTX_data_main(C), CTX_data_scene(C), ptr); } static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *UNUSED(C), PointerRNA *ptr, diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index e90de36..44aa845 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -2231,17 +2231,20 @@ static void rna_NodeSocketStandard_vector_range(PointerRNA *ptr, float *min, flo /* using a context update function here, to avoid searching the node if possible */ static void rna_NodeSocketStandard_value_update(struct bContext *C, PointerRNA *ptr) { + bNodeTree *ntree = ptr->id.data; bNode *node; + bNodeSocket *sock = ptr->data; /* default update */ rna_NodeSocket_update(CTX_data_main(C), CTX_data_scene(C), ptr); + if (sock->custom_notifier) { + WM_event_add_notifier(C, sock->custom_notifier, ntree); + } + /* try to use node from context, faster */ node = CTX_data_pointer_get(C, "node").data; if (!node) { - bNodeTree *ntree = ptr->id.data; - bNodeSocket *sock = ptr->data; - /* fall back to searching node in the tree */ nodeFindNode(ntree, sock, &node, NULL); } diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index 2293415..ebea773 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -36,6 +36,7 @@ set(INC ../imbuf ../makesdna ../makesrna + ../windowmanager ../render/extern/include ../../../intern/guardedalloc ) diff --git a/source/blender/nodes/SConscript b/source/blender/nodes/SConscript index becf6e7..06411d9 100644 --- a/source/blender/nodes/SConscript +++ b/source/blender/nodes/SConscript @@ -47,6 +47,7 @@ incs = [ '../imbuf', '../makesdna', '../makesrna', + '../windowmanager', '../render/extern/include', env['BF_OPENGL_INC'], env['BF_ZLIB_INC'], diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c index 2ac1a2c..46b55d4 100644 --- a/source/blender/nodes/intern/node_socket.c +++ b/source/blender/nodes/intern/node_socket.c @@ -55,6 +55,7 @@ struct bNodeSocket *node_add_socket_from_template(struct bNodeTree *ntree, struc bNodeSocket *sock = nodeAddStaticSocket(ntree, node, in_out, stemp->type, stemp->subtype, stemp->identifier, stemp->name); sock->flag |= stemp->flag; + sock->custom_notifier = stemp->custom_notifier; /* initialize default_value */ switch (stemp->type) { @@ -116,6 +117,7 @@ static bNodeSocket *verify_socket_template(bNodeTree *ntree, bNode *node, int in sock->type = stemp->type; sock->limit = (stemp->limit == 0 ? 0xFFF : stemp->limit); sock->flag |= stemp->flag; + sock->custom_notifier = stemp->custom_notifier; BLI_remlink(socklist, sock); diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h index 64b2028..81b6dd3 100644 --- a/source/blender/nodes/intern/node_util.h +++ b/source/blender/nodes/intern/node_util.h @@ -47,6 +47,8 @@ #include "RNA_access.h" +#include "WM_types.h" /* For notifiers. */ + struct bNodeTree; struct bNode; diff --git a/source/blender/nodes/shader/node_shader_util.h b/source/blender/nodes/shader/node_shader_util.h index 8a79603..7077e47 100644 --- a/source/blender/nodes/shader/node_shader_util.h +++ b/source/blender/nodes/shader/node_shader_util.h @@ -79,7 +79,6 @@ #include "GPU_material.h" - int sh_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree); void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag); diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c index 79d6649..e4c1582 100644 --- a/source/blender/nodes/shader/nodes/node_shader_material.c +++ b/source/blender/nodes/shader/nodes/node_shader_material.c @@ -34,10 +34,10 @@ /* **************** MATERIAL ******************** */ static bNodeSocketTemplate sh_node_material_in[] = { - { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_RGBA, 1, N_("Spec"), 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_FLOAT, 1, N_("Refl"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION}, + { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0, 0, NC_MATERIAL | ND_SHADING_DRAW}, + { SOCK_RGBA, 1, N_("Spec"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0, 0, NC_MATERIAL | ND_SHADING_DRAW}, + { SOCK_FLOAT, 1, N_("Refl"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE, 0, NC_MATERIAL | ND_SHADING_DRAW}, + { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION, 0, NC_MATERIAL | ND_SHADING_DRAW}, { -1, 0, "" } }; @@ -51,13 +51,13 @@ static bNodeSocketTemplate sh_node_material_out[] = { /* **************** EXTENDED MATERIAL ******************** */ static bNodeSocketTemplate sh_node_material_ext_in[] = { - { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_RGBA, 1, N_("Spec"), 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_FLOAT, 1, N_("Refl"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION}, + { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0, 0, NC_MATERIAL | ND_SHADING_DRAW}, + { SOCK_RGBA, 1, N_("Spec"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0, 0, NC_MATERIAL | ND_SHADING_DRAW}, + { SOCK_FLOAT, 1, N_("Refl"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE, 0, NC_MATERIAL | ND_SHADING_DRAW}, + { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION, 0, NC_MATERIAL | ND_SHADING_DRAW}, { SOCK_RGBA, 1, N_("Mirror"), 0.0f, 0.0f, 0.0f, 1.0f}, - { SOCK_FLOAT, 1, N_("Ambient"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, - { SOCK_FLOAT, 1, N_("Emit"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, + { SOCK_FLOAT, 1, N_("Ambient"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE, 0, NC_MATERIAL | ND_SHADING_DRAW}, + { SOCK_FLOAT, 1, N_("Emit"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED, 0, NC_MATERIAL | ND_SHADING_DRAW}, { SOCK_FLOAT, 1, N_("SpecTra"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("Ray Mirror"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("Alpha"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, ``` Not sure this is better than first patch tbh… :/ Not a 2.72 one anyway, I think!
Author
Owner

Added subscriber: @LukasTonne

Added subscriber: @LukasTonne
Author
Owner

Note: will commit the change to rna_Material_use_nodes_update() immediately, that one is trivial and fixes the 'enable/disable nodes' update issue.

Note: will commit the change to `rna_Material_use_nodes_update()` immediately, that one is trivial and fixes the 'enable/disable nodes' update issue.

This issue was referenced by 6159f9a55a

This issue was referenced by 6159f9a55a4edc61c11dbe1b6167fbefd17b6fb9

Added subscriber: @brecht

Added subscriber: @brecht

This is a simpler solution, though it's still quite hacky. Not sure how to do it much better, besides the above patch which is more complicated.

diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index da77b9e..f1b1296 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -2258,8 +2258,13 @@ static void rna_NodeSocketStandard_value_update(struct bContext *C, PointerRNA *
                nodeFindNode(ntree, sock, &node, NULL);
        }

-       if (node)
+       if (node) {
                nodeSynchronizeID(node, true);
+
+               /* extra update for sockets that get synced to material */
+               if (node->id && ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT))
+                       WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, node->id);
+       }
 }
This is a simpler solution, though it's still quite hacky. Not sure how to do it much better, besides the above patch which is more complicated. ``` diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index da77b9e..f1b1296 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -2258,8 +2258,13 @@ static void rna_NodeSocketStandard_value_update(struct bContext *C, PointerRNA * nodeFindNode(ntree, sock, &node, NULL); } - if (node) + if (node) { nodeSynchronizeID(node, true); + + /* extra update for sockets that get synced to material */ + if (node->id && ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) + WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, node->id); + } } ```

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit 6159f9a55a.

Closed by commit 6159f9a55a.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#41739
No description provided.