[Bf-blender-cvs] [061f974a469] PSketch-279: PSketch: Use an alternative way of converting to bone space

Joshua Leung noreply at git.blender.org
Tue May 8 18:04:08 CEST 2018


Commit: 061f974a469e87ffd683637a16a577b434e1b455
Author: Joshua Leung
Date:   Tue Jan 16 01:17:35 2018 +1300
Branches: PSketch-279
https://developer.blender.org/rB061f974a469e87ffd683637a16a577b434e1b455

PSketch: Use an alternative way of converting to bone space

Seems to work ok for the basic case (i.e. not much worse), but still
to test it in more difficult cases...

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

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 8a899c4e70c..d63151b6af1 100644
--- a/source/blender/editors/armature/pose_sketch.c
+++ b/source/blender/editors/armature/pose_sketch.c
@@ -553,11 +553,29 @@ static void psketch_pchan_apply_bbone_from_endpoints(
 	/* Compute transform needed to convert from stroke point coordinates
 	 * to bone-relative coordinates (bone local space)
 	 */
+#if 0
 	float mat[4][4], imat[4][4]; 
 	
 	mul_m4_m4m4(mat, ob->obmat, pchan->bone->arm_mat);
 	//mul_m4_m4m4(mat, ob->obmat, pchan->chan_mat);
+	
 	invert_m4_m4(imat, mat);
+#else
+	float rotscale_mat[4][4], loc_mat[4][4];
+	float mat[4][4], imat[4][4];
+	
+	/* from BKE_armature_mat_pose_to_bone() */
+	BKE_pchan_to_pose_mat(pchan, rotscale_mat, loc_mat);
+	//invert_m4(rotscale_mat);
+	//invert_m4(loc_mat);
+	
+	// XXX: should we be combining like this? BKE_armature_mat_pose_to_bone() did this separate...
+	copy_m4_m4(mat, rotscale_mat);
+	copy_v3_v3(mat[3], loc_mat[3]);
+	
+	mul_m4_m4m4(imat, ob->obmat, mat);
+	invert_m4(imat);
+#endif
 	
 	/* Convert input stroke data to a coordinates array (for fitting) */
 	int stroke_len = 0;



More information about the Bf-blender-cvs mailing list