Controlling collections on multiple layers and scenes

Hello! I have this blend file with a lot of linked scenes, and a few layers inside each scene.

My problem is that when I create a new collection, this collection is automatically active in every scene and layer already present in the file and I have to go inside each scene and layer and manually deactivate the collection, which is really time consuming.

Is there a way to create a new collection as inactive upon creation, or even better to deactivate visibility for a specific collection for each render scene and layer at once?

Thank you!

I too have faced this dilema and I also haven’t find other solution than manually hide them, so I too am interested in a solution :slight_smile:

1 Like

Something like syncing rendersetting between scenes ??:

1 Like

this is a really interesting addon, however I don’t see anything connected with collection in the description, so I am not sure it can do what I am asking for

Collections are data of scene.
All collections linked to scene will be present in all View Layers of the scene.
A View Layer is just a set-up of activation/deactivation, visibility, renderability of collections.
So, that is not possible to have a view layer of a scene, ignoring collections linked to scene.
In Filters of Outliner, it is possible to enable a restriction toggle (Screen) that may disable collection in all viewports for all View Layers.
https://docs.blender.org/manual/en/latest/scene_layout/view_layers/introduction.html#outliner

But a ccene may have a totally different set of active collections than another one.
You may link same collections in different scenes or use different ones for same objects or other objects.

1 Like

Hey, thanks for the explanation.

I think I might have not explained what I meant correctly.

When you create a new collection, this collection is active in every linked scene and render layers contained in all of those linked scenes.

By active, I mean that the little tick below the cursor in the image is active, like this:
image

This tick is something that can be controlled in each render scene and layer individually, so that a certain collection is active in certain scenes/layers but not in others.

My problem is that if I have 20 render scenes and I create a new collection that I want to be active only in one of those 20 scenes, I need to go inside each of the other 19 scenes and deactivate the collection.
I think it would be cool to have a way to deactivate or activate collections in every render scene and layer, so that situations like this would be much easier to manage.

Hmm yes just remembered about “some addon” which does soem syncing
 don’t even kno if this is it


Anyway: i made a litle brain storming
 micro re-search and of course came to stop
 ( :stuck_out_tongue_winking_eye: )

I thought for a script / addon mostly something like this is needed:

  • detecting of the actual collection selected in the outliner
 actualColection and then
  • iterating on the scenes and the collection checking equal name to actualColection
and
  • set them all to exclude from viewlayer ( or include)
  • (add this feature to the outliner context menue to make a full addon?)

So the detection is a bit weird because someone has to iterate over all areas to “find” any outliner:


some very non finished code snippets


for win in bpy.context.window_manager.windows:
    scr = win.screen
    for ara in scr.areas:
        if ara.type == "OUTLINER": # okay got an outliner
            with bpy.context.temp_override(window=win, area=ara): # now collect all selected collections
                cols = [scr for scr in bpy.context.selected_ids if scr.rna_type.name == "Collection"]
                for c in cols:
                    print( c )
                    name = c.name
            break  #  got one..stop searching


and then iterate over the scenes


for s in bpy.data.scenes.items():
    print(s[0])
    for vlay in bpy.data.scenes[s[0]].view_layers:
        print( vlay.name )
        for item in vlay.layer_collection.children:
            print(item.name)
            # check if this is in the collected `cols`
            # and if.. then set the `collection.exclude` flag to True


but just “using” any collection and trying to set colection.exclude ( i don’t know where i found this )


just doesn seem to work
 complaining about


featurAttributeError: ‘Collection’ object has no attribute ‘exclude’


should have noted my findings better :sweat_smile: 
have to re-search this again later


( even wanted not to post this
 but then maybe someone else can add someting
)

1 Like

I hope that you mean 20 View Layers ; because a scene can only be linked once, in final blend file.
And solution is a lot simpler than duplicated copies of scenes or scene linked in multiple files.

In Filter of Outliner, for View Layer View, there is an All View Layers filter to enable.
That way all view layers of scene are visible at same time, in Outliner.
Then, you can restrict view to new collection in filter.
That way, you can deactivate collection in all layers, except one, in few click and drag.

AVL_filterjpg

2 Likes

thanks I’ll check this out tomorrow!

no I mean render scenes. You can create as many linked scenes as you want.

I am not linking a scene in the scene settings, I am just creating a linked scene
image

Basically you have linked collections between the scenes, but independent render settings, cameras, frame range, compositing and so on.

Cool trick about the view layers tick in the outliner filter settings, I didn’t know about that!

In this case, that is content of scene (collections and objects) that are linked.
That is different that when scene is linked from one file to another.

Those linked copies can handled different collection sets.
They are copies that can be modified independently.
In that case, you can create collections that are proper to scene, and are different from linked collections.

Normally, if you create a new collection in such scene, it is not linked to copies by default.
You have to relink new collections in other scenes, if you moved an object to a new collection by using M shortcut.
But if you link an object (by pressing Ctrl while dragging its item in outliner) present in a collection to a new empty collection, created by using C in Outliner ; the new collection can be linked to one scene only, without messing up other scenes.

In that case, the object is present in two collections of same view layer.
As long as object is present in an activated collection, it is rendered.
You can unlink original collection, in scene copy, if it confusing.
It will not unlink collection in other scenes.

For instance, here, a linked copy scene is created.
Collection 3 and Collection 4 are created in new scene.
Each object of Collection 2 is linked to one of these new collections.
Then, Collection 2 is unlinked from linked copy scene.
Original scene stays unchanged.
LCS_ new collections

1 Like

thanks for the explanation.

My workflow include working always inside a “mother” collection, so that all the collection are automatically linked among all my linked scenes.

Now this is the scenario: I create a new linked copy scene, and then I create a new collection (inside of the mother collection, so it will be shared among the other scenes as well). I want this new collection to be active (ticked on) only in the new scene, not in all the previous scenes. However blender makes new collection active by default everywhere. Is there a way to automatically deactivate this newly created collection in all the scenes? Because at the moment I have to go manually inside every scene and every layer and deactivate that collection manually. You can imagine that when you have 6 scenes x 4 view layers, it becomes quite time consuming

The operator to create new collection has no option to create it deactivated.
The default workflow was thought linear. User creates collections. Then, he can create Blank View Layers, having all collections deactivated.

I am not a python expert, at all. But in theory, that should be possible to create a macro that creates collection and then deactivate it in other scenes, like @Okidoki tried.

But my demonstration shows, that if you renounce to put new collection in “mother” collection, you don’t have to browse other scenes to modify them.
You can simply link it in scenes that need it.

1 Like

I’m not sure about this
 because the “exclude from view layer” option seems to be not an attribute of the collection itself
 but of the viewlayer 
?? So you can en/disable it on every viewlayer
 but then also on every different scene


I still do not understand the full structure of this



also because i didn’t used them at all yet :sweat_smile:

( I also have to investigate more the difference between viewlayer and scene
so
it’s very interesting
 )

So far:

  • Scene: “main” structure; can have for example different units (for example rendersize
 or gravity)
  • View Layer: almost a sub-scene; individually renderable but same units
 almost a “meta-collection”
  • Collection: structure to make even overlapping groups; but in contrast to “classic groups” can for example not be “positioned”
 (this has to be done by parenting to a “parent object”, e.g. an empty; maybe named the same as the collection
)


so i think i understand the wish for an “exclude from every other view layer” or even some more sophisticated viewlayer management


( 
just thinking
 the Collection Manager addon offers something to enable the rendering of a collection on the viewlayer
 this maybe would be nice to be “expanded” to viewlayers itslef and so the general exclusion
 but this might be just wishfull thinking
)

The way I understand things is this.

View layer

  • always share all the collections of the scene it exists in
  • you can decide which collections to render and to use options such as indirect only or holdout for the collections on a layer basis
  • you have limited editing capabilities, with render passes, AOVs, overwriting samples or material (for every object visible)

Scene

  • it can be completely independent, as if it was another blend file
  • it can keep all the collection “in sync” among scenes with the copy linked option
  • in the above mentioned case it works similar to a view layer, but on top of the editing capabilities of the layer, you get full control on anything: render engine, render settings, world, camera, output, compositing

Collections are just groups you can use for objects that allows you to leverage the above mentioned capabilities plus other stuff such as geo nodes, simulations and rigs

What I simply meant is, if the collection is not linked to the scene, you don’t have to deactivate it.
So, If you create a not nested collection in a scene, it will not be linked to the others : you don’t have to tweak the others.

No. View Layer is a representation of scene. It can show totality or a portion of scene.
But each property of scene modified is still relative to scene, not to view layer.
So, if you modify collection or object, it is modified for scene, not just inside active View Layer.
That would not be the case if View Layer was a sub-scene. Everything in it, would relative to it.

No. That is not the copy linked option that does that.
That is the fact that copied scene contains same collections linked than in original scene.

The Full Copy option creates a duplicate of scene, containing copies of collections and objects.

But, whatever is the option used to create the scene, you can still unlink or link collections or objects in any type of scene.
That is the link that determines the syncing. And nesting objects in collections or collections in collections is propagating the initial link to scene to what is nested.

But I agree.
That could make sense to have an option for collection creation, to create it deactivated, or an operator to deactivate same collections in all view layers of scene or all view layers of scenes, it is linked to.

yes you are correct, the linking happens only with the collections already present at the moment you copy linked the scene and all the collections contained within those already present collections.

If I create a new collection in the root of the scene I can still “link” it to the old scene by instancing it from the outliner

It’s a bit of a complex system
 either way I think we’re missing some quality of life features

Hi!
I have exactly the same issue. I’m working on an interior design project, with 5 different versions of a hotel room, sharing the same collections with linked scenes.

For example : I have a main collection called WALLS. In that collection, I have other collections called Wall V1, Wall V2, Wall V3, etc. The object data for the wall in each collection is the same, I just change the material at the object level instead of data level.

That way, I can see all my different versions of the wall in the main collection and simply disable the version I don’t want to see in a particular scene.

Same issue, if I create a new version of the wall, by linked duplicating the sub-collection Wall V5, to create Wall V6, I need to go back to every other scene and viewlayers, to disable it.

Have you found a workaround?