Fix T64467: Outliner Rename drawing overlapping restriction column + checkbox

For anyone interesting on polishing pixels, this is still one of the few
places in Blender where when renaming the name "jumps" a tiny bit when
editing. Most of the other places (id rename, UI list rename, ...) have
the text drawing in the exact same place while editing it and drawing.
This commit is contained in:
Dalai Felinto 2019-05-14 20:03:44 -03:00
parent 4e46ed37fc
commit a63be6c6c7
Notes: blender-bot 2024-04-11 14:26:06 +02:00
Referenced by issue #64467, Outliner: Rename collapsed collection - icon still visible
1 changed files with 12 additions and 3 deletions

View File

@ -1642,8 +1642,13 @@ static void outliner_draw_rnabuts(
}
}
static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, TreeElement *te)
static void outliner_buttons(const bContext *C,
uiBlock *block,
ARegion *ar,
const float restrict_column_width,
TreeElement *te)
{
SpaceOutliner *soops = CTX_wm_space_outliner(C);
uiBut *bt;
TreeStoreElem *tselem;
int spx, dx, len;
@ -1669,7 +1674,11 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Tre
}
spx = te->xs + 1.8f * UI_UNIT_X;
dx = ar->v2d.cur.xmax - (spx + 3.2f * UI_UNIT_X);
if ((tselem->type == TSE_LAYER_COLLECTION) &&
(soops->show_restrict_flags & SO_RESTRICT_ENABLE)) {
spx += UI_UNIT_X;
}
dx = ar->v2d.cur.xmax - (spx + restrict_column_width + 0.2f * UI_UNIT_X);
bt = uiDefBut(block,
UI_BTYPE_TEXT,
@ -3305,7 +3314,7 @@ void draw_outliner(const bContext *C)
/* Draw edit buttons if necessary. */
if (te_edit) {
outliner_buttons(C, block, ar, te_edit);
outliner_buttons(C, block, ar, restrict_column_width, te_edit);
}
UI_block_end(C, block);