[Bf-blender-cvs] [d924ac9] PSketch: PSketch: Tweaks so that it doesn't immediately wreck non-connected chains

Joshua Leung noreply at git.blender.org
Sun Jan 31 14:28:36 CET 2016


Commit: d924ac91ca839a4bd035514e020cc9cb4655327b
Author: Joshua Leung
Date:   Tue Sep 1 23:32:37 2015 +1200
Branches: PSketch
https://developer.blender.org/rBd924ac91ca839a4bd035514e020cc9cb4655327b

PSketch: Tweaks so that it doesn't immediately wreck non-connected chains

===================================================================

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 8d7289a..2a92cfd 100644
--- a/source/blender/editors/armature/pose_sketch.c
+++ b/source/blender/editors/armature/pose_sketch.c
@@ -451,7 +451,7 @@ static int psketch_direct_exec(bContext *C, wmOperator *op)
 					mul_v3_fl(rmat[0], scale[0] * sfac);
 					mul_v3_fl(rmat[1], scale[1] * sfac);
 					mul_v3_fl(rmat[2], scale[2] * sfac);
-
+					
 				}
 				else {
 					/* Just reapply scaling normally */
@@ -465,11 +465,17 @@ static int psketch_direct_exec(bContext *C, wmOperator *op)
 			}
 			
 			/* Compute the new joints */
-			if ((pchan->parent == NULL) || (pchan->bone->flag & BONE_CONNECTED)) {
+			// XXX: unconnected bones should be able to be freely positioned!
+			if ((pchan->parent == NULL) || (pchan->bone->flag & BONE_CONNECTED) == 0) {
 				/* head -> start of chain */
 				copy_v3_v3(pchan->pose_mat[3], p1->co);
 				copy_v3_v3(pchan->pose_head, p1->co);
 			}
+			else if (pchan->parent) {
+				/* head -> parent's tip (as it would have been modified by previous) */
+				copy_v3_v3(pchan->pose_mat[3], pchan->parent->pose_tail);
+				copy_v3_v3(pchan->pose_head, pchan->parent->pose_tail);
+			}
 			
 			if (use_stretch) {
 				/* Scaled Tail - Reapply stretched length to new-vector, and add that to the bone's current position */




More information about the Bf-blender-cvs mailing list