From 95efb2ea83f0f6b4fad6c2d3da2a4875bd3a89b1 Mon Sep 17 00:00:00 2001 From: Iliya Katueshenock Date: Fri, 8 Sep 2023 14:22:06 +0200 Subject: [PATCH] Fix #111832: Move the Node Group Icon to a first position in header Node Group icon have a ID-counter widget and can not be drawn sequentially with other icons without extra offset. To fix icon overlapping and add more consistency, icon, specific for such node, should be first in its header. Pull Request: https://projects.blender.org/blender/blender/pulls/112142 --- .../blender/editors/space_node/node_draw.cc | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 2a4cef0b10d..04490b6f6c6 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -2580,31 +2580,7 @@ static void node_draw_basis(const bContext &C, /* Show/hide icons. */ float iconofs = rct.xmax - 0.35f * U.widget_unit; - /* Preview. */ - if (node_is_previewable(snode, ntree, node)) { - iconofs -= iconbutw; - UI_block_emboss_set(&block, UI_EMBOSS_NONE); - uiBut *but = uiDefIconBut(&block, - UI_BTYPE_BUT_TOGGLE, - 0, - ICON_MATERIAL, - iconofs, - rct.ymax - NODE_DY, - iconbutw, - UI_UNIT_Y, - nullptr, - 0, - 0, - 0, - 0, - ""); - UI_but_func_set(but, - node_toggle_button_cb, - POINTER_FROM_INT(node.identifier), - (void *)"NODE_OT_preview_toggle"); - UI_block_emboss_set(&block, UI_EMBOSS); - } - /* Group edit. */ + /* Group edit. This icon should be the first for the node groups. */ if (node.type == NODE_GROUP) { iconofs -= iconbutw; UI_block_emboss_set(&block, UI_EMBOSS_NONE); @@ -2631,6 +2607,30 @@ static void node_draw_basis(const bContext &C, } UI_block_emboss_set(&block, UI_EMBOSS); } + /* Preview. */ + if (node_is_previewable(snode, ntree, node)) { + iconofs -= iconbutw; + UI_block_emboss_set(&block, UI_EMBOSS_NONE); + uiBut *but = uiDefIconBut(&block, + UI_BTYPE_BUT_TOGGLE, + 0, + ICON_MATERIAL, + iconofs, + rct.ymax - NODE_DY, + iconbutw, + UI_UNIT_Y, + nullptr, + 0, + 0, + 0, + 0, + ""); + UI_but_func_set(but, + node_toggle_button_cb, + POINTER_FROM_INT(node.identifier), + (void *)"NODE_OT_preview_toggle"); + UI_block_emboss_set(&block, UI_EMBOSS); + } if (node.type == NODE_CUSTOM && node.typeinfo->ui_icon != ICON_NONE) { iconofs -= iconbutw; UI_block_emboss_set(&block, UI_EMBOSS_NONE);