diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-09-25 16:48:38 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-09-25 16:48:55 +0300 |
commit | 675cef0a165ad535546f24faf9d0ac474f704e64 (patch) | |
tree | 55894e14870b9e6ed0bdc3fdd94ed185480ea710 /source/blender/depsgraph/intern | |
parent | ce54d25fa961d3021986f6b741c65f99db7bfd41 (diff) |
Fix T52835: When driven IK influence change, ik animation have 1 frame delay
Diffstat (limited to 'source/blender/depsgraph/intern')
4 files changed, 22 insertions, 3 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc index fe7ccaa7fc0..ceb2fd25f94 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -182,6 +182,11 @@ void DepsgraphNodeBuilder::build_rig(Scene *scene, Object *ob) op_node = add_operation_node(&ob->id, DEG_NODE_TYPE_EVAL_POSE, + function_bind(BKE_pose_eval_init_ik, _1, scene, ob, ob->pose), + DEG_OPCODE_POSE_INIT_IK); + + op_node = add_operation_node(&ob->id, + DEG_NODE_TYPE_EVAL_POSE, function_bind(BKE_pose_eval_flush, _1, scene, ob, ob->pose), DEG_OPCODE_POSE_DONE); op_node->set_as_exit(); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc index be666165a0b..ca548ed33d0 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -83,7 +83,15 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *ob, * - see notes on direction of rel below... */ bPoseChannel *rootchan = BKE_armature_ik_solver_find_root(pchan, data); - OperationKey solver_key(&ob->id, DEG_NODE_TYPE_EVAL_POSE, rootchan->name, DEG_OPCODE_POSE_IK_SOLVER); + OperationKey pchan_local_key(&ob->id, DEG_NODE_TYPE_BONE, + pchan->name, DEG_OPCODE_BONE_LOCAL); + OperationKey init_ik_key(&ob->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT_IK); + OperationKey solver_key(&ob->id, DEG_NODE_TYPE_EVAL_POSE, + rootchan->name, + DEG_OPCODE_POSE_IK_SOLVER); + + add_relation(pchan_local_key, init_ik_key, "IK Constraint -> Init IK Tree"); + add_relation(init_ik_key, solver_key, "Init IK -> IK Solver"); /* IK target */ // XXX: this should get handled as part of the constraint code @@ -300,9 +308,11 @@ void DepsgraphRelationBuilder::build_rig(Scene *scene, Object *ob) /* attach links between pose operations */ OperationKey init_key(&ob->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT); + OperationKey init_ik_key(&ob->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT_IK); OperationKey flush_key(&ob->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_DONE); - add_relation(init_key, flush_key, "[Pose Init -> Pose Cleanup]"); + add_relation(init_key, init_ik_key, "Pose Init -> Pose Init IK"); + 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, diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cc b/source/blender/depsgraph/intern/depsgraph_type_defines.cc index f4f071cd611..e177c8c8ec0 100644 --- a/source/blender/depsgraph/intern/depsgraph_type_defines.cc +++ b/source/blender/depsgraph/intern/depsgraph_type_defines.cc @@ -109,6 +109,7 @@ static const char *stringify_opcode(eDepsOperation_Code opcode) STRINGIFY_OPCODE(OBJECT_UBEREVAL); STRINGIFY_OPCODE(GEOMETRY_UBEREVAL); STRINGIFY_OPCODE(POSE_INIT); + STRINGIFY_OPCODE(POSE_INIT_IK); STRINGIFY_OPCODE(POSE_DONE); STRINGIFY_OPCODE(POSE_IK_SOLVER); STRINGIFY_OPCODE(POSE_SPLINE_IK_SOLVER); diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h index 1c461423e03..ef7b32a8d83 100644 --- a/source/blender/depsgraph/intern/depsgraph_types.h +++ b/source/blender/depsgraph/intern/depsgraph_types.h @@ -178,9 +178,12 @@ typedef enum eDepsOperation_Code { /* Pose -------------------------------------------- */ - /* Init IK Trees, etc. */ + /* Init pose, clear flags, etc. */ DEG_OPCODE_POSE_INIT, + /* Initialize IK solver related pose stuff. */ + DEG_OPCODE_POSE_INIT_IK, + /* Free IK Trees + Compute Deform Matrices */ DEG_OPCODE_POSE_DONE, |