From f54db0fa057e036645f0e635ca849cfb61320ded Mon Sep 17 00:00:00 2001 From: Robert Guetzkow Date: Tue, 2 Apr 2019 16:39:48 +0200 Subject: UI: Collapsed nodes have the same width as uncollapsed nodes Fixes T63079. Differential Revision: https://developer.blender.org/D4617 --- source/blender/editors/space_node/node_draw.c | 24 +++++++++++------------- source/blender/editors/space_node/node_edit.c | 19 ++++--------------- 2 files changed, 15 insertions(+), 28 deletions(-) (limited to 'source') diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 4720feba4ed..6f7ebd36c09 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -583,7 +583,7 @@ static void node_update_hidden(bNode *node) } node->totr.xmin = locx; - node->totr.xmax = locx + 3 * hiddenrad + node->miniwidth; + node->totr.xmax = locx + max_ff(NODE_WIDTH(node), 2 * hiddenrad); node->totr.ymax = locy + (hiddenrad - 0.5f * NODE_DY); node->totr.ymin = node->totr.ymax - 2 * hiddenrad; @@ -1169,20 +1169,18 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b node_draw_mute_line(&ar->v2d, snode, node); } - if (node->miniwidth > 0.0f) { - nodeLabel(ntree, node, showname, sizeof(showname)); + nodeLabel(ntree, node, showname, sizeof(showname)); - /* XXX - don't print into self! */ - //if (node->flag & NODE_MUTED) - // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); + /* XXX - don't print into self! */ + //if (node->flag & NODE_MUTED) + // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); - uiBut *but = uiDefBut(node->block, UI_BTYPE_LABEL, 0, showname, - round_fl_to_int(rct->xmin + NODE_MARGIN_X), round_fl_to_int(centy - NODE_DY * 0.5f), - (short)(BLI_rctf_size_x(rct) - 18.0f - 12.0f), (short)NODE_DY, - NULL, 0, 0, 0, 0, ""); - if (node->flag & NODE_MUTED) { - UI_but_flag_enable(but, UI_BUT_INACTIVE); - } + uiBut *but = uiDefBut(node->block, UI_BTYPE_LABEL, 0, showname, + round_fl_to_int(rct->xmin + NODE_MARGIN_X), round_fl_to_int(centy - NODE_DY * 0.5f), + (short)(BLI_rctf_size_x(rct) - 18.0f - 12.0f), (short)NODE_DY, + NULL, 0, 0, 0, 0, ""); + if (node->flag & NODE_MUTED) { + UI_but_flag_enable(but, UI_BUT_INACTIVE); } /* scale widget thing */ diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 006554f230e..a6aaca88e62 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -837,7 +837,6 @@ typedef struct NodeSizeWidget { float oldlocx, oldlocy; float oldoffsetx, oldoffsety; float oldwidth, oldheight; - float oldminiwidth; int directions; } NodeSizeWidget; @@ -858,7 +857,6 @@ static void node_resize_init(bContext *C, wmOperator *op, const wmEvent *UNUSED( nsw->oldoffsety = node->offsety; nsw->oldwidth = node->width; nsw->oldheight = node->height; - nsw->oldminiwidth = node->miniwidth; nsw->directions = dir; WM_cursor_modal_set(CTX_wm_window(C), node_get_resize_cursor(dir)); @@ -890,21 +888,12 @@ static int node_resize_modal(bContext *C, wmOperator *op, const wmEvent *event) dy = (my - nsw->mystart) / UI_DPI_FAC; if (node) { - /* width can use node->width or node->miniwidth (hidden nodes) */ float *pwidth; float oldwidth, widthmin, widthmax; - /* ignore hidden flag for frame nodes */ - bool use_hidden = (node->type != NODE_FRAME); - if (use_hidden && node->flag & NODE_HIDDEN) { - pwidth = &node->miniwidth; - oldwidth = nsw->oldminiwidth; - widthmin = 0.0f; - } - else { - pwidth = &node->width; - oldwidth = nsw->oldwidth; - widthmin = node->typeinfo->minwidth; - } + + pwidth = &node->width; + oldwidth = nsw->oldwidth; + widthmin = node->typeinfo->minwidth; widthmax = node->typeinfo->maxwidth; { -- cgit v1.2.3