diff options
author | Leon Schittek <leon.schittek@gmx.net> | 2022-03-30 00:39:50 +0300 |
---|---|---|
committer | Leon Schittek <leon.schittek@gmx.net> | 2022-03-30 00:39:50 +0300 |
commit | ee1d5fb9e4671a60fc3083dde78c227d9ef73aa2 (patch) | |
tree | a0396e8ec9e1d797884eb2e4744e75bf70c1a9a0 /source/blender/editors/space_node/node_draw.cc | |
parent | 08b4b657b64fe8632f532e732cebdaec73264d66 (diff) |
UI: Fix cosmetic papercuts of the reroute node
Fix small cosmetic issues with the reroute node:
1. Remove special case that allowed curved links to attach vertically.
2. Center align the reroute node's label.
The vertically attached node links could lead to kinks in the otherwise
smooth curves. This would break the visual flow and make the link
potentially intersect the node's label.
The center alignment of the label gives more consistent results for
different label lengths and also reduces the chance of the label
interfering with the node links.
Reviewed By: Hans Goudey, Pablo Vazquez
Differential Revision: D14457
Diffstat (limited to 'source/blender/editors/space_node/node_draw.cc')
-rw-r--r-- | source/blender/editors/space_node/node_draw.cc | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 7f0c426922b..d39304284ad 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -2574,20 +2574,14 @@ static void reroute_node_draw( if (node.label[0] != '\0') { /* draw title (node label) */ BLI_strncpy(showname, node.label, sizeof(showname)); - uiDefBut(&block, - UI_BTYPE_LABEL, - 0, - showname, - (int)(rct.xmin - NODE_DYS), - (int)(rct.ymax), - (short)512, - (short)NODE_DY, - nullptr, - 0, - 0, - 0, - 0, - nullptr); + const short width = 512; + const int x = BLI_rctf_cent_x(&node.totr) - (width / 2); + const int y = node.totr.ymax; + + uiBut *label_but = uiDefBut( + &block, UI_BTYPE_LABEL, 0, showname, x, y, width, (short)NODE_DY, NULL, 0, 0, 0, 0, NULL); + + UI_but_drawflag_disable(label_but, UI_BUT_TEXT_LEFT); } /* only draw input socket. as they all are placed on the same position. |