diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-22 17:59:58 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-22 17:59:58 +0400 |
commit | 85923aff288da072750447b44e492ebe5c59bcce (patch) | |
tree | 330e08a96bf1f94ef5ca7f4702ffe91a048f8e44 /source/blender/blenkernel/intern/key.c | |
parent | 4a788a227702d373873c7d6769d6d46201df1b43 (diff) |
code cleanup: key/interpolation
Diffstat (limited to 'source/blender/blenkernel/intern/key.c')
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index e1bc1af2519..deb294a6738 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -271,7 +271,7 @@ void sort_keys(Key *key) /**************** do the key ****************/ -void key_curve_position_weights(float t, float *data, int type) +void key_curve_position_weights(float t, float data[4], int type) { float t2, t3, fc; @@ -303,7 +303,7 @@ void key_curve_position_weights(float t, float *data, int type) } /* first derivative */ -void key_curve_tangent_weights(float t, float *data, int type) +void key_curve_tangent_weights(float t, float data[4], int type) { float t2, fc; @@ -333,7 +333,7 @@ void key_curve_tangent_weights(float t, float *data, int type) } /* second derivative */ -void key_curve_normal_weights(float t, float *data, int type) +void key_curve_normal_weights(float t, float data[4], int type) { float fc; @@ -359,11 +359,11 @@ void key_curve_normal_weights(float t, float *data, int type) } } -static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl) +static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float t[4], int cycl) { /* return 1 means k[2] is the position, return 0 means interpolate */ KeyBlock *k1, *firstkey; - float d, dpos, ofs = 0, lastpos, temp, fval[4]; + float d, dpos, ofs = 0, lastpos; short bsplinetype; firstkey = lb->first; @@ -467,17 +467,12 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl) } /* interpolation */ - key_curve_position_weights(d, t, k[1]->type); if (k[1]->type != k[2]->type) { - key_curve_position_weights(d, fval, k[2]->type); - - temp = 1.0f - d; - t[0] = temp * t[0] + d * fval[0]; - t[1] = temp * t[1] + d * fval[1]; - t[2] = temp * t[2] + d * fval[2]; - t[3] = temp * t[3] + d * fval[3]; + float t_other[4]; + key_curve_position_weights(d, t_other, k[2]->type); + interp_v4_v4v4(t, t, t_other, d); } return 0; |