[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35573] branches/particles-2010/source/ blender: Fixed value button drawing for group outputs.

Lukas Toenne lukas.toenne at googlemail.com
Wed Mar 16 14:23:32 CET 2011


Revision: 35573
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35573
Author:   lukastoenne
Date:     2011-03-16 13:23:31 +0000 (Wed, 16 Mar 2011)
Log Message:
-----------
Fixed value button drawing for group outputs. The output buttons are generally enabled by the NODE_CONST_OUTPUT flag, since loop nodes (and other possibly other group-ish types) use direct copies of input values instead of constant outputs.

Modified Paths:
--------------
    branches/particles-2010/source/blender/editors/space_node/drawnode.c
    branches/particles-2010/source/blender/makesdna/DNA_node_types.h
    branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_common.c
    branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_common.c
    branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_common.c

Modified: branches/particles-2010/source/blender/editors/space_node/drawnode.c
===================================================================
--- branches/particles-2010/source/blender/editors/space_node/drawnode.c	2011-03-16 13:03:05 UTC (rev 35572)
+++ branches/particles-2010/source/blender/editors/space_node/drawnode.c	2011-03-16 13:23:31 UTC (rev 35573)
@@ -470,6 +470,7 @@
 	bNodeTree *ngroup= (bNodeTree*)gnode->id;
 	uiBut *bt;
 	float offset;
+	int draw_value;
 	
 	/* node and group socket circles */
 	if (sock)
@@ -481,14 +482,23 @@
 	offset = (in_out==SOCK_IN ? -114 : 42);
 	if (!gsock)
 		offset += (in_out==SOCK_IN ? NODE_GROUP_FRAME : -NODE_GROUP_FRAME);
-	if ((in_out==SOCK_IN && gsock && (gsock->flag & SOCK_INTERNAL)) || (in_out==SOCK_OUT && sock && sock->link)) {
-		/* only name, no value button */
-		if (gsock)
-			draw_group_socket_name(snode, gnode, gsock, in_out, offset, -NODE_DYS);
+	
+	/* draw both name and value button if:
+	 * 1) input: not internal
+	 * 2) output: (node type uses const outputs) and (group output is unlinked)
+	 */
+	switch (in_out) {
+	case SOCK_IN:
+		draw_value = !(gsock && (gsock->flag & SOCK_INTERNAL));
+		break;
+	case SOCK_OUT:
+		if (gnode->flag & NODE_CONST_OUTPUT)
+			draw_value = !(gsock && gsock->link);
 		else
-			draw_group_socket_name(snode, gnode, sock, in_out, offset, -NODE_DYS);
+			draw_value = 0;
+		break;
 	}
-	else {
+	if (draw_value) {
 		/* both name and value buttons */
 		if (gsock) {
 			draw_group_socket_name(snode, gnode, gsock, in_out, offset, 0);
@@ -503,6 +513,13 @@
 									NULL, NULL, NULL);
 		}
 	}
+	else {
+		/* only name, no value button */
+		if (gsock)
+			draw_group_socket_name(snode, gnode, gsock, in_out, offset, -NODE_DYS);
+		else
+			draw_group_socket_name(snode, gnode, sock, in_out, offset, -NODE_DYS);
+	}
 	
 	if (gsock && !(gsock->flag & SOCK_STATIC)) {
 		/* up/down buttons */

Modified: branches/particles-2010/source/blender/makesdna/DNA_node_types.h
===================================================================
--- branches/particles-2010/source/blender/makesdna/DNA_node_types.h	2011-03-16 13:03:05 UTC (rev 35572)
+++ branches/particles-2010/source/blender/makesdna/DNA_node_types.h	2011-03-16 13:23:31 UTC (rev 35573)
@@ -192,8 +192,8 @@
 	/* composite: don't do node but pass on buffer(s) */
 #define NODE_MUTED			512
 #define NODE_CUSTOM_NAME		1024	/* deprecated! */
-	/* simulation: don't automatically request all data inputs */
-#define NODE_CUSTOM_REQUEST	2048
+	/* group node types: use const outputs by default */
+#define NODE_CONST_OUTPUT	2048
 
 typedef struct bNodeLink {
 	struct bNodeLink *next, *prev;

Modified: branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_common.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_common.c	2011-03-16 13:03:05 UTC (rev 35572)
+++ branches/particles-2010/source/blender/nodes/intern/CMP_nodes/CMP_common.c	2011-03-16 13:23:31 UTC (rev 35573)
@@ -95,7 +95,7 @@
 {
 	static bNodeType ntype;
 
-	node_type_base(&ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS, NULL, NULL);
+	node_type_base(&ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS|NODE_CONST_OUTPUT, NULL, NULL);
 	node_type_size(&ntype, 120, 60, 200);
 	node_type_label(&ntype, group_label);
 	node_type_init(&ntype, group_init);

Modified: branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_common.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_common.c	2011-03-16 13:03:05 UTC (rev 35572)
+++ branches/particles-2010/source/blender/nodes/intern/SHD_nodes/SHD_common.c	2011-03-16 13:23:31 UTC (rev 35573)
@@ -88,7 +88,7 @@
 {
 	static bNodeType ntype;
 
-	node_type_base(&ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS, NULL, NULL);
+	node_type_base(&ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS|NODE_CONST_OUTPUT, NULL, NULL);
 	node_type_size(&ntype, 120, 60, 200);
 	node_type_label(&ntype, group_label);
 	node_type_init(&ntype, group_init);

Modified: branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_common.c
===================================================================
--- branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_common.c	2011-03-16 13:03:05 UTC (rev 35572)
+++ branches/particles-2010/source/blender/nodes/intern/TEX_nodes/TEX_common.c	2011-03-16 13:23:31 UTC (rev 35573)
@@ -107,7 +107,7 @@
 {
 	static bNodeType ntype;
 
-	node_type_base(&ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS, NULL, NULL);
+	node_type_base(&ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS|NODE_CONST_OUTPUT, NULL, NULL);
 	node_type_size(&ntype, 120, 60, 200);
 	node_type_label(&ntype, group_label);
 	node_type_init(&ntype, group_init);




More information about the Bf-blender-cvs mailing list