Outliner: Change All Scenes to Scenes and make it focus on compositing

We have different ways of explore the scene objects, namely View Layer and
Collections. This change let us focus on compositing elements only such as:

* View Layers
** Collections
** Render Passes
* Freestyle
* Grease Pencil?

Not included in this commit is an option to handle filtering of
collections passes, ... Not sure if we would like, though.
Since they are all properly nested under a "Collections" / "Passes"
parent.
This commit is contained in:
Dalai Felinto 2018-01-18 18:30:30 -02:00
parent 37913cf532
commit db9f0527e8
8 changed files with 42 additions and 36 deletions

View File

@ -2454,14 +2454,14 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main)
SpaceOops *so = (SpaceOops *)sl;
if (!ELEM(so->outlinevis,
SO_ALL_SCENES,
SO_SCENES,
SO_GROUPS,
SO_LIBRARIES,
SO_SEQUENCE,
SO_DATABLOCKS,
SO_USERDEF))
{
so->outlinevis = SO_ALL_SCENES;
so->outlinevis = SO_SCENES;
}
}
}

View File

@ -898,7 +898,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
SpaceOops *so = (SpaceOops *)sl;
if (!ELEM(so->outlinevis,
SO_ALL_SCENES,
SO_SCENES,
SO_GROUPS,
SO_LIBRARIES,
SO_SEQUENCE,

View File

@ -2085,7 +2085,7 @@ static int outliner_parenting_poll(bContext *C)
SpaceOops *soops = CTX_wm_space_outliner(C);
if (soops) {
return ELEM(soops->outlinevis, SO_ALL_SCENES, SO_GROUPS);
return ELEM(soops->outlinevis, SO_SCENES, SO_GROUPS);
}
return false;

View File

@ -92,7 +92,11 @@
/* prototypes */
static void outliner_add_layer_collections_recursive(
SpaceOops *soops, ListBase *tree, ID *id, ListBase *layer_collections, TreeElement *parent_ten);
SpaceOops *soops, ListBase *tree, ID *id, ListBase *layer_collections, TreeElement *parent_ten,
const bool show_objects);
static void outliner_add_view_layer(
SpaceOops *soops, ListBase *tree, TreeElement *parent,
Scene *scene, ViewLayer *layer, const bool show_objects);
static void outliner_make_hierarchy(ListBase *lb);
/* ********************************************************* */
@ -382,12 +386,21 @@ static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *s
TreeElement *tenla = outliner_add_element(soops, lb, sce, te, TSE_R_LAYER_BASE, 0);
int a;
tenla->name = IFACE_("RenderLayers");
tenla->name = IFACE_("View Layers");
for (a = 0, view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next, a++) {
TreeElement *tenlay = outliner_add_element(soops, &tenla->subtree, sce, te, TSE_R_LAYER, a);
tenlay->name = view_layer->name;
tenlay->directdata = &view_layer->flag;
outliner_add_passes(soops, tenlay, &sce->id, view_layer);
TreeElement *te_view_layers;
te_view_layers = outliner_add_element(soops, &tenlay->subtree, sce, tenlay, TSE_LAYER_COLLECTION_BASE, 0);
te_view_layers->name = IFACE_("Collections");
outliner_add_view_layer(soops, &te_view_layers->subtree, te_view_layers, sce, view_layer, false);
TreeElement *te_passes;
te_passes = outliner_add_element(soops, &tenlay->subtree, sce, tenlay, TSE_LAYER_COLLECTION_BASE, 0);
te_passes->name = IFACE_("Passes");
outliner_add_passes(soops, te_passes, &sce->id, view_layer);
}
// TODO: move this to the front?
@ -396,8 +409,6 @@ static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *s
outliner_add_element(soops, lb, sce->gpd, te, 0, 0);
outliner_add_element(soops, lb, sce->world, te, 0, 0);
#ifdef WITH_FREESTYLE
if (STREQ(sce->view_render->engine_id, RE_engine_id_BLENDER_RENDER) && (sce->r.mode & R_EDGE_FRS))
outliner_add_line_styles(soops, lb, sce, te);
@ -1268,7 +1279,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
if ((type != TSE_LAYER_COLLECTION) && (te->idcode == ID_GR)) {
Group *group = (Group *)id;
outliner_add_layer_collections_recursive(soops, &te->subtree, id, &group->view_layer->layer_collections, NULL);
outliner_add_layer_collections_recursive(soops, &te->subtree, id, &group->view_layer->layer_collections, NULL, true);
}
return te;
@ -1458,7 +1469,8 @@ static bool outliner_layer_collections_reorder_poll(
}
static void outliner_add_layer_collections_recursive(
SpaceOops *soops, ListBase *tree, ID *id, ListBase *layer_collections, TreeElement *parent_ten)
SpaceOops *soops, ListBase *tree, ID *id, ListBase *layer_collections, TreeElement *parent_ten,
const bool show_objects)
{
for (LayerCollection *collection = layer_collections->first; collection; collection = collection->next) {
TreeElement *ten = outliner_add_element(soops, tree, id, parent_ten, TSE_LAYER_COLLECTION, 0);
@ -1468,18 +1480,22 @@ static void outliner_add_layer_collections_recursive(
ten->reinsert = outliner_layer_collections_reorder;
ten->reinsert_poll = outliner_layer_collections_reorder_poll;
outliner_add_layer_collections_recursive(soops, &ten->subtree, id, &collection->layer_collections, ten);
for (LinkData *link = collection->object_bases.first; link; link = link->next) {
Base *base = (Base *)link->data;
TreeElement *te_object = outliner_add_element(soops, &ten->subtree, base->object, ten, 0, 0);
te_object->directdata = base;
outliner_add_layer_collections_recursive(soops, &ten->subtree, id, &collection->layer_collections, ten, show_objects);
if (show_objects) {
for (LinkData *link = collection->object_bases.first; link; link = link->next) {
Base *base = (Base *)link->data;
TreeElement *te_object = outliner_add_element(soops, &ten->subtree, base->object, ten, 0, 0);
te_object->directdata = base;
}
}
outliner_make_hierarchy(&ten->subtree);
}
}
static void outliner_add_view_layer(SpaceOops *soops, Scene *scene, ViewLayer *layer)
static void outliner_add_view_layer(SpaceOops *soops, ListBase *tree, TreeElement *parent,
Scene *scene, ViewLayer *layer, const bool show_objects)
{
outliner_add_layer_collections_recursive(soops, &soops->tree, &scene->id, &layer->layer_collections, NULL);
outliner_add_layer_collections_recursive(soops, tree, &scene->id, &layer->layer_collections, parent, show_objects);
}
static void outliner_scene_collections_reorder(
@ -2220,28 +2236,17 @@ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, Spa
lib->id.newid = NULL;
}
else if (soops->outlinevis == SO_ALL_SCENES) {
else if (soops->outlinevis == SO_SCENES) {
Scene *sce;
for (sce = mainvar->scene.first; sce; sce = sce->id.next) {
te = outliner_add_element(soops, &soops->tree, sce, NULL, 0, 0);
tselem = TREESTORE(te);
if (sce == scene && show_opened)
tselem->flag &= ~TSE_CLOSED;
FOREACH_SCENE_OBJECT(scene, ob)
{
outliner_add_element(soops, &te->subtree, ob, te, 0, 0);
if (sce == scene && show_opened) {
tselem->flag &= ~TSE_CLOSED;
}
FOREACH_SCENE_OBJECT_END
outliner_make_hierarchy(&te->subtree);
/* clear id.newid, to prevent objects be inserted in wrong scenes (parent in other scene) */
FOREACH_SCENE_OBJECT(scene, ob)
{
ob->id.newid = NULL;
}
FOREACH_SCENE_OBJECT_END
}
}
else if (soops->outlinevis == SO_GROUPS) {
@ -2311,7 +2316,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, Spa
outliner_make_hierarchy(&soops->tree);
}
else {
outliner_add_view_layer(soops, scene, view_layer);
outliner_add_view_layer(soops, &soops->tree, NULL, scene, view_layer, true);
}
}
else if (soops->outlinevis == SO_COLLECTIONS) {

View File

@ -163,7 +163,7 @@ static int outliner_parent_clear_poll(bContext *C, wmDrag *drag, const wmEvent *
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
if (!ELEM(soops->outlinevis, SO_ALL_SCENES, SO_GROUPS, SO_VIEW_LAYER, SO_COLLECTIONS)) {
if (!ELEM(soops->outlinevis, SO_SCENES, SO_GROUPS, SO_VIEW_LAYER, SO_COLLECTIONS)) {
return false;
}

View File

@ -104,6 +104,7 @@ enum {
#define TSE_GP_LAYER 37 /* NO ID */
#define TSE_LAYER_COLLECTION 38
#define TSE_SCENE_COLLECTION 39
#define TSE_LAYER_COLLECTION_BASE 40
/* Check whether given TreeStoreElem should have a real ID in its ->id member. */

View File

@ -330,7 +330,7 @@ typedef enum eSpaceOutliner_StateFilter {
/* SpaceOops->outlinevis */
typedef enum eSpaceOutliner_Mode {
SO_ALL_SCENES = 0,
SO_SCENES = 0,
/* SO_CUR_SCENE = 1, */ /* deprecated! */
/* SO_VISIBLE = 2, */ /* deprecated! */
/* SO_SELECTED = 3, */ /* deprecated! */

View File

@ -2104,7 +2104,7 @@ static void rna_def_space_outliner(BlenderRNA *brna)
{SO_VIEW_LAYER, "VIEW_LAYER", 0, "View Layer", "Display the collections of the active view layer"},
{SO_COLLECTIONS, "COLLECTIONS", 0, "Collections", "Display all collections based on the "
"master collection hierarchy"},
{SO_ALL_SCENES, "ALL_SCENES", 0, "All Scenes", "Display composition related data in all scenes"},
{SO_SCENES, "SCENES", 0, "Scenes", "Display composition related data in all scenes"},
{SO_GROUPS, "GROUPS", 0, "Groups", "Display groups and their data-blocks"},
{SO_SEQUENCE, "SEQUENCE", 0, "Sequence", "Display sequence data-blocks"},
{SO_LIBRARIES, "LIBRARIES", 0, "Blender File", "Display data of current file and linked libraries"},