Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2017-11-01 03:38:51 +0300
committerJoshua Leung <aligorith@gmail.com>2017-11-01 04:42:08 +0300
commita819ef65c07131ddb203a55bd8dc4e3207130b64 (patch)
tree7d36d859316df3b9ddd46dfba8413ab60795a66c /source/blender
parent2ae6a93f05e9efb83c943b2782b5d36b3d57f60c (diff)
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
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/action.c5
-rw-r--r--source/blender/blenkernel/intern/armature.c6
-rw-r--r--source/blender/editors/armature/armature_add.c10
-rw-r--r--source/blender/editors/armature/armature_intern.h1
-rw-r--r--source/blender/editors/armature/armature_utils.c10
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c5
-rw-r--r--source/blender/editors/armature/pose_transform.c6
-rw-r--r--source/blender/editors/armature/pose_utils.c4
-rw-r--r--source/blender/editors/include/ED_armature.h5
-rw-r--r--source/blender/makesdna/DNA_action_types.h1
-rw-r--r--source/blender/makesdna/DNA_armature_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_armature.c27
12 files changed, 55 insertions, 27 deletions
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->ease2;
pchan->scaleIn = pfl->scaleIn;
pchan->scaleOut = pfl->scaleOut;
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index 9130336228d..00081b95c51 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -72,12 +72,15 @@ typedef struct EditBone {
float dist, weight;
float xwidth, length, zwidth; /* put them in order! transform uses this as scale */
- float ease1, ease2;
float rad_head, rad_tail;
+
+ /* Bendy-Bone parameters */
float roll1, roll2;
float curveOutX, curveOutY;
float curveInX, curveInY;
+ float ease1, ease2;
float scaleIn, scaleOut;
+
float oldlength; /* for envelope scaling */
short segments;
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index 9d4731f8da4..a7f3d27e9d2 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -254,6 +254,7 @@ typedef struct bPoseChannel {
float roll1, roll2;
float curveInX, curveInY;
float curveOutX, curveOutY;
+ float ease1, ease2;
float scaleIn, scaleOut;
struct bPoseChannel *bbone_prev; /* next/prev bones to use as handle references when calculating bbones (optional) */
diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h
index cda6441f0ae..757c0eb8394 100644
--- a/source/blender/makesdna/DNA_armature_types.h
+++ b/source/blender/makesdna/DNA_armature_types.h
@@ -66,12 +66,12 @@ typedef struct Bone {
float dist, weight; /* dist, weight: for non-deformgroup deforms */
float xwidth, length, zwidth; /* width: for block bones. keep in this order, transform! */
- float ease1, ease2; /* length of bezier handles */
float rad_head, rad_tail; /* radius for head/tail sphere, defining deform as well, parent->rad_tip overrides rad_head */
float roll1, roll2; /* curved bones settings - these define the "restpose" for a curved bone */
float curveInX, curveInY;
float curveOutX, curveOutY;
+ float ease1, ease2; /* length of bezier handles */
float scaleIn, scaleOut;
float size[3]; /* patch for upward compat, UNUSED! */
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index cbb78f42f06..b4c5783a530 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -542,7 +542,22 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone)
RNA_def_property_range(prop, -5.0f, 5.0f);
RNA_def_property_ui_text(prop, "Out Y", "Y-axis handle offset for end of the B-Bone's curve, adjusts curvature");
RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
+
+ /* Ease In/Out */
+ prop = RNA_def_property(srna, "bbone_easein", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ease1");
+ RNA_def_property_range(prop, -5.0f, 5.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "B-Bone Ease In", "Length of first Bezier Handle (for B-Bones only)");
+ RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
+ prop = RNA_def_property(srna, "bbone_easeout", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ease2");
+ RNA_def_property_range(prop, -5.0f, 5.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "B-Bone Ease Out", "Length of second Bezier Handle (for B-Bones only)");
+ RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
+
/* Scale In/Out */
prop = RNA_def_property(srna, "bbone_scalein", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "scaleIn");
@@ -680,18 +695,6 @@ static void rna_def_bone_common(StructRNA *srna, int editbone)
RNA_def_property_ui_text(prop, "B-Bone Segments", "Number of subdivisions of bone (for B-Bones only)");
RNA_def_property_update(prop, 0, "rna_Armature_update_data");
- prop = RNA_def_property(srna, "bbone_in", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ease1");
- RNA_def_property_range(prop, 0.0f, 2.0f);
- RNA_def_property_ui_text(prop, "B-Bone Ease In", "Length of first Bezier Handle (for B-Bones only)");
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
-
- prop = RNA_def_property(srna, "bbone_out", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ease2");
- RNA_def_property_range(prop, 0.0f, 2.0f);
- RNA_def_property_ui_text(prop, "B-Bone Ease Out", "Length of second Bezier Handle (for B-Bones only)");
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
-
prop = RNA_def_property(srna, "bbone_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "xwidth");
RNA_def_property_range(prop, 0.0f, 1000.0f);