diff options
3 files changed, 37 insertions, 14 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 76c710b3db1..844f2ee8209 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -2958,6 +2958,41 @@ static void outliner_set_coord_tree_element(TreeElement *te, int startx, int sta } } +static bool element_should_draw_faded(const TreeViewContext *tvc, + const TreeElement *te, + const TreeStoreElem *tselem) +{ + if (tselem->type == 0) { + switch (te->idcode) { + case ID_OB: { + const Object *ob = (const Object *)tselem->id; + /* Lookup in view layer is logically const as it only checks a cache. */ + const Base *base = (te->directdata) ? (const Base *)te->directdata : + BKE_view_layer_base_find( + (ViewLayer *)tvc->view_layer, (Object *)ob); + const bool is_visible = (base != NULL) && (base->flag & BASE_VISIBLE_VIEWLAYER); + if (!is_visible) { + return true; + } + } + } + } + switch (tselem->type) { + case TSE_LAYER_COLLECTION: { + const LayerCollection *layer_collection = (const LayerCollection *)te->directdata; + const bool is_visibe = layer_collection->runtime_flag & LAYER_COLLECTION_VISIBLE_VIEW_LAYER; + const bool is_excluded = layer_collection->flag & LAYER_COLLECTION_EXCLUDE; + return !is_visibe || is_excluded; + } + } + + if (te->flag & TE_CHILD_NOT_IN_COLLECTION) { + return true; + } + + return false; +} + static void outliner_draw_tree_element(bContext *C, uiBlock *block, const uiFontStyle *fstyle, @@ -2981,10 +3016,7 @@ static void outliner_draw_tree_element(bContext *C, outliner_icon_background_colors(icon_bgcolor, icon_border); if (*starty + 2 * UI_UNIT_Y >= region->v2d.cur.ymin && *starty <= region->v2d.cur.ymax) { - const float alpha_fac = ((te->flag & TE_DISABLED) || (te->flag & TE_CHILD_NOT_IN_COLLECTION) || - draw_grayed_out) ? - 0.5f : - 1.0f; + const float alpha_fac = element_should_draw_faded(tvc, te, tselem) ? 0.5f : 1.0f; int xmax = region->v2d.cur.xmax; if ((tselem->flag & TSE_TEXTBUT) && (*te_edit == NULL)) { diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index b65b1a57143..9413b7a9613 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -153,8 +153,7 @@ enum { TE_ICONROW = (1 << 1), TE_LAZY_CLOSED = (1 << 2), TE_FREE_NAME = (1 << 3), - TE_DISABLED = (1 << 4), - TE_DRAGGING = (1 << 5), + TE_DRAGGING = (1 << 4), TE_CHILD_NOT_IN_COLLECTION = (1 << 6), /* Child elements of the same type in the icon-row are drawn merged as one icon. * This flag is set for an element that is part of these merged child icons. */ diff --git a/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc b/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc index f7740f4648f..afdee185d0d 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_view_layer.cc @@ -143,10 +143,6 @@ void TreeDisplayViewLayer::add_layer_collections_recursive(ListBase &tree, if (!(tselem->used || ID_IS_LINKED(id) || ID_IS_OVERRIDE_LIBRARY(id))) { tselem->flag &= ~TSE_CLOSED; } - - if (exclude || (lc->runtime_flag & LAYER_COLLECTION_VISIBLE_VIEW_LAYER) == 0) { - ten->flag |= TE_DISABLED; - } } add_layer_collections_recursive(ten->subtree, lc->layer_collections, *ten); @@ -165,10 +161,6 @@ void TreeDisplayViewLayer::add_layer_collection_objects(ListBase &tree, TreeElement *te_object = outliner_add_element( &space_outliner_, &tree, base->object, &ten, 0, 0); te_object->directdata = base; - - if (!(base->flag & BASE_VISIBLE_VIEWLAYER)) { - te_object->flag |= TE_DISABLED; - } } } |