Depsgraph: Use build_animation() to build relations to animated properties
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 5 Dec 2017 11:57:01 +0000 (12:57 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Dec 2017 09:21:33 +0000 (10:21 +0100)
Before that it was up to lots of other places to keep track on whether
something is to be dependent on time or not. Was annoying, and unreliable,
and fragile.

This commit avoids hacks in object builder. Other areas will be adopted
soon.

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

index c1570f310ef2f4497215104d98dadf01c2ee5e16..54d3259bc0f91a39c9525a62dabd0e390aa981cb 100644 (file)
@@ -486,11 +486,6 @@ void DepsgraphRelationBuilder::build_object(Object *object)
        }
        /* Animation data */
        build_animdata(&object->id);
-       // XXX: This should be hooked up by the build_animdata code
-       if (needs_animdata_node(&object->id)) {
-               ComponentKey adt_key(&object->id, DEG_NODE_TYPE_ANIMATION);
-               add_relation(adt_key, local_transform_key, "Object Animation");
-       }
        /* Object data. */
        build_object_data(object);
        /* Particle systems. */
@@ -899,19 +894,12 @@ void DepsgraphRelationBuilder::build_animdata_curves(ID *id)
                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");
-                       }
+                       /* TODO(sergey): FCurve on a bone should be hooking up to pose
+                        * init rather than to bone local.
+                        */
+                       RNAPathKey prop_key(id, fcu->rna_path);
+                       add_relation(adt_key, prop_key, "Animation -> Prop", true);
                }
        }
 }