[Bf-blender-cvs] [94e180bd806] master: Fix: Drivers on hide_viewport and hide_render throw warnings

Sybren A. Stüvel noreply at git.blender.org
Fri Feb 21 11:20:00 CET 2020


Commit: 94e180bd806ab3b21db07afe4962de666b407217
Author: Sybren A. Stüvel
Date:   Fri Feb 21 11:16:59 2020 +0100
Branches: master
https://developer.blender.org/rB94e180bd806ab3b21db07afe4962de666b407217

Fix: Drivers on hide_viewport and hide_render throw warnings

This partially fixes T73593.

The `add_relation(driver_key, property_entry_key, ...);` call can fail
in the following situation:

- A collection is linked, and instanced into the scene by an Empty.
- The collection contains an object with a driver on its `hide_render` or
  `hide_viewport` property.

As the object doesn't exist as a real object in the scene, it's added with
`base_index=-1` to the depsgraph (see `DepsgraphNodeBuilder::build_collection()`).
As a result the node for syncing the restrictflags back to the base
isn't present in the depsgraph, and the `add_relation()` call failed.

This commit fixes the warning, simply by not attempting to add the
offending relation.

===================================================================

M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc

===================================================================

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index e45644f001f..64fb15a465b 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1488,7 +1488,11 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu)
   }
   else {
     /* If it's not a Bone, handle the generic single dependency case. */
-    add_relation(driver_key, property_entry_key, "Driver -> Driven Property");
+    Node *node_to = get_node(property_entry_key);
+    if (node_to != nullptr) {
+      add_relation(driver_key, property_entry_key, "Driver -> Driven Property");
+    }
+
     /* Similar to the case with f-curves, driver might drive a nested
      * data-block, which means driver execution should wait for that
      * data-block to be copied. */



More information about the Bf-blender-cvs mailing list