Fix T53408: Updating Cycles Nodes via Drivers in Material View
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 5 Dec 2017 09:14:12 +0000 (10:14 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Dec 2017 09:21:33 +0000 (10:21 +0100)
This is something what should be supported by the new dependency graph.

Fixed by making it so, build_animation() adds relation between Animation
component and whatever-is-being-animated. In fact, for now, only relations to
ID properties are added. Rest of the relations are kind of hacked in all over
the code and needs to be removed and verified with specific .blend files.

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

index 58d80dc95539312fc84a952189dcc54755c8814b..083f0126caa06eff010f0c9a3606bd3bba66cf4a 100644 (file)
@@ -890,6 +890,28 @@ void DepsgraphRelationBuilder::build_animdata_curves(ID *id)
        /* Wire up dependency to time source. */
        TimeSourceKey time_src_key;
        add_relation(time_src_key, adt_key, "TimeSrc -> Animation");
+       /* Build dependencies from FCurve to a "target" which is modified by
+        * the curve.
+        */
+       if (adt->action != NULL) {
+               PointerRNA id_ptr;
+               RNA_id_pointer_create(id, &id_ptr);
+               LINKLIST_FOREACH(FCurve *, fcu, &adt->action->curves) {
+                       PointerRNA ptr;
+                       PropertyRNA *prop;
+                       int index;
+                       if (!RNA_path_resolve_full(&id_ptr, fcu->rna_path,
+                                                  &ptr, &prop, &index))
+                       {
+                               continue;
+                       }
+                       /* TODO(sergey): Avoid duplicated relations. */
+                       if (prop != NULL && RNA_property_is_idprop(prop)) {
+                               RNAPathKey prop_key(id, fcu->rna_path);
+                               add_relation(adt_key, prop_key, "Animation -> ID Prop");
+                       }
+               }
+       }
 }
 
 void DepsgraphRelationBuilder::build_animdata_drievrs(ID *id)