diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-10-29 22:10:48 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-10-29 22:10:48 +0400 |
commit | f6e504cee9f85867554f5a0ab89b52a66c0f257e (patch) | |
tree | 5fb69d2976ae845f908840b1d28fd81dfcaa8b2d /source/blender/editors/animation | |
parent | 8bdbbca4858ab143661f371cc302092759e29408 (diff) |
Make anim system safer for threading
Remove usages of ANIM_unit_mapping_apply_fcurve in favor of
runtime scale factor apply.
There're still calls to ANIM_nla_mapping_apply_fcurve are
hanging around, they're the next t be cleaned up!
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_draw.c | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 9e8800fd91e..4a8557a2b1f 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -389,76 +389,4 @@ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short rest return 1.0f; } -/* ----------------------- */ - -/* helper function for ANIM_unit_mapping_apply_fcurve -> mapping callback for unit mapping */ -static short bezt_unit_mapping_apply(KeyframeEditData *ked, BezTriple *bezt) -{ - /* mapping factor is stored in f1, flags are stored in i1 */ - const bool only_keys = (ked->i1 & ANIM_UNITCONV_ONLYKEYS) != 0; - const bool sel_vs = (ked->i1 & ANIM_UNITCONV_SELVERTS) != 0; - const bool skip_knot = (ked->i1 & ANIM_UNITCONV_SKIPKNOTS) != 0; - float fac = ked->f1; - - /* adjust BezTriple handles only if allowed to */ - if (only_keys == false) { - if ((sel_vs == false) || (bezt->f1 & SELECT)) - bezt->vec[0][1] *= fac; - if ((sel_vs == false) || (bezt->f3 & SELECT)) - bezt->vec[2][1] *= fac; - } - - if (skip_knot == false) { - if ((sel_vs == false) || (bezt->f2 & SELECT)) - bezt->vec[1][1] *= fac; - } - - return 0; -} - -/* Apply/Unapply units conversions to keyframes */ -void ANIM_unit_mapping_apply_fcurve(Scene *scene, ID *id, FCurve *fcu, short flag) -{ - KeyframeEditData ked; - KeyframeEditFunc sel_cb; - float fac; - - /* abort if rendering - we may get some race condition issues... */ - if (G.is_rendering) return; - - /* calculate mapping factor, and abort if nothing to change */ - fac = ANIM_unit_mapping_get_factor(scene, id, fcu, (flag & ANIM_UNITCONV_RESTORE)); - if (fac == 1.0f) - return; - - /* init edit data - * - mapping factor is stored in f1 - * - flags are stored in 'i1' - */ - memset(&ked, 0, sizeof(KeyframeEditData)); - ked.f1 = (float)fac; - ked.i1 = (int)flag; - - /* only selected? */ - if (flag & ANIM_UNITCONV_ONLYSEL) - sel_cb = ANIM_editkeyframes_ok(BEZT_OK_SELECTED); - else - sel_cb = NULL; - - /* apply to F-Curve */ - ANIM_fcurve_keyframes_loop(&ked, fcu, sel_cb, bezt_unit_mapping_apply, NULL); - - // FIXME: loop here for samples should be generalised - // TODO: only sel? - if (fcu->fpt) { - FPoint *fpt; - unsigned int i; - - for (i = 0, fpt = fcu->fpt; i < fcu->totvert; i++, fpt++) { - /* apply unit mapping */ - fpt->vec[1] *= fac; - } - } -} - /* *************************************************** */ |