UI: Collapsed nodes have the same width as uncollapsed nodes

Fixes T63079.

Differential Revision: https://developer.blender.org/D4617
This commit is contained in:
Robert Guetzkow
2019-04-02 16:39:48 +02:00
committed by Jacques Lucke
parent 459daf1648
commit f54db0fa05
2 changed files with 15 additions and 28 deletions

View File

@@ -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 */

View File

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