diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-06-28 11:32:00 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-06-28 11:32:00 +0400 |
commit | aa4ed13e4a216a3464f7b9d6643c195927aea98a (patch) | |
tree | 89da0c36092b7cea3a17163104dac2e46fd3d58a /source/blender/editors | |
parent | 500507ddb1efdf9f69d8a61e3d03a855ee017902 (diff) |
NLA SoC: NLA Mapping Cleanup
While trying to fix the mapping conversions for repeat, I came across some limitations with the current (soon to be previous) mapping methods.
Now the mapping conversions should work nicely for all places that use them.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/anim_draw.c | 16 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_edit.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_select.c | 12 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_edit.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_select.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_edit.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawarmature.c | 4 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 16 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 14 |
9 files changed, 45 insertions, 45 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 6d079fe148a..f7702379645 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -270,8 +270,8 @@ void ANIM_nla_mapping_draw(gla2DDrawInfo *di, AnimData *adt, short restore) gla2DGetMap(di, &stored); map= stored; - map.xmin= BKE_nla_tweakedit_remap(adt, map.xmin, 0); - map.xmax= BKE_nla_tweakedit_remap(adt, map.xmax, 0); + map.xmin= BKE_nla_tweakedit_remap(adt, map.xmin, NLATIME_CONVERT_MAP); + map.xmax= BKE_nla_tweakedit_remap(adt, map.xmax, NLATIME_CONVERT_MAP); if (map.xmin == map.xmax) map.xmax += 1.0f; gla2DSetMap(di, &map); @@ -289,11 +289,11 @@ static short bezt_nlamapping_restore(BeztEditData *bed, BezTriple *bezt) /* adjust BezTriple handles only if allowed to */ if (only_keys == 0) { - bezt->vec[0][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[0][0], 0); - bezt->vec[2][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[2][0], 0); + bezt->vec[0][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[0][0], NLATIME_CONVERT_UNMAP); + bezt->vec[2][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[2][0], NLATIME_CONVERT_UNMAP); } - bezt->vec[1][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[1][0], 0); + bezt->vec[1][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[1][0], NLATIME_CONVERT_UNMAP); return 0; } @@ -307,11 +307,11 @@ static short bezt_nlamapping_apply(BeztEditData *bed, BezTriple *bezt) /* adjust BezTriple handles only if allowed to */ if (only_keys == 0) { - bezt->vec[0][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[0][0], 1); - bezt->vec[2][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[2][0], 1); + bezt->vec[0][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[0][0], NLATIME_CONVERT_MAP); + bezt->vec[2][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[2][0], NLATIME_CONVERT_MAP); } - bezt->vec[1][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[1][0], 1); + bezt->vec[1][0]= BKE_nla_tweakedit_remap(adt, bezt->vec[1][0], NLATIME_CONVERT_MAP); return 0; } diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 61dbc41e7c8..dd351c92cf2 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -121,8 +121,8 @@ static void get_keyframe_extents (bAnimContext *ac, float *min, float *max) calc_fcurve_range(fcu, &tmin, &tmax); if (adt) { - tmin= BKE_nla_tweakedit_remap(adt, tmin, 1); - tmax= BKE_nla_tweakedit_remap(adt, tmax, 1); + tmin= BKE_nla_tweakedit_remap(adt, tmin, NLATIME_CONVERT_MAP); + tmax= BKE_nla_tweakedit_remap(adt, tmax, NLATIME_CONVERT_MAP); } /* try to set cur using these values, if they're more extreme than previously set values */ @@ -406,7 +406,7 @@ static void insert_action_keys(bAnimContext *ac, short mode) /* adjust current frame for NLA-scaling */ if (adt) - cfra= BKE_nla_tweakedit_remap(adt, (float)CFRA, 0); + cfra= BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP); else cfra= (float)CFRA; diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 451d120ff9b..d45e32dd3bb 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -255,8 +255,8 @@ static void borderselect_action (bAnimContext *ac, rcti rect, short mode, short if (ELEM(mode, ACTKEYS_BORDERSEL_FRAMERANGE, ACTKEYS_BORDERSEL_ALLKEYS)) { /* if channel is mapped in NLA, apply correction */ if (adt) { - bed.f1= BKE_nla_tweakedit_remap(adt, rectf.xmin, 0); - bed.f2= BKE_nla_tweakedit_remap(adt, rectf.xmax, 0); + bed.f1= BKE_nla_tweakedit_remap(adt, rectf.xmin, NLATIME_CONVERT_UNMAP); + bed.f2= BKE_nla_tweakedit_remap(adt, rectf.xmax, NLATIME_CONVERT_UNMAP); } else { bed.f1= rectf.xmin; @@ -504,7 +504,7 @@ static void columnselect_action_keys (bAnimContext *ac, short mode) for (ce= bed.list.first; ce; ce= ce->next) { /* set frame for validation callback to refer to */ if (adt) - bed.f1= BKE_nla_tweakedit_remap(adt, ce->cfra, 0); + bed.f1= BKE_nla_tweakedit_remap(adt, ce->cfra, NLATIME_CONVERT_UNMAP); else bed.f1= ce->cfra; @@ -707,7 +707,7 @@ static void actkeys_mselect_column(bAnimContext *ac, short select_mode, float se /* set frame for validation callback to refer to */ if (adt) - bed.f1= BKE_nla_tweakedit_remap(adt, selx, 0); + bed.f1= BKE_nla_tweakedit_remap(adt, selx, NLATIME_CONVERT_UNMAP); else bed.f1= selx; @@ -779,8 +779,8 @@ static void mouse_action_keys (bAnimContext *ac, int mval[2], short select_mode, /* apply NLA-scaling correction? */ if (adt) { - xmin= BKE_nla_tweakedit_remap(adt, rectf.xmin, 0); - xmax= BKE_nla_tweakedit_remap(adt, rectf.xmax, 0); + xmin= BKE_nla_tweakedit_remap(adt, rectf.xmin, NLATIME_CONVERT_UNMAP); + xmax= BKE_nla_tweakedit_remap(adt, rectf.xmax, NLATIME_CONVERT_UNMAP); } else { xmin= rectf.xmin; diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index fc04308077c..e38c24ed223 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -123,8 +123,8 @@ static void get_graph_keyframe_extents (bAnimContext *ac, float *xmin, float *xm calc_fcurve_bounds(fcu, &txmin, &txmax, &tymin, &tymax); if (adt) { - txmin= BKE_nla_tweakedit_remap(adt, txmin, 1); - txmax= BKE_nla_tweakedit_remap(adt, txmax, 1); + txmin= BKE_nla_tweakedit_remap(adt, txmin, NLATIME_CONVERT_MAP); + txmax= BKE_nla_tweakedit_remap(adt, txmax, NLATIME_CONVERT_MAP); } /* try to set cur using these values, if they're more extreme than previously set values */ @@ -288,7 +288,7 @@ static void create_ghost_curves (bAnimContext *ac, int start, int end) /* use the sampling callback at 1-frame intervals from start to end frames */ for (cfra= start; cfra <= end; cfra++, fpt++) { - float cfrae= BKE_nla_tweakedit_remap(adt, cfra, 0); + float cfrae= BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP); fpt->vec[0]= cfrae; fpt->vec[1]= fcurve_samplingcb_evalcurve(fcu, NULL, cfrae); @@ -427,7 +427,7 @@ static int graphkeys_click_insert_exec (bContext *C, wmOperator *op) /* apply inverse NLA-mapping to frame to get correct time in un-scaled action */ adt= ANIM_nla_mapping_get(&ac, ale); - frame= BKE_nla_tweakedit_remap(adt, frame, 0); + frame= BKE_nla_tweakedit_remap(adt, frame, NLATIME_CONVERT_UNMAP); /* insert keyframe on the specified frame + value */ insert_vert_fcurve((FCurve *)ale->data, frame, val, 0); diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index d600396fd77..afe66ed179e 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -238,8 +238,8 @@ static void borderselect_graphkeys (bAnimContext *ac, rcti rect, short mode, sho if (mode != BEZT_OK_VALUERANGE) { /* if channel is mapped in NLA, apply correction */ if (adt) { - bed.f1= BKE_nla_tweakedit_remap(adt, rectf.xmin, 0); - bed.f2= BKE_nla_tweakedit_remap(adt, rectf.xmax, 0); + bed.f1= BKE_nla_tweakedit_remap(adt, rectf.xmin, NLATIME_CONVERT_UNMAP); + bed.f2= BKE_nla_tweakedit_remap(adt, rectf.xmax, NLATIME_CONVERT_UNMAP); } else { bed.f1= rectf.xmin; @@ -459,7 +459,7 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode) for (ce= bed.list.first; ce; ce= ce->next) { /* set frame for validation callback to refer to */ if (ale) - bed.f1= BKE_nla_tweakedit_remap(adt, ce->cfra, 0); + bed.f1= BKE_nla_tweakedit_remap(adt, ce->cfra, NLATIME_CONVERT_UNMAP); else bed.f1= ce->cfra; @@ -841,7 +841,7 @@ static void graphkeys_mselect_column (bAnimContext *ac, int mval[2], short selec /* set frame for validation callback to refer to */ if (adt) - bed.f1= BKE_nla_tweakedit_remap(adt, selx, 0); + bed.f1= BKE_nla_tweakedit_remap(adt, selx, NLATIME_CONVERT_UNMAP); else bed.f1= selx; diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index bcf3bd4746a..6d82e3d4be2 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -870,9 +870,9 @@ static short bezt_apply_nlamapping (BeztEditData *bed, BezTriple *bezt) NlaStrip *strip= (NlaStrip *)bed->data; /* adjust all the times */ - bezt->vec[0][0]= nlastrip_get_frame(strip, bezt->vec[0][0], 1); - bezt->vec[1][0]= nlastrip_get_frame(strip, bezt->vec[1][0], 1); - bezt->vec[2][0]= nlastrip_get_frame(strip, bezt->vec[2][0], 1); + bezt->vec[0][0]= nlastrip_get_frame(strip, bezt->vec[0][0], NLATIME_CONVERT_MAP); + bezt->vec[1][0]= nlastrip_get_frame(strip, bezt->vec[1][0], NLATIME_CONVERT_MAP); + bezt->vec[2][0]= nlastrip_get_frame(strip, bezt->vec[2][0], NLATIME_CONVERT_MAP); /* nothing to return or else we exit */ return 0; diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index a4332ea1709..0827bcaa9ae 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -2434,7 +2434,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base /* only within action range */ if (actframe+ctime >= start && actframe+ctime <= end) { - CFRA= (int)BKE_nla_tweakedit_remap(adt, actframe+ctime, 1); + CFRA= (int)BKE_nla_tweakedit_remap(adt, actframe+ctime, NLATIME_CONVERT_MAP); if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL); @@ -2449,7 +2449,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base /* only within action range */ if ((actframe-ctime >= start) && (actframe-ctime <= end)) { - CFRA= (int)BKE_nla_tweakedit_remap(adt, actframe-ctime, 1); + CFRA= (int)BKE_nla_tweakedit_remap(adt, actframe-ctime, NLATIME_CONVERT_MAP); if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(&ob->id, adt, (float)CFRA, ADT_RECALC_ALL); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index ded6edbbb0e..9d8371afd61 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4365,7 +4365,7 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, AnimData *adt, sho /* convert frame to nla-action time (if needed) */ if (adt) - val= BKE_nla_tweakedit_remap(adt, *(td->val), 1); + val= BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_MAP); else val= *(td->val); @@ -4377,7 +4377,7 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, AnimData *adt, sho /* convert frame out of nla-action time */ if (adt) - *(td->val)= BKE_nla_tweakedit_remap(adt, val, 0); + *(td->val)= BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP); else *(td->val)= val; } @@ -4387,7 +4387,7 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, AnimData *adt, sho /* convert frame to nla-action time (if needed) */ if (adt) - val= BKE_nla_tweakedit_remap(adt, *(td->val), 1); + val= BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_MAP); else val= *(td->val); @@ -4397,7 +4397,7 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, AnimData *adt, sho /* convert frame out of nla-action time */ if (adt) - *(td->val)= BKE_nla_tweakedit_remap(adt, val, 0); + *(td->val)= BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP); else *(td->val)= val; } @@ -4487,9 +4487,9 @@ static void applyTimeTranslate(TransInfo *t, float sval) deltax= (float)( floor(deltax + 0.5f) ); } - val = BKE_nla_tweakedit_remap(adt, td->ival, 1); + val = BKE_nla_tweakedit_remap(adt, td->ival, NLATIME_CONVERT_MAP); val += deltax; - *(td->val) = BKE_nla_tweakedit_remap(adt, val, 0); + *(td->val) = BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP); } else { deltax = val = t->values[0]; @@ -4614,7 +4614,7 @@ static void applyTimeSlide(TransInfo *t, float sval) /* apply NLA-mapping to necessary values */ if (adt) - cval= BKE_nla_tweakedit_remap(adt, cval, 0); + cval= BKE_nla_tweakedit_remap(adt, cval, NLATIME_CONVERT_UNMAP); /* only apply to data if in range */ if ((sval > minx) && (sval < maxx)) { @@ -4726,7 +4726,7 @@ static void applyTimeScale(TransInfo *t) { /* check if any need to apply nla-mapping */ if (adt) - startx= BKE_nla_tweakedit_remap(adt, startx, 0); + startx= BKE_nla_tweakedit_remap(adt, startx, NLATIME_CONVERT_UNMAP); /* now, calculate the new value */ *(td->val) = td->ival - startx; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index d23f8fdfe40..b2afaac23de 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -3080,7 +3080,7 @@ static void createTransActionData(bContext *C, TransInfo *t) * higher scaling ratios, but is faster than converting all points) */ if (adt) - cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, 0); + cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP); else cfra = (float)CFRA; @@ -3134,7 +3134,7 @@ static void createTransActionData(bContext *C, TransInfo *t) * higher scaling ratios, but is faster than converting all points) */ if (adt) - cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, 0); + cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP); else cfra = (float)CFRA; @@ -3180,13 +3180,13 @@ static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt, */ if (adt) { - td2d->loc[0] = BKE_nla_tweakedit_remap(adt, loc[0], 0); + td2d->loc[0] = BKE_nla_tweakedit_remap(adt, loc[0], NLATIME_CONVERT_UNMAP); td2d->loc[1] = loc[1]; td2d->loc[2] = 0.0f; td2d->loc2d = loc; td->loc = td2d->loc; - td->center[0] = BKE_nla_tweakedit_remap(adt, cent[0], 0); + td->center[0] = BKE_nla_tweakedit_remap(adt, cent[0], NLATIME_CONVERT_UNMAP); td->center[1] = cent[1]; td->center[2] = 0.0f; @@ -3277,7 +3277,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) * higher scaling ratios, but is faster than converting all points) */ if (adt) - cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, 0); + cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP); else cfra = (float)CFRA; @@ -3336,7 +3336,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) * higher scaling ratios, but is faster than converting all points) */ if (adt) - cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, 0); + cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP); else cfra = (float)CFRA; @@ -3622,7 +3622,7 @@ void flushTransGraphData(TransInfo *t) /* we need to unapply the nla-scaling from the time in some situations */ if (adt) - td2d->loc2d[0]= BKE_nla_tweakedit_remap(adt, td2d->loc[0], 0); + td2d->loc2d[0]= BKE_nla_tweakedit_remap(adt, td2d->loc[0], NLATIME_CONVERT_UNMAP); else td2d->loc2d[0]= td2d->loc[0]; |