Outliner: Add "Selectable" object filter

This addition to the filters allows the user to enable the
outliner tree to restrict the listing to only Selectable objects.

Differential Revision: https://developer.blender.org/D7310
This commit is contained in:
Jaggz H 2020-10-31 23:37:31 -06:00 committed by Nathan Craddock
parent 084db58fbd
commit fbf2908674
4 changed files with 13 additions and 3 deletions

View File

@ -3420,7 +3420,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
case SPACE_OUTLINER: {
SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
space_outliner->filter &= ~(SO_FILTER_UNUSED_1 | SO_FILTER_UNUSED_5 |
SO_FILTER_UNUSED_12);
SO_FILTER_OB_STATE_SELECTABLE);
space_outliner->storeflag &= ~(SO_TREESTORE_UNUSED_1);
break;
}

View File

@ -2207,6 +2207,9 @@ static int outliner_exclude_filter_get(const SpaceOutliner *space_outliner)
case SO_FILTER_OB_ACTIVE:
exclude_filter |= SO_FILTER_OB_STATE_ACTIVE;
break;
case SO_FILTER_OB_SELECTABLE:
exclude_filter |= SO_FILTER_OB_STATE_SELECTABLE;
break;
}
return exclude_filter;
@ -2289,6 +2292,11 @@ static bool outliner_element_visible_get(ViewLayer *view_layer,
return false;
}
}
else if (exclude_filter & SO_FILTER_OB_STATE_SELECTABLE) {
if ((base->flag & BASE_SELECTABLE) == 0) {
return false;
}
}
else {
BLI_assert(exclude_filter & SO_FILTER_OB_STATE_ACTIVE);
if (base != BASACT(view_layer)) {

View File

@ -305,7 +305,7 @@ typedef enum eSpaceOutliner_Filter {
SO_FILTER_NO_OB_CAMERA = (1 << 10),
SO_FILTER_NO_OB_OTHERS = (1 << 11),
SO_FILTER_UNUSED_12 = (1 << 12), /* cleared */
SO_FILTER_OB_STATE_SELECTABLE = (1 << 12), /* Not set via DNA. */
SO_FILTER_OB_STATE_VISIBLE = (1 << 13), /* Not set via DNA. */
SO_FILTER_OB_STATE_HIDDEN = (1 << 14), /* Not set via DNA. */
SO_FILTER_OB_STATE_SELECTED = (1 << 15), /* Not set via DNA. */
@ -321,7 +321,7 @@ typedef enum eSpaceOutliner_Filter {
#define SO_FILTER_OB_STATE \
(SO_FILTER_OB_STATE_VISIBLE | SO_FILTER_OB_STATE_HIDDEN | SO_FILTER_OB_STATE_SELECTED | \
SO_FILTER_OB_STATE_ACTIVE)
SO_FILTER_OB_STATE_ACTIVE | SO_FILTER_OB_STATE_SELECTABLE)
#define SO_FILTER_ANY \
(SO_FILTER_NO_OB_CONTENT | SO_FILTER_NO_CHILDREN | SO_FILTER_OB_TYPE | SO_FILTER_OB_STATE | \
@ -334,6 +334,7 @@ typedef enum eSpaceOutliner_StateFilter {
SO_FILTER_OB_HIDDEN = 2,
SO_FILTER_OB_SELECTED = 3,
SO_FILTER_OB_ACTIVE = 4,
SO_FILTER_OB_SELECTABLE = 5,
} eSpaceOutliner_StateFilter;
/* SpaceOutliner.show_restrict_flags */

View File

@ -3050,6 +3050,7 @@ static void rna_def_space_outliner(BlenderRNA *brna)
{SO_FILTER_OB_HIDDEN, "HIDDEN", 0, "Hidden", "Show hidden objects"},
{SO_FILTER_OB_SELECTED, "SELECTED", 0, "Selected", "Show selected objects"},
{SO_FILTER_OB_ACTIVE, "ACTIVE", 0, "Active", "Show only the active object"},
{SO_FILTER_OB_SELECTABLE, "SELECTABLE", 0, "Selectable", "Show only selectable objects"},
{0, NULL, 0, NULL, NULL},
};