This patch allows animation of the collection visibility buttons
(those eyes in the outliner).
Basically concludes the work initiated by @aligorith on
{rBd1e3ba22a03c}.
In that commit (rBd1e3ba22a03c) all necessary data for support to
animation of the ID were implemented. But the depsgraph support was
incomplete.
So this patch only focused on the depsgraph changes (and trusted the
original work).
##Problematic (what hinders the implementation in the depsgraph area):
**1. Deg nodes and relations are not created for invisible collections.**
Every time a collection flag is changed in rna, depsgraph relations are
recreated which "remove" nodes from hidden collections. This means that
if animation tries to unhide a collection, there are no nodes to update
the scene.
**2. The function that updates a Collection is not thread-safe and adds a lot of overhead.**
As it is not thread-safe, the function is unsuitable as an operand for
the depsgraph node.
Also it adds a lot of overhead. When a collection flag is changed in rna,
the `BKE_main_collection_sync(bmain)` function is called. This function
deletes lists, Ghash, arrays from all Blender ViewLayers and Collections
and recreates them no matter if an object was deleted or if a Base flag
was just changed.
##Proposed Solution:
The solution is similar to what is seen for object visibility animation
(with some changes).
**1. Deg nodes and relations to Collections are always created if the collection is animated.**
Like Objects, relations of hidden IDs are only created if the datablock
is animated. This solves the issue of operands not being called if the
collection is hidden.
**2. Implement an update function that updates only the Base flags of a ViewLayer.**
The lightweight `BKE_layer_collection_sync_base_flags` function was implemented
to be called in the operand. This avoids having to call `BKE_main_collection_sync`.
##To Do
The `BKE_layer_collection_sync_base_flags` function, while working fine
in its current state, does not follow the depsgraph convention as it
directly reads bmain which may not be thread-safe