Depsgraph: Fix extra operations and relations created for shared armatures
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 4 May 2018 10:49:28 +0000 (12:49 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 4 May 2018 10:49:48 +0000 (12:49 +0200)
source/blender/depsgraph/intern/builder/deg_builder_map.cc
source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc

index 67cb04d1b98a62fed0394b2ba12b14fb50cf247b..218483d1dc53a50aaa726331de46f21309c343d3 100644 (file)
@@ -33,6 +33,8 @@
 #include "BLI_utildefines.h"
 #include "BLI_ghash.h"
 
+#include "DNA_ID.h"
+
 namespace DEG {
 
 BuilderMap::BuilderMap() {
index 9cfe83e008758b6c64647e68d0f1bf8672718500..5824858d7ed96fbb86e0b985e7e8b226867728d1 100644 (file)
@@ -150,7 +150,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
         *       Eventually, we need some type of proxy/isolation mechanism in-between here
         *       to ensure that we can use same rig multiple times in same scene...
         */
-       if (!built_map_.checkIsBuilt(arm)) {
+       if (!built_map_.checkIsBuiltAndTag(arm)) {
                build_animdata(&arm->id);
                /* Make sure pose is up-to-date with armature updates. */
                add_operation_node(&arm->id,
index 066c9868876afa09fe4eea44fd4cfa8c11e749a1..2d1e1f289ea9559d35e818275e51d12c1275c362 100644 (file)
@@ -509,7 +509,9 @@ void DepsgraphRelationBuilder::build_object_data(Object *object)
        }
        ID *obdata_id = (ID *)object->data;
        /* Object data animation. */
-       build_animdata(obdata_id);
+       if (!built_map_.checkIsBuilt(obdata_id)) {
+               build_animdata(obdata_id);
+       }
        /* type-specific data. */
        switch (object->type) {
                case OB_MESH:
@@ -527,7 +529,7 @@ void DepsgraphRelationBuilder::build_object_data(Object *object)
                                build_proxy_rig(object);
                        }
                        else {
-                               build_rig(object);
+                                build_rig(object);
                        }
                        break;
                case OB_LAMP:
index 2eee167179554dfa02acf521c1c53ff612c3fe05..43df6d2a94b12be0e7b20cb1f72e3579caf3e8cd 100644 (file)
@@ -316,11 +316,13 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
        add_relation(init_ik_key, flush_key, "Pose Init IK -> Pose Cleanup");
 
        /* Make sure pose is up-to-date with armature updates. */
-       OperationKey armature_key(&arm->id,
-                                 DEG_NODE_TYPE_PARAMETERS,
-                                 DEG_OPCODE_PLACEHOLDER,
-                                 "Armature Eval");
-       add_relation(armature_key, init_key, "Data dependency");
+       if (!built_map_.checkIsBuiltAndTag(arm)) {
+               OperationKey armature_key(&arm->id,
+                                         DEG_NODE_TYPE_PARAMETERS,
+                                         DEG_OPCODE_PLACEHOLDER,
+                                         "Armature Eval");
+               add_relation(armature_key, init_key, "Data dependency");
+       }
 
        /* IK Solvers...
         * - These require separate processing steps are pose-level