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>2009-06-28 11:32:00 +0400
committerJoshua Leung <aligorith@gmail.com>2009-06-28 11:32:00 +0400
commitaa4ed13e4a216a3464f7b9d6643c195927aea98a (patch)
tree89da0c36092b7cea3a17163104dac2e46fd3d58a
parent500507ddb1efdf9f69d8a61e3d03a855ee017902 (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.
-rw-r--r--source/blender/blenkernel/BKE_nla.h17
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c2
-rw-r--r--source/blender/blenkernel/intern/nla.c59
-rw-r--r--source/blender/blenkernel/nla_private.h3
-rw-r--r--source/blender/editors/animation/anim_draw.c16
-rw-r--r--source/blender/editors/space_action/action_edit.c6
-rw-r--r--source/blender/editors/space_action/action_select.c12
-rw-r--r--source/blender/editors/space_graph/graph_edit.c8
-rw-r--r--source/blender/editors/space_graph/graph_select.c8
-rw-r--r--source/blender/editors/space_nla/nla_edit.c6
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c4
-rw-r--r--source/blender/editors/transform/transform.c16
-rw-r--r--source/blender/editors/transform/transform_conversions.c14
13 files changed, 103 insertions, 68 deletions
diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h
index cc73ac02690..e2b1dd89deb 100644
--- a/source/blender/blenkernel/BKE_nla.h
+++ b/source/blender/blenkernel/BKE_nla.h
@@ -73,7 +73,22 @@ void BKE_nla_action_pushdown(struct AnimData *adt);
short BKE_nla_tweakmode_enter(struct AnimData *adt);
void BKE_nla_tweakmode_exit(struct AnimData *adt);
-float BKE_nla_tweakedit_remap(struct AnimData *adt, float cframe, short invert);
+/* ----------------------------- */
+/* Time Mapping */
+
+/* time mapping conversion modes */
+enum {
+ /* convert from global time to strip time - for evaluation */
+ NLATIME_CONVERT_EVAL = 0,
+ /* convert from global time to strip time - for editing corrections */
+ // XXX old 0 invert
+ NLATIME_CONVERT_UNMAP,
+ /* convert from strip time to global time */
+ // xxx old 1 invert
+ NLATIME_CONVERT_MAP,
+} eNlaTime_ConvertModes;
+
+float BKE_nla_tweakedit_remap(struct AnimData *adt, float cframe, short mode);
#endif
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 288867505be..4c0c30fe5c1 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -604,7 +604,7 @@ static void nlastrip_evaluate_controls (NlaStrip *strip, float ctime)
{
/* firstly, analytically generate values for influence and time (if applicable) */
if ((strip->flag & NLASTRIP_FLAG_USR_TIME) == 0)
- strip->strip_time= nlastrip_get_frame(strip, ctime, 0);
+ strip->strip_time= nlastrip_get_frame(strip, ctime, NLATIME_CONVERT_EVAL);
if ((strip->flag & NLASTRIP_FLAG_USR_INFLUENCE) == 0)
strip->influence= nlastrip_get_influence(strip, ctime);
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 760139bee15..2b95584dc25 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -329,7 +329,7 @@ NlaStrip *add_nlastrip_to_stack (AnimData *adt, bAction *act)
/* non clipped mapping for strip-time <-> global time (for Action-Clips)
* invert = convert action-strip time to global time
*/
-static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short invert)
+static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short mode)
{
float actlength, repeat, scale;
@@ -347,9 +347,20 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short
/* reversed = play strip backwards */
if (strip->flag & NLASTRIP_FLAG_REVERSE) {
- /* invert = convert action-strip time to global time */
- if (invert)
- return scale*(strip->actend - cframe) + strip->start; // FIXME: this doesn't work for multiple repeats yet
+ // FIXME: this won't work right with Graph Editor?
+ if (mode == NLATIME_CONVERT_MAP) {
+ return strip->end - scale*(cframe - strip->actstart);
+ }
+ else if (mode == NLATIME_CONVERT_UNMAP) {
+ int repeatsNum = (int)((cframe - strip->start) / (actlength * scale));
+
+ /* this method doesn't clip the values to lie within the action range only
+ * - the '(repeatsNum * actlength * scale)' compensates for the fmod(...)
+ * - the fmod(...) works in the same way as for eval
+ */
+ return strip->actend - (repeatsNum * actlength * scale)
+ - (fmod(cframe - strip->start, actlength*scale) / scale);
+ }
else {
if (IS_EQ(cframe, strip->end) && IS_EQ(strip->repeat, ((int)strip->repeat))) {
/* this case prevents the motion snapping back to the first frame at the end of the strip
@@ -367,10 +378,20 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short
}
}
else {
- /* invert = convert action-strip time to global time */
- if (invert)
- return scale*(cframe - strip->actstart) + strip->start; // FIXME: this doesn't work for mutiple repeats yet
- else {
+ if (mode == NLATIME_CONVERT_MAP) {
+ return strip->start + scale*(cframe - strip->actstart);
+ }
+ else if (mode == NLATIME_CONVERT_UNMAP) {
+ int repeatsNum = (int)((cframe - strip->start) / (actlength * scale));
+
+ /* this method doesn't clip the values to lie within the action range only
+ * - the '(repeatsNum * actlength * scale)' compensates for the fmod(...)
+ * - the fmod(...) works in the same way as for eval
+ */
+ return strip->actstart + (repeatsNum * actlength * scale)
+ + (fmod(cframe - strip->start, actlength*scale) / scale);
+ }
+ else /* if (mode == NLATIME_CONVERT_EVAL) */{
if (IS_EQ(cframe, strip->end) && IS_EQ(strip->repeat, ((int)strip->repeat))) {
/* this case prevents the motion snapping back to the first frame at the end of the strip
* by catching the case where repeats is a whole number, which means that the end of the strip
@@ -391,7 +412,7 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short
/* non clipped mapping for strip-time <-> global time (for Transitions)
* invert = convert action-strip time to global time
*/
-static float nlastrip_get_frame_transition (NlaStrip *strip, float cframe, short invert)
+static float nlastrip_get_frame_transition (NlaStrip *strip, float cframe, short mode)
{
float length;
@@ -400,15 +421,13 @@ static float nlastrip_get_frame_transition (NlaStrip *strip, float cframe, short
/* reversed = play strip backwards */
if (strip->flag & NLASTRIP_FLAG_REVERSE) {
- /* invert = convert within-strip-time to global time */
- if (invert)
+ if (mode == NLATIME_CONVERT_MAP)
return strip->end - (length * cframe);
else
return (strip->end - cframe) / length;
}
else {
- /* invert = convert within-strip-time to global time */
- if (invert)
+ if (mode == NLATIME_CONVERT_MAP)
return (length * cframe) + strip->start;
else
return (cframe - strip->start) / length;
@@ -416,31 +435,31 @@ static float nlastrip_get_frame_transition (NlaStrip *strip, float cframe, short
}
/* non clipped mapping for strip-time <-> global time
- * invert = convert action-strip time to global time
+ * mode = eNlaTime_ConvertModes[] -> NLATIME_CONVERT_*
*
* only secure for 'internal' (i.e. within AnimSys evaluation) operations,
* but should not be directly relied on for stuff which interacts with editors
*/
-float nlastrip_get_frame (NlaStrip *strip, float cframe, short invert)
+float nlastrip_get_frame (NlaStrip *strip, float cframe, short mode)
{
switch (strip->type) {
case NLASTRIP_TYPE_TRANSITION: /* transition */
- return nlastrip_get_frame_transition(strip, cframe, invert);
+ return nlastrip_get_frame_transition(strip, cframe, mode);
case NLASTRIP_TYPE_CLIP: /* action-clip (default) */
default:
- return nlastrip_get_frame_actionclip(strip, cframe, invert);
+ return nlastrip_get_frame_actionclip(strip, cframe, mode);
}
}
/* Non clipped mapping for strip-time <-> global time
- * invert = convert strip-time to global time
+ * mode = eNlaTime_ConvertModesp[] -> NLATIME_CONVERT_*
*
* Public API method - perform this mapping using the given AnimData block
* and perform any necessary sanity checks on the value
*/
-float BKE_nla_tweakedit_remap (AnimData *adt, float cframe, short invert)
+float BKE_nla_tweakedit_remap (AnimData *adt, float cframe, short mode)
{
NlaStrip *strip;
@@ -469,7 +488,7 @@ float BKE_nla_tweakedit_remap (AnimData *adt, float cframe, short invert)
return cframe;
/* perform the correction now... */
- return nlastrip_get_frame(strip, cframe, invert);
+ return nlastrip_get_frame(strip, cframe, mode);
}
/* *************************************************** */
diff --git a/source/blender/blenkernel/nla_private.h b/source/blender/blenkernel/nla_private.h
index af886fb7de8..1514a79f03b 100644
--- a/source/blender/blenkernel/nla_private.h
+++ b/source/blender/blenkernel/nla_private.h
@@ -73,6 +73,7 @@ typedef struct NlaEvalChannel {
/* --------------- NLA Functions (not to be used as a proper API) ----------------------- */
/* convert from strip time <-> global time */
-float nlastrip_get_frame(NlaStrip *strip, float cframe, short invert);
+float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode);
+
#endif // NLA_PRIVATE
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];