##Context
The master_collection, referenced in `scene->master_collection`,
although it works like a collection, is not an actual datablock, but a
member belonging to the scene.
Unlike other collections, it has some special features, such as:
- Cannot be deleted, renamed, moved, copied, disabled or hidden
- Cannot be referenced in another collection
- It is the first collection of all View Layers
- It is a top level and the only one of the level
It also has some common collection features, such as:
- It has a list of objects
- Has a list of other collections
As it is a member belonging to the scene and not a datablock, all the
ids it points to (objects and collections) should theoretically be
referenced in the scene (not the master_collection).
But that's not what we see in the `scene_foreach_id` code.
In that function, the master_collection is passed as an independent id
where all the other ids it references are "embedded" by the scene.
This causes the referenced objects and collections to be ignored when
the `IDWALK_IGNORE_EMBEDDED_ID` flag is set.
And so, the master_collection, even being the evaluated version, still
points to original objects and collections.
Currently this is not a problem, as any change to a collection is
updated through the RNA functions in the original collection.
But this can be problematic in patches like {D12469} where the
depsgraph is needed to update a collection.
##Solution
Traverse each "embedded" ID in master_collection in `update_id_after_copy` (which is called in only one place).
##Testing
This patch is also applied on D12469, so to test the solution just:
- apply that patch
- in blender make an animation with the visibility of any collections.
If the animation works and no assert is triggered, then the patch was successful.