Blender Git Commit Log

Git Commits -> Revision 4c30dc3

Revision 4c30dc3 by Sybren A. Stüvel (master)
February 21, 2020, 15:57 (GMT)
Fix T73593: Drivers on hide_viewport and hide_render are unreliable

This fixes a threading issue (T73593) between drivers that write to the
same memory address. Driver nodes in the depsgraph now get relations to
each other in order to ensure serialisation.

These relations are only added between drivers that target the same
struct in RNA, which is determined by removing everything after the last
period. For example, a driver with data path
`pose.bones["Arm_L"].rotation_euler[2]` will be grouped with all other
drivers on that datablock with a data path that starts with
`pose.bones["Arm_L"]` to form a 'driver group'.

To find a suitable relation within such a driver group, say the relation
(from ? to), a depth-first search is performed (turned out to be
marginally faster than a breadth-first in my test case) to see whether
this will create a cycle, and to see whether there already is such a
connection (direct or transitive). This is done by recursively
inspecting the incoming connections of the 'to' node and thereby walking
from it towards the 'from' node. This is an order of magnitde faster
than inspecting the outgoing connections of the 'from' node.

This approach generalises the special case for array properties, so the
code to support that special case has been removed from
`DepsgraphRelationBuilder::build_animdata_drivers()`.

A test on the Spring rig [1] shows that this process adds approximately
8% to the build time of the dependency graph. In my test case, it takes
28 ms for this process on a total 329 ms construction time. However,
since it also made some code obsolete, it only adds 24 ms (=8%) to the
construction time. I have experimented with a simple cache to keep track
of known-connected (from, to) node pairs, but this did not significantly
improve the timing.

Note that animation data and drivers are already connected by a
relation, which means that animating a field and also changing it with a
driver will not cause conflicts.

[1] https://cloud.blender.org/p/spring/5d30a1076249366fa1939cf1

Differential Revision: https://developer.blender.org/D6905

Reviewed By: sergey, mont29

Commit Details:

Full Hash: 4c30dc343165a643e2173a055ed2aca3137991a5
Parent Commit: b8c7ff5
Lines Changed: +121, -42

3 Modified Paths:

/source/blender/depsgraph/intern/builder/deg_builder_relations.cc (+115, -42) (Diff)
/source/blender/depsgraph/intern/builder/deg_builder_relations.h (+2, -0) (Diff)
/source/blender/depsgraph/intern/depsgraph_build.cc (+4, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021