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
This commit is contained in:
Iliya Katueshenock
2023-09-08 14:22:06 +02:00
committed by Hans Goudey
parent e55599c120
commit 95efb2ea83

View File

@@ -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);