[Bf-blender-cvs] [70d0605] depsgraph_refactor: Depsgraph: Fix uninitialized bone matrix used for parents
Sergey Sharybin
noreply at git.blender.org
Thu Jan 22 14:20:07 CET 2015
Commit: 70d0605dc01d2da86fc89ca4dc97e31a6e0687bc
Author: Sergey Sharybin
Date: Thu Jan 22 18:18:36 2015 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rB70d0605dc01d2da86fc89ca4dc97e31a6e0687bc
Depsgraph: Fix uninitialized bone matrix used for parents
Issue was caused by bone matrix calculated in pose flush, which made
it so BONE_DONE does not guaranteed matricies to be correct.
===================================================================
M source/blender/blenkernel/BKE_armature.h
M source/blender/blenkernel/intern/armature_update.c
M source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
===================================================================
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index ce7b95e..ac409ae 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -170,6 +170,9 @@ void BKE_pose_constraints_evaluate(struct EvaluationContext *eval_ctx,
struct Object *ob,
struct bPoseChannel *pchan);
+void BKE_pose_bone_done(struct EvaluationContext *eval_ctx,
+ struct bPoseChannel *pchan);
+
void BKE_pose_iktree_evaluate(struct EvaluationContext *eval_ctx,
struct Scene *scene,
struct Object *ob,
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c
index fb6e9b7..44c6871 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -636,6 +636,16 @@ void BKE_pose_constraints_evaluate(EvaluationContext *UNUSED(eval_ctx),
}
}
+void BKE_pose_bone_done(EvaluationContext *UNUSED(eval_ctx),
+ bPoseChannel *pchan)
+{
+ float imat[4][4];
+ if (pchan->bone) {
+ invert_m4_m4(imat, pchan->bone->arm_mat);
+ mul_m4_m4m4(pchan->chan_mat, pchan->pose_mat, imat);
+ }
+}
+
void BKE_pose_iktree_evaluate(EvaluationContext *UNUSED(eval_ctx),
Scene *scene,
Object *ob,
@@ -661,21 +671,10 @@ void BKE_pose_eval_flush(EvaluationContext *UNUSED(eval_ctx),
Object *ob,
bPose *UNUSED(pose))
{
- bPoseChannel *pchan;
- float imat[4][4];
float ctime = BKE_scene_frame_get(scene); /* not accurate... */
DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
BLI_assert(ob->type == OB_ARMATURE);
/* 6. release the IK tree */
BIK_release_tree(scene, ob, ctime);
-
- /* calculating deform matrices */
- for (pchan = ob->pose->chanbase.first; pchan != NULL; pchan = pchan->next)
- {
- if (pchan->bone) {
- invert_m4_m4(imat, pchan->bone->arm_mat);
- mul_m4_m4m4(pchan->chan_mat, pchan->pose_mat, imat);
- }
- }
}
diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
index e0eeeba..b1f3a72 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
@@ -615,7 +615,7 @@ void DepsgraphNodeBuilder::build_rig(Scene *scene, Object *ob)
DEG_OPCODE_BONE_READY);
add_operation_node(&ob->id, DEPSNODE_TYPE_BONE, pchan->name,
- DEPSOP_TYPE_POST, NULL, // XXX: BKE_eval_bone_done ?
+ DEPSOP_TYPE_POST, function_bind(BKE_pose_bone_done, _1, pchan),
DEG_OPCODE_BONE_DONE);
/* constraints */
More information about the Bf-blender-cvs
mailing list