Depsgraph: Ensure solver cleanup order
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 22 Nov 2018 14:52:17 +0000 (15:52 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 22 Nov 2018 15:17:18 +0000 (16:17 +0100)
Ensure that pose cleanup is never run before all IK solvers are finished.

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

index 2b4d8d394ab47d62a76265cb50be9768bc284da7..1abed8bb6a26293ace896208f7ec44cf6dbcbc4e 100644 (file)
@@ -93,8 +93,15 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object,
                                DEG_NODE_TYPE_EVAL_POSE,
                                rootchan->name,
                                DEG_OPCODE_POSE_IK_SOLVER);
+       OperationKey pose_cleanup_key(
+               &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_CLEANUP);
        add_relation(pchan_local_key, init_ik_key, "IK Constraint -> Init IK Tree");
        add_relation(init_ik_key, solver_key, "Init IK -> IK Solver");
+       /* Never cleanup before solver is run. */
+       add_relation(solver_key,
+                    pose_cleanup_key,
+                    "IK Solver -> Cleanup",
+                    DEPSREL_FLAG_GODMODE);
        /* IK target */
        /* TODO(sergey): This should get handled as part of the constraint code. */
        if (data->tar != NULL) {
@@ -254,10 +261,17 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object,
                                DEG_NODE_TYPE_EVAL_POSE,
                                rootchan->name,
                                DEG_OPCODE_POSE_SPLINE_IK_SOLVER);
+       OperationKey pose_cleanup_key(
+               &object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_CLEANUP);
        /* Solver depends on initialization. */
        add_relation(init_ik_key, solver_key, "Init IK -> IK Solver");
+       /* Never cleanup before solver is run. */
+       add_relation(solver_key, pose_cleanup_key, "IK Solver -> Cleanup");
        /* Attach owner to IK Solver. */
-       add_relation(transforms_key, solver_key, "Spline IK Solver Owner");
+       add_relation(transforms_key,
+                    solver_key,
+                    "Spline IK Solver Owner",
+                    DEPSREL_FLAG_GODMODE);
        /* Attach path dependency to solver. */
        if (data->tar != NULL) {
                /* TODO(sergey): For until we'll store partial matricies in the