From 8045d1434d6c983092e2b3cdecc6b48b43fca520 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 10 Sep 2007 10:47:09 +0000 Subject: Action Editor - minor cleanups of transform code... --- source/blender/src/editaction.c | 59 ++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 33 deletions(-) (limited to 'source/blender/src') diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index 3ab22fdd051..8886e57e199 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -781,7 +781,7 @@ static TransVert *transform_action_init (int *tvtot, float *minx, float *maxx) /* min max, only every other three */ min= max= tv[1].loc[0]; - for (i=1; itv[i].loc[0]) min= tv[i].loc[0]; if(maxflag |= SACTION_MOVING; G.saction->timeslide= sval[0]; } startx=sval[0]; while (loop) { - if(mode=='t' && minx==maxx) + if (mode=='t' && minx==maxx) break; - /* Get the input */ - /* If we're cancelling, reset transformations */ - /* Else calc new transformation */ - /* Perform the transformations */ + /* Get the input: + * - If we're cancelling, reset transformations + * - Else calc new transformation + * Perform the transformations + */ while (qtest()) { short val; unsigned short event= extern_qread(&val); @@ -974,13 +978,13 @@ static short transform_action_loop (TransVert *tv, int tvtot, char mode, short c fac *= -1; } startx= (G.scene->r.cfra); - if(NLA_ACTION_SCALED && context==ACTCONT_ACTION) + if (NLA_ACTION_SCALED && context==ACTCONT_ACTION) startx= get_action_frame(OBACT, startx); tv[i].loc[0]-= startx; tv[i].loc[0]*=fac; tv[i].loc[0]+= startx; - + break; } @@ -1017,37 +1021,26 @@ static short transform_action_loop (TransVert *tv, int tvtot, char mode, short c /* recalculate the delta based on 'visual' times */ fac = get_action_frame_inv(OBACT, cval[0]); fac -= get_action_frame_inv(OBACT, sval[0]); - - if (autosnap == SACTSNAP_STEP) { - if (G.saction->flag & SACTION_DRAWTIME) - fac= floor(fac/secf + 0.5f); - else - fac= floor(fac + 0.5f); - } - else if (autosnap == SACTSNAP_FRAME) { - if (G.saction->flag & SACTION_DRAWTIME) - fac= fac / secf; - } } - else { - if (autosnap == SACTSNAP_STEP) { - if (G.saction->flag & SACTION_DRAWTIME) - fac= floor(fac/secf + 0.5f); - else - fac= floor(fac + 0.5f); - } - else if (autosnap == SACTSNAP_FRAME) { - if (G.saction->flag & SACTION_DRAWTIME) - fac= fac / secf; - } + + if (autosnap == SACTSNAP_STEP) { + if (G.saction->flag & SACTION_DRAWTIME) + fac= floor(fac/secf + 0.5f); + else + fac= floor(fac + 0.5f); + } + else if (autosnap == SACTSNAP_FRAME) { + if (G.saction->flag & SACTION_DRAWTIME) + fac= fac / secf; } sprintf(str, "deltaX: %.3f", fac); headerprint(str); } else if (mode=='t') { - float fac= 2.0*(cval[0]-sval[0])/(maxx-minx); + fac= 2.0*(cval[0]-sval[0])/(maxx-minx); CLAMP(fac, -1.0f, 1.0f); + sprintf(str, "TimeSlide: %.3f", fac); headerprint(str); } -- cgit v1.2.3