Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessio Monti di Sopra <a.monti>2021-12-17 17:03:47 +0300
committerHans Goudey <h.goudey@me.com>2021-12-17 17:04:28 +0300
commit3b965ba10bf649922477cee41da9ed492299313c (patch)
treedaba3be9ce647f23c94baebf57a8a8754ba4000f /source/blender
parentb386f960f6ab37a65075bf48b09815c2a28c5ad5 (diff)
UI: Fix node socket alignment in some cases
The patch fixes some misalignments in the nodes' sockets/options recently introduced in 26d2caee3ba0, while maintaining the original fix for T92268. The original fix made the top padding always of the same size; while that works when the first row of the other node is `Socket | Socket`, it doesn't for other more common cases, `like Socket | Node Option`, where the text results misaligned. Differential Revision: https://developer.blender.org/D13451
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_node/node_draw.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc
index d68f16f6197..69d66b3fa7a 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -365,6 +365,10 @@ static void node_update_basis(const bContext &C, bNodeTree &ntree, bNode &node,
PointerRNA nodeptr;
RNA_pointer_create(&ntree.id, &RNA_Node, &node, &nodeptr);
+ const bool node_options = node.typeinfo->draw_buttons && (node.flag & NODE_OPTIONS);
+ const bool inputs_first = node.inputs.first &&
+ !(node.outputs.first || (node.flag & NODE_PREVIEW) || node_options);
+
/* Get "global" coordinates. */
float2 loc = node_to_view(node, float2(0));
/* Round the node origin because text contents are always pixel-aligned. */
@@ -377,7 +381,7 @@ static void node_update_basis(const bContext &C, bNodeTree &ntree, bNode &node,
dy -= NODE_DY;
/* Add a little bit of padding above the top socket. */
- if (node.outputs.first || node.inputs.first) {
+ if (node.outputs.first || inputs_first) {
dy -= NODE_DYS / 2;
}
@@ -478,7 +482,7 @@ static void node_update_basis(const bContext &C, bNodeTree &ntree, bNode &node,
}
/* Buttons rect? */
- if (node.typeinfo->draw_buttons && (node.flag & NODE_OPTIONS)) {
+ if (node_options) {
dy -= NODE_DYS / 2;
uiLayout *layout = UI_block_layout(&block,