diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2019-04-20 18:06:31 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2019-04-23 13:45:03 +0300 |
commit | 624e93bbef8a8a34be822c1a98df131439c32788 (patch) | |
tree | 592fce70ac6a810c6ee4ab9c0c3ce87ebedc14cf /source/blender/blenkernel/intern/armature.c | |
parent | c043ab1cf3bce77248a8d7dfa42b2e9f8f9611aa (diff) |
B-Bones: split the Scale In/Out properties into X and Y values.
As far as I can tell, there is no technical reason why the B-Bone
segment thickness scaling can't be separated into two axes. The
only downside is the increase in complexity of the B-Bone settings,
but this is inevitable due to the increase in flexibility.
Updating the file is somewhat complicated though, because F-Curves
and drivers have to be duplicated and updated to the new names.
Reviewers: campbellbarton
Subscribers: icappiello, jpbouza
Differential Revision: https://developer.blender.org/D4716
Diffstat (limited to 'source/blender/blenkernel/intern/armature.c')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index b726ea6c20d..3dd655ee9a8 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -680,8 +680,10 @@ void BKE_pchan_bbone_spline_params_get(struct bPoseChannel *pchan, } } - param->scaleIn = bone->scaleIn * (!rest ? pchan->scaleIn : 1.0f); - param->scaleOut = bone->scaleOut * (!rest ? pchan->scaleOut : 1.0f); + param->scale_in_x = bone->scale_in_x * (!rest ? pchan->scale_in_x : 1.0f); + param->scale_in_y = bone->scale_in_y * (!rest ? pchan->scale_in_y : 1.0f); + param->scale_out_x = bone->scale_out_x * (!rest ? pchan->scale_out_x : 1.0f); + param->scale_out_y = bone->scale_out_y * (!rest ? pchan->scale_out_y : 1.0f); /* Extra curve x / y */ param->curveInX = bone->curveInX + (!rest ? pchan->curveInX : 0.0f); @@ -827,7 +829,8 @@ static void make_bbone_spline_matrix(BBoneSplineParameters *param, float pos[3], float axis[3], float roll, - float scalefac, + float scalex, + float scaley, float result[4][4]) { float mat3[3][3]; @@ -843,8 +846,8 @@ static void make_bbone_spline_matrix(BBoneSplineParameters *param, } /* BBone scale... */ - mul_v3_fl(result[0], scalefac); - mul_v3_fl(result[2], scalefac); + mul_v3_fl(result[0], scalex); + mul_v3_fl(result[2], scaley); } /* Fade from first to second derivative when the handle is very short. */ @@ -908,17 +911,25 @@ int BKE_pchan_bbone_spline_compute(BBoneSplineParameters *param, /* End points require special handling to fix zero length handles. */ ease_handle_axis(bezt_deriv1[0], bezt_deriv2[0], axis); - make_bbone_spline_matrix( - param, scalemats, bezt_controls[0], axis, roll1, param->scaleIn, result_array[0].mat); + make_bbone_spline_matrix(param, + scalemats, + bezt_controls[0], + axis, + roll1, + param->scale_in_x, + param->scale_in_y, + result_array[0].mat); for (int a = 1; a < param->segments; a++) { evaluate_cubic_bezier(bezt_controls, bezt_points[a], cur, axis); float fac = ((float)a) / param->segments; float roll = interpf(roll2, roll1, fac); - float scalefac = interpf(param->scaleOut, param->scaleIn, fac); + float scalex = interpf(param->scale_out_x, param->scale_in_x, fac); + float scaley = interpf(param->scale_out_y, param->scale_in_y, fac); - make_bbone_spline_matrix(param, scalemats, cur, axis, roll, scalefac, result_array[a].mat); + make_bbone_spline_matrix( + param, scalemats, cur, axis, roll, scalex, scaley, result_array[a].mat); } negate_v3(bezt_deriv2[1]); @@ -928,7 +939,8 @@ int BKE_pchan_bbone_spline_compute(BBoneSplineParameters *param, bezt_controls[3], axis, roll2, - param->scaleOut, + param->scale_out_x, + param->scale_out_y, result_array[param->segments].mat); } /* Other code (e.g. display) uses matrices for the segments themselves. */ @@ -942,9 +954,11 @@ int BKE_pchan_bbone_spline_compute(BBoneSplineParameters *param, float fac = (a + 0.5f) / param->segments; float roll = interpf(roll2, roll1, fac); - float scalefac = interpf(param->scaleOut, param->scaleIn, fac); + float scalex = interpf(param->scale_out_x, param->scale_in_x, fac); + float scaley = interpf(param->scale_out_y, param->scale_in_y, fac); - make_bbone_spline_matrix(param, scalemats, prev, axis, roll, scalefac, result_array[a].mat); + make_bbone_spline_matrix( + param, scalemats, prev, axis, roll, scalex, scaley, result_array[a].mat); copy_v3_v3(prev, cur); } } |