[Bf-blender-cvs] [13a007f7036] PSketch-279: PSculpt Push: Use the formal approach used for PSketch here too...

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


Commit: 13a007f703619691e0a0449d572c54ddedc49842
Author: Joshua Leung
Date:   Thu Jan 18 14:57:14 2018 +1300
Branches: PSketch-279
https://developer.blender.org/rB13a007f703619691e0a0449d572c54ddedc49842

PSculpt Push: Use the formal approach used for PSketch here too...

This fixes the wrong-axis problems encountered with the "cartoon_arm.blend"
bendy bone example, where sometimes the effect was getting applied to the
wrong axis.

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

M	source/blender/editors/armature/pose_sculpt.c

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

diff --git a/source/blender/editors/armature/pose_sculpt.c b/source/blender/editors/armature/pose_sculpt.c
index 92ea3d66481..8db2b663081 100644
--- a/source/blender/editors/armature/pose_sculpt.c
+++ b/source/blender/editors/armature/pose_sculpt.c
@@ -1632,7 +1632,8 @@ static void psculpt_brush_push_apply(tPoseSculptingOp *pso, bPoseChannel *pchan,
 	PSculptBrushData *brush = pso->brush;
 	tAffectedBone *tab = NULL;
 	
-	float imat[4][4], mat[4][4];
+	float rotscale_mat[4][4], loc_mat[4][4];
+	float mat[4][4], imat[4][4];
 	float delta[3], vec[3];
 	
 	bool do_head = false, do_tail = false;
@@ -1662,8 +1663,15 @@ static void psculpt_brush_push_apply(tPoseSculptingOp *pso, bPoseChannel *pchan,
 	}
 	
 	/* compute inverse matrix to convert from screen-space to bone space */
-	mul_m4_m4m4(mat, pso->ob->obmat, pchan->bone->arm_mat);
-	invert_m4_m4(imat, mat);
+	/* from BKE_armature_mat_pose_to_bone(), with some modifications */
+	BKE_pchan_to_pose_mat(pchan, rotscale_mat, loc_mat);
+	
+	copy_m4_m4(mat, rotscale_mat);
+	copy_v3_v3(mat[3], loc_mat[3]);
+	
+	mul_m4_m4m4(imat, pso->ob->obmat, mat);
+	invert_m4(imat);
+	
 	
 	/* apply deforms to based on amount mouse moves */
 	copy_v3_v3(delta, pso->dvec);



More information about the Bf-blender-cvs mailing list