[Bf-blender-cvs] [b29ccfc] PSketch: PSketch: Fix bug where subsequent invocations would get placed wrong
Joshua Leung
noreply at git.blender.org
Sun Jan 31 14:28:35 CET 2016
Commit: b29ccfcd27014a4c71a98288404f7e79619ffedf
Author: Joshua Leung
Date: Tue Sep 1 15:13:02 2015 +1200
Branches: PSketch
https://developer.blender.org/rBb29ccfcd27014a4c71a98288404f7e79619ffedf
PSketch: Fix bug where subsequent invocations would get placed wrong
This was because the calculations for the new tail positions was wrong.
It was only doing a fixed offset, which meant that the tails were not
where the bones were shown to be.
===================================================================
M source/blender/editors/armature/pose_sketch.c
===================================================================
diff --git a/source/blender/editors/armature/pose_sketch.c b/source/blender/editors/armature/pose_sketch.c
index 1284fba..8d7289a 100644
--- a/source/blender/editors/armature/pose_sketch.c
+++ b/source/blender/editors/armature/pose_sketch.c
@@ -464,15 +464,26 @@ static int psketch_direct_exec(bContext *C, wmOperator *op)
copy_m4_m3(pchan->pose_mat, rmat);
}
- /* Apply the translation differences */
- // XXX: If scaling is disabled, this may not be correct
- {
- float delta[3];
- sub_v3_v3v3(delta, p1->co, pchan->pose_head);
-
+ /* Compute the new joints */
+ if ((pchan->parent == NULL) || (pchan->bone->flag & BONE_CONNECTED)) {
+ /* head -> start of chain */
copy_v3_v3(pchan->pose_mat[3], p1->co);
copy_v3_v3(pchan->pose_head, p1->co);
- add_v3_v3(pchan->pose_tail, delta);
+ }
+
+ if (use_stretch) {
+ /* Scaled Tail - Reapply stretched length to new-vector, and add that to the bone's current position */
+ float vec[3];
+
+ mul_v3_v3fl(vec, new_vec, new_len);
+ add_v3_v3v3(pchan->pose_tail, pchan->pose_head, vec);
+ }
+ else {
+ /* Direction-Only Tail - Use new rotation but old length */
+ float vec[3];
+
+ mul_v3_v3fl(vec, new_vec, old_len);
+ add_v3_v3v3(pchan->pose_tail, pchan->pose_head, vec);
}
}
}
More information about the Bf-blender-cvs
mailing list