[Bf-blender-cvs] [5ede1bea5e0] modifier-panels-ui: UI: Draw real node sockets for node input buttons

Julian Eisel noreply at git.blender.org
Thu Apr 16 21:30:28 CEST 2020


Commit: 5ede1bea5e0d2f6215ab182db3c76de9a700d341
Author: Julian Eisel
Date:   Thu Apr 16 15:09:49 2020 +0200
Branches: modifier-panels-ui
https://developer.blender.org/rB5ede1bea5e0d2f6215ab182db3c76de9a700d341

UI: Draw real node sockets for node input buttons

For buttons representing node inputs (e.g. in the material properties)
rather than drawing some generic socket icon, the actual sockets are
drawn now. That includes color, shape and the selection outline.

This should make it easier to understand what these buttons relate to.

Screenshots: {F8469252}, {F8469248} (The left alignment will be done in
a follow-up commit.)

Differential Revision: https://developer.blender.org/D7409

Reviewed by: Brecht Van Lommel, Clément Foucault, William Reynish

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

M	source/blender/editors/interface/interface_widgets.c
M	source/blender/editors/space_node/node_draw.c
M	source/blender/editors/space_node/node_templates.c

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

diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index ba7bea8b428..ca688405e19 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2401,6 +2401,7 @@ static void widget_draw_node_link_socket(const uiWidgetColors *wcol,
                                          uiBut *but,
                                          float alpha)
 {
+  /* Node socket pointer can be passed as custom_data, see UI_but_node_link_set(). */
   if (but->custom_data) {
     const float scale = 0.9f / but->block->aspect;
 
@@ -2412,7 +2413,6 @@ static void widget_draw_node_link_socket(const uiWidgetColors *wcol,
     UI_widgetbase_draw_cache_flush();
     GPU_blend(false);
 
-    /* See UI_but_node_link_set() */
     ED_node_socket_draw(but->custom_data, rect, col, scale);
   }
   else {
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 591c6003153..bd8950c5085 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -707,7 +707,7 @@ static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node)
 #define MARKER_SHAPE_CIRCLE 0x2
 #define MARKER_SHAPE_INNER_DOT 0x10
 
-static uint node_socket_draw(const bNodeSocket *sock,
+static void node_socket_draw(const bNodeSocket *sock,
                              const float color[4],
                              const float color_outline[4],
                              float size,
@@ -750,8 +750,6 @@ static uint node_socket_draw(const bNodeSocket *sock,
   immAttr1f(size_id, size);
   immAttr4fv(outline_col_id, color_outline);
   immVertex2f(pos_id, locx, locy);
-
-  return flags;
 }
 
 static void node_socket_outline_color_get(bool selected, float r_outline_color[4])
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index 91fe6a97432..da0058585cb 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -695,7 +695,6 @@ void uiTemplateNodeLink(
 
   UI_but_type_set_menu_from_pulldown(but);
   UI_but_node_link_set(but, sock, socket_col);
-  UI_but_drawflag_enable(but, UI_BUT_ICON_LEFT);
 
   but->poin = (char *)but;
   but->func_argN = arg;
@@ -817,10 +816,6 @@ static void ui_node_draw_input(
     }
   }
   else {
-    row = uiLayoutRow(split, true);
-
-    uiTemplateNodeLink(row, C, ntree, node, input);
-
     /* input not linked, show value */
     if (!(input->flag & SOCK_HIDE_VALUE)) {
       switch (input->type) {
@@ -829,15 +824,25 @@ static void ui_node_draw_input(
         case SOCK_BOOLEAN:
         case SOCK_RGBA:
         case SOCK_STRING:
+          row = uiLayoutRow(split, true);
           uiItemR(row, &inputptr, "default_value", 0, "", ICON_NONE);
           break;
         case SOCK_VECTOR:
-          uiItemS(row);
+          row = uiLayoutRow(split, false);
           col = uiLayoutColumn(row, false);
           uiItemR(col, &inputptr, "default_value", 0, "", ICON_NONE);
           break;
+
+        default:
+          row = uiLayoutRow(split, false);
+          break;
       }
     }
+    else {
+      row = uiLayoutRow(split, false);
+    }
+
+    uiTemplateNodeLink(row, C, ntree, node, input);
   }
 
   /* clear */



More information about the Bf-blender-cvs mailing list