diff options
author | Julian Eisel <julian@blender.org> | 2022-05-25 13:53:07 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-05-25 21:16:17 +0300 |
commit | f1df685f570bbd248b0356fdb4afda1b181d6a09 (patch) | |
tree | 9d3ae9b30bd43550059f69d6c2b3b9978ca81d5e /source/blender/editors/space_outliner/outliner_select.cc | |
parent | 1a516bb714bf2892d9d10dc83cc1215a41a3d1ea (diff) |
Outliner: Refactor element warning and mode column querying
Uses a inheritance based approach for querying warning of tree elements
and the mode column support of display modes.
For the warnings, tree elements can override the
`AbstractTreeElement::getWarning()` method and return a warning string.
The UI will draw the warning column with warning icons. This makes the
warning column more generalized and easier to extend to more use-cases.
E.g. library override elements will use this after a followup commit.
To support mode toggles a display mode can now just return true in the
`AbstractTreeDisplay::supportsModeColumn()` method. This makes it
trivial to add mode columns to other display modes, and less error prone
because there's no need to hunt down a bunch of display mode checks in
different places.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_select.cc')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_select.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/editors/space_outliner/outliner_select.cc b/source/blender/editors/space_outliner/outliner_select.cc index fd0ee422df0..f7c65bfcff2 100644 --- a/source/blender/editors/space_outliner/outliner_select.cc +++ b/source/blender/editors/space_outliner/outliner_select.cc @@ -66,6 +66,7 @@ #include "RNA_prototypes.h" #include "outliner_intern.hh" +#include "tree/tree_display.hh" #include "tree/tree_element_seq.hh" using namespace blender::ed::outliner; @@ -1557,12 +1558,11 @@ static bool outliner_is_co_within_restrict_columns(const SpaceOutliner *space_ou bool outliner_is_co_within_mode_column(SpaceOutliner *space_outliner, const float view_mval[2]) { - /* Mode toggles only show in View Layer and Scenes modes. */ - if (!ELEM(space_outliner->outlinevis, SO_VIEW_LAYER, SO_SCENES)) { + if (!outliner_shows_mode_column(*space_outliner)) { return false; } - return space_outliner->flag & SO_MODE_COLUMN && view_mval[0] < UI_UNIT_X; + return view_mval[0] < UI_UNIT_X; } static bool outliner_is_co_within_active_mode_column(bContext *C, |