Page MenuHome

Fix viewlayer hide/exclude settings getting lost for linked collections.

Authored by Brecht Van Lommel (brecht) on Feb 26 2019, 8:41 PM.



The problem was that the object and collection pointers in Base and
LayerCollection would get lost of file read. Normally such ID pointers would
be resolved by pointing to an ID_ID placeholder which has the datablock name,
and then replacing it will the real datablock. However ID_ID is only written
for directly linked datablocks.

This adds the concept of an indirectly linked datablock with a weak reference
to it. For this we write an ID_ID_WEAK_REF code, which is a reference that
will only be resolved if the datablock was read for another reason.

I'm not really happy with this, but I couldn't find a better solution. For
the studio this is an important feature, as it allows them to link in
collections to shots and then change their view layer visibility as if it
was local data. Except that without this fix it would not be saved.

Depends on D4415.

Diff Detail

rB Blender
arcpatch-D4416 (branched from master)
Build Status
Buildable 4979
Build 4979: arc lint + arc unit

Event Timeline

Harbormaster completed remote builds in B3012: Diff 13879.

Hmmpff… Took me some time to wrap my head around both the issue and the solution here… :/

Am not really happy with this either (it's adding even more complexity to something that is already rather confusing), but cannot think of any better solution. Aside from making all those linked objects and collections directly linked, which is obviously not acceptable.

So unless other devs have a brilliant idea, this is OK for me.

Did you check that this is also working fine in recursive linking (i.e. linking a scene which is linking some collections, are the view settings of linked scene's viewlayer preserved)?

94 ↗(On Diff #13879)


This revision is now accepted and ready to land.Mar 6 2019, 9:05 AM

Rebase to latest master.

Fix crash loading .blend files in older Blender versions.

Don't use a separate ID code anymore, since this causes loading in older versions
to try to load it as a regular ID which crashes.