Fix #120393: Outliner: Inconsistent dim on hidden items
non object tree elements are not faded in outliner when object or parent collection is hidden. So in case of non ID_OB, call `element_should_draw_faded` and pass parent tree element as argument to decide the fade status. Also faded the icons and hierarchy lines. Pull Request: https://projects.blender.org/blender/blender/pulls/120397
This commit is contained in:
committed by
Pratik Borhade
parent
d95b1f120b
commit
f1955e1c57
@@ -2980,18 +2980,20 @@ static bool tselem_draw_icon(uiBlock *block,
|
||||
}
|
||||
}
|
||||
else {
|
||||
uiDefIconBut(block,
|
||||
UI_BTYPE_LABEL,
|
||||
0,
|
||||
data.icon,
|
||||
x,
|
||||
y,
|
||||
UI_UNIT_X,
|
||||
UI_UNIT_Y,
|
||||
nullptr,
|
||||
0.0,
|
||||
0.0,
|
||||
(data.drag_id && ID_IS_LINKED(data.drag_id)) ? data.drag_id->lib->filepath : "");
|
||||
uiBut *but = uiDefIconBut(
|
||||
block,
|
||||
UI_BTYPE_LABEL,
|
||||
0,
|
||||
data.icon,
|
||||
x,
|
||||
y,
|
||||
UI_UNIT_X,
|
||||
UI_UNIT_Y,
|
||||
nullptr,
|
||||
0.0,
|
||||
0.0,
|
||||
(data.drag_id && ID_IS_LINKED(data.drag_id)) ? data.drag_id->lib->filepath : "");
|
||||
UI_but_label_alpha_factor_set(but, alpha);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -3276,6 +3278,12 @@ static bool element_should_draw_faded(const TreeViewContext *tvc,
|
||||
if (!is_visible) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (te->parent) {
|
||||
return element_should_draw_faded(tvc, te->parent, te->parent->store_elem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3562,6 +3570,7 @@ static void outliner_draw_hierarchy_line(
|
||||
static void outliner_draw_hierarchy_lines_recursive(uint pos,
|
||||
SpaceOutliner *space_outliner,
|
||||
ListBase *lb,
|
||||
const TreeViewContext *tvc,
|
||||
int startx,
|
||||
const uchar col[4],
|
||||
bool draw_grayed_out,
|
||||
@@ -3606,18 +3615,28 @@ static void outliner_draw_hierarchy_lines_recursive(uint pos,
|
||||
}
|
||||
}
|
||||
|
||||
outliner_draw_hierarchy_lines_recursive(
|
||||
pos, space_outliner, &te->subtree, startx + UI_UNIT_X, col, draw_grayed_out, starty);
|
||||
outliner_draw_hierarchy_lines_recursive(pos,
|
||||
space_outliner,
|
||||
&te->subtree,
|
||||
tvc,
|
||||
startx + UI_UNIT_X,
|
||||
col,
|
||||
draw_grayed_out,
|
||||
starty);
|
||||
}
|
||||
|
||||
if (draw_hierarchy_line) {
|
||||
const short alpha_fac = element_should_draw_faded(tvc, te, tselem) ? 127 : 255;
|
||||
uchar line_color[4];
|
||||
if (color_tag != COLLECTION_COLOR_NONE) {
|
||||
immUniformColor4ubv(btheme->collection_color[color_tag].color);
|
||||
copy_v4_v4_uchar(line_color, btheme->collection_color[color_tag].color);
|
||||
}
|
||||
else {
|
||||
immUniformColor4ubv(col);
|
||||
copy_v4_v4_uchar(line_color, col);
|
||||
}
|
||||
|
||||
line_color[3] = alpha_fac;
|
||||
immUniformColor4ubv(line_color);
|
||||
outliner_draw_hierarchy_line(pos, startx, y, *starty, is_object_line);
|
||||
}
|
||||
}
|
||||
@@ -3625,6 +3644,7 @@ static void outliner_draw_hierarchy_lines_recursive(uint pos,
|
||||
|
||||
static void outliner_draw_hierarchy_lines(SpaceOutliner *space_outliner,
|
||||
ListBase *lb,
|
||||
const TreeViewContext *tvc,
|
||||
int startx,
|
||||
int *starty)
|
||||
{
|
||||
@@ -3644,7 +3664,8 @@ static void outliner_draw_hierarchy_lines(SpaceOutliner *space_outliner,
|
||||
|
||||
GPU_line_width(1.0f);
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
outliner_draw_hierarchy_lines_recursive(pos, space_outliner, lb, startx, col, false, starty);
|
||||
outliner_draw_hierarchy_lines_recursive(
|
||||
pos, space_outliner, lb, tvc, startx, col, false, starty);
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
|
||||
immUnbindProgram();
|
||||
@@ -3846,7 +3867,7 @@ static void outliner_draw_tree(bContext *C,
|
||||
/* Draw hierarchy lines for collections and object children. */
|
||||
starty = int(region->v2d.tot.ymax) - OL_Y_OFFSET;
|
||||
startx = columns_offset + UI_UNIT_X / 2 - (U.pixelsize + 1) / 2;
|
||||
outliner_draw_hierarchy_lines(space_outliner, &space_outliner->tree, startx, &starty);
|
||||
outliner_draw_hierarchy_lines(space_outliner, &space_outliner->tree, tvc, startx, &starty);
|
||||
|
||||
/* Items themselves. */
|
||||
starty = int(region->v2d.tot.ymax) - UI_UNIT_Y - OL_Y_OFFSET;
|
||||
|
||||
Reference in New Issue
Block a user