Outliner: View Layers filter for View Layer Mode
This option allow users to see the view layer in context to the others. It is particularly useful to see which view layers have which collections enabled, and their render settings (holdout, ...). This option is off by default. Differential Revision: https://developer.blender.org/D11708
This commit is contained in:
parent
2ff490f9e3
commit
bb2648ebf0
Notes:
blender-bot
2025-02-14 01:27:44 +00:00
Referenced by issue #89559, Outliner shows extra view layer column when it shouldn't
@ -369,6 +369,10 @@ class OUTLINER_PT_filter(Panel):
|
||||
|
||||
col = layout.column(align=True)
|
||||
|
||||
row = col.row()
|
||||
row.label(icon='RENDERLAYERS')
|
||||
row.prop(space, "use_filter_view_layers", text="All View Layers")
|
||||
|
||||
row = col.row()
|
||||
row.label(icon='OUTLINER_COLLECTION')
|
||||
row.prop(space, "use_filter_collection", text="Collections")
|
||||
|
@ -39,7 +39,7 @@ extern "C" {
|
||||
|
||||
/* Blender file format version. */
|
||||
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
||||
#define BLENDER_FILE_SUBVERSION 5
|
||||
#define BLENDER_FILE_SUBVERSION 6
|
||||
|
||||
/* Minimum Blender version that supports reading file written with the current
|
||||
* version. Older Blender versions will test this and show a warning if the file
|
||||
|
@ -415,6 +415,21 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_ATLEAST(bmain, 300, 6)) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
|
||||
/* Disable View Layers filter. */
|
||||
if (space->spacetype == SPACE_OUTLINER) {
|
||||
SpaceOutliner *space_outliner = (SpaceOutliner *)space;
|
||||
space_outliner->filter |= SO_FILTER_NO_VIEW_LAYERS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Versioning code until next subversion bump goes here.
|
||||
*
|
||||
|
@ -1090,7 +1090,8 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
RestrictPropertiesActive props_active = props_active_parent;
|
||||
|
||||
if (te->ys + 2 * UI_UNIT_Y >= region->v2d.cur.ymin && te->ys <= region->v2d.cur.ymax) {
|
||||
if (tselem->type == TSE_R_LAYER && (space_outliner->outlinevis == SO_SCENES)) {
|
||||
if (tselem->type == TSE_R_LAYER &&
|
||||
ELEM(space_outliner->outlinevis, SO_SCENES, SO_VIEW_LAYER)) {
|
||||
if (space_outliner->show_restrict_flags & SO_RESTRICT_RENDER) {
|
||||
/* View layer render toggle. */
|
||||
ViewLayer *layer = te->directdata;
|
||||
|
@ -331,6 +331,7 @@ static SpaceLink *outliner_create(const ScrArea *UNUSED(area), const Scene *UNUS
|
||||
space_outliner->outlinevis = SO_VIEW_LAYER;
|
||||
space_outliner->sync_select_dirty |= WM_OUTLINER_SYNC_SELECT_FROM_ALL;
|
||||
space_outliner->flag = SO_SYNC_SELECT | SO_MODE_COLUMN;
|
||||
space_outliner->filter = SO_FILTER_NO_VIEW_LAYERS;
|
||||
|
||||
/* header */
|
||||
region = MEM_callocN(sizeof(ARegion), "header for outliner");
|
||||
|
@ -71,33 +71,56 @@ ListBase TreeDisplayViewLayer::buildTree(const TreeSourceData &source_data)
|
||||
{
|
||||
ListBase tree = {nullptr};
|
||||
|
||||
view_layer_ = source_data.view_layer;
|
||||
Scene *scene = source_data.scene;
|
||||
show_objects_ = !(space_outliner_.filter & SO_FILTER_NO_OBJECT);
|
||||
|
||||
const bool show_children = (space_outliner_.filter & SO_FILTER_NO_CHILDREN) == 0;
|
||||
|
||||
if (space_outliner_.filter & SO_FILTER_NO_COLLECTION) {
|
||||
/* Show objects in the view layer. */
|
||||
for (Base *base : List<Base>(view_layer_->object_bases)) {
|
||||
TreeElement *te_object = outliner_add_element(
|
||||
&space_outliner_, &tree, base->object, nullptr, TSE_SOME_ID, 0);
|
||||
te_object->directdata = base;
|
||||
for (auto *view_layer : ListBaseWrapper<ViewLayer>(scene->view_layers)) {
|
||||
if (space_outliner_.filter & SO_FILTER_NO_VIEW_LAYERS) {
|
||||
if (view_layer != source_data.view_layer) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (show_children) {
|
||||
outliner_make_object_parent_hierarchy(&tree);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Show collections in the view layer. */
|
||||
TreeElement &ten = *outliner_add_element(
|
||||
&space_outliner_, &tree, source_data.scene, nullptr, TSE_VIEW_COLLECTION_BASE, 0);
|
||||
ten.name = IFACE_("Scene Collection");
|
||||
TREESTORE(&ten)->flag &= ~TSE_CLOSED;
|
||||
TreeElement &te_view_layer = *outliner_add_element(
|
||||
&space_outliner_, &tree, scene, nullptr, TSE_R_LAYER, 0);
|
||||
TREESTORE(&te_view_layer)->flag &= ~TSE_CLOSED;
|
||||
te_view_layer.name = view_layer->name;
|
||||
te_view_layer.directdata = view_layer;
|
||||
view_layer_ = view_layer;
|
||||
|
||||
add_view_layer(ten.subtree, ten);
|
||||
if (show_children) {
|
||||
add_layer_collection_objects_children(ten);
|
||||
if (space_outliner_.filter & SO_FILTER_NO_COLLECTION) {
|
||||
/* Show objects in the view layer. */
|
||||
for (Base *base : List<Base>(view_layer_->object_bases)) {
|
||||
TreeElement *te_object = outliner_add_element(&space_outliner_,
|
||||
&te_view_layer.subtree,
|
||||
base->object,
|
||||
&te_view_layer,
|
||||
TSE_SOME_ID,
|
||||
0);
|
||||
te_object->directdata = base;
|
||||
}
|
||||
|
||||
if (show_children) {
|
||||
outliner_make_object_parent_hierarchy(&tree);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Show collections in the view layer. */
|
||||
TreeElement &ten = *outliner_add_element(&space_outliner_,
|
||||
&te_view_layer.subtree,
|
||||
source_data.scene,
|
||||
&te_view_layer,
|
||||
TSE_VIEW_COLLECTION_BASE,
|
||||
0);
|
||||
ten.name = IFACE_("Scene Collection");
|
||||
TREESTORE(&ten)->flag &= ~TSE_CLOSED;
|
||||
|
||||
add_view_layer(ten.subtree, ten);
|
||||
if (show_children) {
|
||||
add_layer_collection_objects_children(ten);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -338,8 +338,9 @@ typedef enum eSpaceOutliner_Filter {
|
||||
SO_FILTER_OB_STATE_SELECTED = (1 << 15), /* Not set via DNA. */
|
||||
SO_FILTER_OB_STATE_ACTIVE = (1 << 16), /* Not set via DNA. */
|
||||
SO_FILTER_NO_COLLECTION = (1 << 17),
|
||||
SO_FILTER_NO_VIEW_LAYERS = (1 << 18),
|
||||
|
||||
SO_FILTER_ID_TYPE = (1 << 18),
|
||||
SO_FILTER_ID_TYPE = (1 << 19),
|
||||
} eSpaceOutliner_Filter;
|
||||
|
||||
#define SO_FILTER_OB_TYPE \
|
||||
@ -352,7 +353,7 @@ typedef enum eSpaceOutliner_Filter {
|
||||
|
||||
#define SO_FILTER_ANY \
|
||||
(SO_FILTER_NO_OB_CONTENT | SO_FILTER_NO_CHILDREN | SO_FILTER_OB_TYPE | SO_FILTER_OB_STATE | \
|
||||
SO_FILTER_NO_COLLECTION | SO_FILTER_NO_LIB_OVERRIDE)
|
||||
SO_FILTER_NO_COLLECTION | SO_FILTER_NO_VIEW_LAYERS | SO_FILTER_NO_LIB_OVERRIDE)
|
||||
|
||||
/* SpaceOutliner.filter_state */
|
||||
typedef enum eSpaceOutliner_StateFilter {
|
||||
|
@ -3624,6 +3624,11 @@ static void rna_def_space_outliner(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Show Collections", "Show collections");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "use_filter_view_layers", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_VIEW_LAYERS);
|
||||
RNA_def_property_ui_text(prop, "Show All View Layers", "Show all the view layers");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
|
||||
|
||||
/* Filters object state. */
|
||||
prop = RNA_def_property(srna, "filter_state", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "filter_state");
|
||||
|
Loading…
x
Reference in New Issue
Block a user