[Bf-blender-cvs] [15fb8ad6ae5] master: Nodes: left align text for color and string sockets, same as other types.

Brecht Van Lommel noreply at git.blender.org
Fri Feb 23 19:02:16 CET 2018


Commit: 15fb8ad6ae5920ab508d536ca7619009a3ab718d
Author: Brecht Van Lommel
Date:   Sun Feb 18 03:15:13 2018 +0100
Branches: master
https://developer.blender.org/rB15fb8ad6ae5920ab508d536ca7619009a3ab718d

Nodes: left align text for color and string sockets, same as other types.

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

M	source/blender/editors/space_node/drawnode.c
M	source/blender/editors/space_node/node_draw.c

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

diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 9d873795eaf..5665a5cff2d 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -3048,7 +3048,7 @@ static const float std_node_socket_colors[][4] = {
 	{0.70, 0.65, 0.19, 1.0},    /* SOCK_BOOLEAN */
 	{0.0, 0.0, 0.0, 1.0},       /*__SOCK_MESH (deprecated) */
 	{0.06, 0.52, 0.15, 1.0},    /* SOCK_INT */
-	{1.0, 1.0, 1.0, 1.0},       /* SOCK_STRING */
+	{0.39, 0.39, 0.39, 1.0},    /* SOCK_STRING */
 };
 
 /* common color callbacks for standard types */
@@ -3135,20 +3135,11 @@ static void std_node_socket_draw(bContext *C, uiLayout *layout, PointerRNA *ptr,
 			uiTemplateComponentMenu(layout, ptr, "default_value", text);
 			break;
 		case SOCK_RGBA:
-		{
-			uiLayout *row = uiLayoutRow(layout, false);
-			uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT);
-			/* draw the socket name right of the actual button */
-			uiItemR(row, ptr, "default_value", 0, "", 0);
-			uiItemL(row, text, 0);
-			break;
-		}
 		case SOCK_STRING:
 		{
-			uiLayout *row = uiLayoutRow(layout, true);
-			/* draw the socket name right of the actual button */
-			uiItemR(row, ptr, "default_value", 0, "", 0);
+			uiLayout *row = uiLayoutSplit(layout, 0.5f, false);
 			uiItemL(row, text, 0);
+			uiItemR(row, ptr, "default_value", 0, "", 0);
 			break;
 		}
 		default:
@@ -3182,11 +3173,6 @@ static void std_node_socket_interface_draw(bContext *UNUSED(C), uiLayout *layout
 			uiItemR(row, ptr, "max_value", 0, IFACE_("Max"), 0);
 			break;
 		}
-		case SOCK_BOOLEAN:
-		{
-			uiItemR(layout, ptr, "default_value", 0, NULL, 0);
-			break;
-		}
 		case SOCK_VECTOR:
 		{
 			uiLayout *row;
@@ -3196,11 +3182,8 @@ static void std_node_socket_interface_draw(bContext *UNUSED(C), uiLayout *layout
 			uiItemR(row, ptr, "max_value", 0, IFACE_("Max"), 0);
 			break;
 		}
+		case SOCK_BOOLEAN:
 		case SOCK_RGBA:
-		{
-			uiItemR(layout, ptr, "default_value", 0, NULL, 0);
-			break;
-		}
 		case SOCK_STRING:
 		{
 			uiItemR(layout, ptr, "default_value", 0, NULL, 0);
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index d7119302611..e56a3a549fc 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -354,6 +354,8 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
 		dy -= NODE_DYS / 2;
 	
 	/* output sockets */
+	bool add_output_space = false;
+
 	for (nsock = node->outputs.first; nsock; nsock = nsock->next) {
 		if (nodeSocketIsHidden(nsock))
 			continue;
@@ -386,6 +388,12 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
 		dy = buty;
 		if (nsock->next)
 			dy -= NODE_SOCKDY;
+
+		add_output_space = true;
+	}
+
+	if (add_output_space) {
+		dy -= NODE_DY / 4;
 	}
 
 	node->prvr.xmin = locx + NODE_DYS;



More information about the Bf-blender-cvs mailing list