[Bf-blender-cvs] [a819ef65c07] master: Fix for T48988 - Enabling bbone easing for posemode

Joshua Leung noreply at git.blender.org
Wed Nov 1 02:42:32 CET 2017


Commit: a819ef65c07131ddb203a55bd8dc4e3207130b64
Author: Joshua Leung
Date:   Wed Nov 1 13:38:51 2017 +1300
Branches: master
https://developer.blender.org/rBa819ef65c07131ddb203a55bd8dc4e3207130b64

Fix for T48988 - Enabling bbone easing for posemode

This fix enables the usage of bbones easing parameters for edit and pose mode seperately. This allows animators to take advantage of the functionality and may eliminate confusion as the parameters now behave similar to other bbone parameters.

Note that splitting the parameters between the modes effectively creates a new parameter set. Blend files of previous versions do not contain this information and will have the values set to 0 on load. As it broke backwards compatibility for pose mode values anyway, I also took the liberty to rename the easing parameters in some places for consistency (which breaks edit mode values).

Reviewers: aligorith

Subscribers: aligorith

Tags: #animation

Differential Revision: https://developer.blender.org/D2796

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

M	release/scripts/startup/bl_ui/properties_data_bone.py
M	source/blender/blenkernel/intern/action.c
M	source/blender/blenkernel/intern/armature.c
M	source/blender/editors/armature/armature_add.c
M	source/blender/editors/armature/armature_intern.h
M	source/blender/editors/armature/armature_utils.c
M	source/blender/editors/armature/editarmature_retarget.c
M	source/blender/editors/armature/pose_transform.c
M	source/blender/editors/armature/pose_utils.c
M	source/blender/editors/include/ED_armature.h
M	source/blender/makesdna/DNA_action_types.h
M	source/blender/makesdna/DNA_armature_types.h
M	source/blender/makesrna/intern/rna_armature.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py
index 132c355ed99..5e0ef5058dd 100644
--- a/release/scripts/startup/bl_ui/properties_data_bone.py
+++ b/release/scripts/startup/bl_ui/properties_data_bone.py
@@ -193,13 +193,8 @@ class BONE_PT_curved(BoneButtonsPanel, Panel):
 
         sub = row.column(align=True)
         sub.label("Easing:")
-        if pchan:
-            # XXX: have these also be an overlay?
-            sub.prop(bbone.bone, "bbone_in", text="Ease In")
-            sub.prop(bbone.bone, "bbone_out", text="Ease Out")
-        else:
-            sub.prop(bone, "bbone_in", text="Ease In")
-            sub.prop(bone, "bbone_out", text="Ease Out")
+        sub.prop(bbone, "bbone_easein", text="Ease In")
+        sub.prop(bbone, "bbone_easeout", text="Ease Out")
 
         if pchan:
             layout.separator()
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 5bd6085c8f5..5c2fe0bb040 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -870,6 +870,8 @@ static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan
 	pchan->curveInY = chan->curveInY;
 	pchan->curveOutX = chan->curveOutX;
 	pchan->curveOutY = chan->curveOutY;
+	pchan->ease1 = chan->ease1;
+	pchan->ease2 = chan->ease2;
 	pchan->scaleIn = chan->scaleIn;
 	pchan->scaleOut = chan->scaleOut;
 	
@@ -1361,6 +1363,7 @@ void BKE_pose_rest(bPose *pose)
 		pchan->roll1 = pchan->roll2 = 0.0f;
 		pchan->curveInX = pchan->curveInY = 0.0f;
 		pchan->curveOutX = pchan->curveOutY = 0.0f;
+		pchan->ease1 = pchan->ease2 = 0.0f;
 		pchan->scaleIn = pchan->scaleOut = 1.0f;
 		
 		pchan->flag &= ~(POSE_LOC | POSE_ROT | POSE_SIZE | POSE_BBONE_SHAPE);
@@ -1404,6 +1407,8 @@ bool BKE_pose_copy_result(bPose *to, bPose *from)
 			pchanto->curveInY = pchanfrom->curveInY;
 			pchanto->curveOutX = pchanfrom->curveOutX;
 			pchanto->curveOutY = pchanfrom->curveOutY;
+			pchanto->ease1 = pchanfrom->ease1;
+			pchanto->ease2 = pchanfrom->ease2;
 			pchanto->scaleIn = pchanfrom->scaleIn;
 			pchanto->scaleOut = pchanfrom->scaleOut;
 			
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 669344e18d7..2edbd088334 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -614,8 +614,10 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB
 	{
 		const float circle_factor = length * (cubic_tangent_factor_circle_v3(h1, h2) / 0.75f);
 
-		const float hlength1 = bone->ease1 * circle_factor;
-		const float hlength2 = bone->ease2 * circle_factor;
+		const float combined_ease1 = bone->ease1 + (!rest ? pchan->ease1 : 0.0f);
+		const float combined_ease2 = bone->ease2 + (!rest ? pchan->ease2 : 0.0f);
+		const float hlength1 = combined_ease1 * circle_factor;
+		const float hlength2 = combined_ease2 * circle_factor;
 
 		/* and only now negate h2 */
 		mul_v3_fl(h1,  hlength1);
diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c
index cff161d9d93..e419100bd04 100644
--- a/source/blender/editors/armature/armature_add.c
+++ b/source/blender/editors/armature/armature_add.c
@@ -77,19 +77,20 @@ EditBone *ED_armature_edit_bone_add(bArmature *arm, const char *name)
 	bone->dist = 0.25f;
 	bone->xwidth = 0.1f;
 	bone->zwidth = 0.1f;
-	bone->ease1 = 1.0f;
-	bone->ease2 = 1.0f;
 	bone->rad_head = 0.10f;
 	bone->rad_tail = 0.05f;
 	bone->segments = 1;
 	bone->layer = arm->layer;
 	
+	/* Bendy-Bone parameters */
 	bone->roll1 = 0.0f;
 	bone->roll2 = 0.0f;
 	bone->curveInX = 0.0f;
 	bone->curveInY = 0.0f;
 	bone->curveOutX = 0.0f;
 	bone->curveOutY = 0.0f;
+	bone->ease1 = 1.0f;
+	bone->ease2 = 1.0f;
 	bone->scaleIn = 1.0f;
 	bone->scaleOut = 1.0f;
 
@@ -899,19 +900,20 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
 					newbone->dist = ebone->dist;
 					newbone->xwidth = ebone->xwidth;
 					newbone->zwidth = ebone->zwidth;
-					newbone->ease1 = ebone->ease1;
-					newbone->ease2 = ebone->ease2;
 					newbone->rad_head = ebone->rad_tail; // don't copy entire bone...
 					newbone->rad_tail = ebone->rad_tail;
 					newbone->segments = 1;
 					newbone->layer = ebone->layer;
 					
+					/* Bendy-Bone parameters */
 					newbone->roll1 = ebone->roll1;
 					newbone->roll2 = ebone->roll2;
 					newbone->curveInX = ebone->curveInX;
 					newbone->curveInY = ebone->curveInY;
 					newbone->curveOutX = ebone->curveOutX;
 					newbone->curveOutY = ebone->curveOutY;
+					newbone->ease1 = ebone->ease1;
+					newbone->ease2 = ebone->ease2;
 					newbone->scaleIn = ebone->scaleIn;
 					newbone->scaleOut = ebone->scaleOut;
 
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h
index 190b0610059..192bb8eea61 100644
--- a/source/blender/editors/armature/armature_intern.h
+++ b/source/blender/editors/armature/armature_intern.h
@@ -173,6 +173,7 @@ typedef struct tPChanFCurveLink {
 	float roll1, roll2;             /* old bbone values (to be restored along with the transform properties) */
 	float curveInX, curveInY;       /* (NOTE: we haven't renamed these this time, as their names are already long enough) */
 	float curveOutX, curveOutY;
+	float ease1, ease2;
 	float scaleIn, scaleOut;
 	
 	struct IDProperty *oldprops;    /* copy of custom properties at start of operator (to be restored before each modal step) */
diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c
index a3b439536b7..a55264bd020 100644
--- a/source/blender/editors/armature/armature_utils.c
+++ b/source/blender/editors/armature/armature_utils.c
@@ -462,19 +462,20 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone
 		eBone->weight = curBone->weight;
 		eBone->xwidth = curBone->xwidth;
 		eBone->zwidth = curBone->zwidth;
-		eBone->ease1 = curBone->ease1;
-		eBone->ease2 = curBone->ease2;
 		eBone->rad_head = curBone->rad_head;
 		eBone->rad_tail = curBone->rad_tail;
 		eBone->segments = curBone->segments;
 		eBone->layer = curBone->layer;
 
+		/* Bendy-Bone parameters */
 		eBone->roll1 = curBone->roll1;
 		eBone->roll2 = curBone->roll2;
 		eBone->curveInX = curBone->curveInX;
 		eBone->curveInY = curBone->curveInY;
 		eBone->curveOutX = curBone->curveOutX;
 		eBone->curveOutY = curBone->curveOutY;
+		eBone->ease1 = curBone->ease1;
+		eBone->ease2 = curBone->ease2;
 		eBone->scaleIn = curBone->scaleIn;
 		eBone->scaleOut = curBone->scaleOut;
 
@@ -626,19 +627,20 @@ void ED_armature_from_edit(bArmature *arm)
 		
 		newBone->xwidth = eBone->xwidth;
 		newBone->zwidth = eBone->zwidth;
-		newBone->ease1 = eBone->ease1;
-		newBone->ease2 = eBone->ease2;
 		newBone->rad_head = eBone->rad_head;
 		newBone->rad_tail = eBone->rad_tail;
 		newBone->segments = eBone->segments;
 		newBone->layer = eBone->layer;
 
+		/* Bendy-Bone parameters */
 		newBone->roll1 = eBone->roll1;
 		newBone->roll2 = eBone->roll2;
 		newBone->curveInX = eBone->curveInX;
 		newBone->curveInY = eBone->curveInY;
 		newBone->curveOutX = eBone->curveOutX;
 		newBone->curveOutY = eBone->curveOutY;
+		newBone->ease1 = eBone->ease1;
+		newBone->ease2 = eBone->ease2;
 		newBone->scaleIn = eBone->scaleIn;
 		newBone->scaleOut = eBone->scaleOut;
 
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index fa7bf6e7ad4..2fb216c2ef8 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -1444,19 +1444,20 @@ static EditBone *add_editbonetolist(char *name, ListBase *list)
 	bone->dist = 0.25F;
 	bone->xwidth = 0.1;
 	bone->zwidth = 0.1;
-	bone->ease1 = 1.0;
-	bone->ease2 = 1.0;
 	bone->rad_head = 0.10;
 	bone->rad_tail = 0.05;
 	bone->segments = 1;
 	bone->layer =  1; //arm->layer;
 	
+	/* Bendy-Bone parameters */
 	bone->roll1 = 0.0f;
 	bone->roll2 = 0.0f;
 	bone->curveInX = 0.0f;
 	bone->curveInY = 0.0f;
 	bone->curveOutX = 0.0f;
 	bone->curveOutY = 0.0f;
+	bone->ease1 = 1.0f;
+	bone->ease2 = 1.0f;
 	bone->scaleIn = 1.0f;
 	bone->scaleOut = 1.0f;
 
diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c
index 063ba37f20d..2d86610e065 100644
--- a/source/blender/editors/armature/pose_transform.c
+++ b/source/blender/editors/armature/pose_transform.c
@@ -355,6 +355,8 @@ static bPoseChannel *pose_bone_do_paste(Object *ob, bPoseChannel *chan, const bo
 		
 		pchan->roll1 = chan->roll1;
 		pchan->roll2 = chan->roll2;
+		pchan->ease1 = chan->ease1;
+		pchan->ease2 = chan->ease2;
 		pchan->scaleIn = chan->scaleIn;
 		pchan->scaleOut = chan->scaleOut;
 		
@@ -577,6 +579,8 @@ static void pchan_clear_scale(bPoseChannel *pchan)
 	if ((pchan->protectflag & OB_LOCK_SCALEZ) == 0)
 		pchan->size[2] = 1.0f;
 	
+	pchan->ease1 = 0.0f;
+	pchan->ease2 = 0.0f; 
 	pchan->scaleIn = 1.0f;
 	pchan->scaleOut = 1.0f;
 }
@@ -735,7 +739,7 @@ static int pose_clear_transform_generic_exec(bContext *C, wmOperator *op,
 			/* clear any unkeyed tags */
 			if (pchan->bone)
 				pchan->bone->flag &= ~BONE_UNKEYED;
-				
+
 			/* tag for autokeying later */
 			autokey = 1;
 		}
diff --git a/source/blender/editors/armature/pose_utils.c b/source/blender/editors/armature/pose_utils.c
index b960bec3603..f80afdd169e 100644
--- a/source/blender/editors/armature/pose_utils.c
+++ b/source/blender/editors/armature/pose_utils.c
@@ -114,6 +114,8 @@ static void fcurves_to_pchan_links_get(ListBase *pfLinks, Object *ob, bAction *a
 		pfl->curveInY = pchan->curveInY;
 		pfl->curveOutX = pchan->curveOutX;
 		pfl->curveOutY = pchan->curveOutY;
+		pfl->ease1 = pchan->ease1;
+		pfl->ease2 = pchan->ease2;
 		pfl->scaleIn = pchan->scaleIn;
 		pfl->scaleOut = pchan->scaleOut;
 		
@@ -219,6 +221,8 @@ void poseAnim_mapping_reset(ListBase *pfLinks)
 		pchan->curveInY = pfl->curveInY;
 		pchan->curveOutX = pfl->curveOutX;
 		pchan->curveOutY = pfl->curveOutY;
+		pchan->ease1 = pfl->ease1;
+		pchan->ease2 = pfl->ea

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list