diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-05-06 11:10:30 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-05-06 11:10:30 +0400 |
commit | ee87af1e16f4aef7a8427b55100f545168608c9d (patch) | |
tree | c87c278c0f505a30ad117d944944f754913cc9ac /source/blender | |
parent | 2b1797d07bfd4549b3c74a127aeb1fa8460dfb87 (diff) |
Bugfixes:
* NLA scaling was being incorrectly handled with fractional values. This was caused by clamping to integers instead of floats when making sure the scale value was positive.
* Added checks to help prevent some weird cases that may sometimes occur and cause problems
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 6 | ||||
-rw-r--r-- | source/blender/src/drawnla.c | 33 | ||||
-rw-r--r-- | source/blender/src/editnla.c | 9 |
3 files changed, 28 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index c4df1db7627..5fb3d6f869a 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -489,11 +489,11 @@ static float get_actionstrip_frame(bActionStrip *strip, float cframe, int invert { float length, actlength, repeat, scale; - if(strip->repeat == 0.0f) strip->repeat = 1.0f; + if (strip->repeat == 0.0f) strip->repeat = 1.0f; repeat = (strip->flag & ACTSTRIP_USESTRIDE) ? (1.0f) : (strip->repeat); - if(strip->scale == 0.0f) strip->scale= 1.0f; - scale = abs(strip->scale); /* scale must be positive (for now) */ + if (strip->scale == 0.0f) strip->scale= 1.0f; + scale = fabs(strip->scale); /* scale must be positive (for now) */ actlength = strip->actend-strip->actstart; if (actlength == 0.0f) actlength = 1.0f; diff --git a/source/blender/src/drawnla.c b/source/blender/src/drawnla.c index fba55f7f308..c0cd11d27a1 100644 --- a/source/blender/src/drawnla.c +++ b/source/blender/src/drawnla.c @@ -490,39 +490,42 @@ void do_nlabuts(unsigned short event) allqueue (REDRAWNLA, 0); allqueue (REDRAWVIEW3D, 0); break; - case B_NLA_SCALE: + case B_NLA_SCALE: /* adjust end-frame when scale is changed */ { float actlen= strip->actend - strip->actstart; float mapping= strip->scale * strip->repeat; - strip->end = (actlen * mapping) + strip->start; + if (mapping != 0.0f) + strip->end = (actlen * mapping) + strip->start; + else + printf("NLA Scale Error: Scale = %0.4f, Repeat = %0.4f \n", strip->scale, strip->repeat); - allqueue (REDRAWNLA, 0); - allqueue (REDRAWIPO, 0); - allqueue (REDRAWACTION, 0); - allqueue (REDRAWVIEW3D, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWVIEW3D, 0); } break; - case B_NLA_SCALE2: + case B_NLA_SCALE2: /* adjust scale when end-frame is changed */ { float actlen= strip->actend - strip->actstart; float len= strip->end - strip->start; strip->scale= len / (actlen * strip->repeat); - allqueue (REDRAWNLA, 0); - allqueue (REDRAWIPO, 0); - allqueue (REDRAWACTION, 0); - allqueue (REDRAWVIEW3D, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWVIEW3D, 0); } break; case B_NLA_LOCK: synchronize_action_strips(); - allqueue (REDRAWNLA, 0); - allqueue (REDRAWIPO, 0); - allqueue (REDRAWACTION, 0); - allqueue (REDRAWVIEW3D, 0); + allqueue(REDRAWNLA, 0); + allqueue(REDRAWIPO, 0); + allqueue(REDRAWACTION, 0); + allqueue(REDRAWVIEW3D, 0); break; case B_NLA_MOD_ADD: diff --git a/source/blender/src/editnla.c b/source/blender/src/editnla.c index 6d9adda85d0..d758f34949a 100644 --- a/source/blender/src/editnla.c +++ b/source/blender/src/editnla.c @@ -188,11 +188,16 @@ void shift_nlastrips_down(void) { void synchronize_action_strips(void) { Base *base; + Object *ob; bActionStrip *strip; for (base=G.scene->base.first; base; base=base->next) { + /* get object first */ + ob= base->object; + /* step 1: adjust strip-lengths */ - for (strip = base->object->nlastrips.last; strip; strip=strip->prev) { + // FIXME: this seems very buggy + for (strip = ob->nlastrips.last; strip; strip=strip->prev) { if (strip->flag & ACTSTRIP_LOCK_ACTION) { float actstart, actend; @@ -212,7 +217,7 @@ void synchronize_action_strips(void) } /* step 2: adjust blendin/out values for each strip if option is turned on */ - for (strip= base->object->nlastrips.first; strip; strip=strip->next) { + for (strip= ob->nlastrips.first; strip; strip=strip->next) { if (strip->flag & ACTSTRIP_AUTO_BLENDS) { bActionStrip *prev= strip->prev; bActionStrip *next= strip->next; |