diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-08-22 15:51:23 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-08-22 15:51:23 +0400 |
commit | ee40894c05b1d5f07eda671bad74f18605cde0b6 (patch) | |
tree | 413bae0e944ec93847c59d5b2943e2cd39b7d5f7 /source/blender | |
parent | a594196dc0cf0482aab7d16b4cfee1a7d3b8707d (diff) |
Bugfix [#28217] Moving multiple selected action strips causes strips
to scale towards zero
This is an attempted bugfix for a bug which seems to be very fickle to
reproduce (it only happens sporadically after quickly jerking the
strips around in a certain way). So far when testing, I haven't had
any more problems after applying this fix, though it may just be
unreliable testing.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/nla.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 0235724c69c..25f824bba19 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -851,34 +851,35 @@ void BKE_nlameta_flush_transforms (NlaStrip *mstrip) /* for each child-strip, calculate new start/end points based on this new info */ for (strip= mstrip->strips.first; strip; strip= strip->next) { if (scaleChanged) { - PointerRNA ptr; - float p1, p2, nStart, nEnd; + float p1, p2; /* compute positions of endpoints relative to old extents of strip */ p1= (strip->start - oStart) / oLen; p2= (strip->end - oStart) / oLen; - /* compute the new strip endpoints using the proportions */ - nStart= (p1 * nLen) + mstrip->start; - nEnd= (p2 * nLen) + mstrip->start; - - /* firstly, apply the new positions manually, then apply using RNA - * - first time is to make sure no truncation errors from one endpoint not being - * set yet occur - * - second time is to make sure scale is computed properly... - */ - strip->start= nStart; - strip->end= nEnd; - - RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &ptr); - RNA_float_set(&ptr, "frame_start", nStart); - RNA_float_set(&ptr, "frame_end", nEnd); + /* apply new strip endpoints using the proportions, then wait for second pass to flush scale properly */ + strip->start= (p1 * nLen) + mstrip->start; + strip->end= (p2 * nLen) + mstrip->start; } else { /* just apply the changes in offset to both ends of the strip */ strip->start += offset; strip->end += offset; } + } + + /* apply a second pass over child strips, to finish up unfinished business */ + for (strip= mstrip->strips.first; strip; strip= strip->next) { + /* only if scale changed, need to perform RNA updates */ + if (scaleChanged) { + PointerRNA ptr; + + /* use RNA updates to compute scale properly */ + RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &ptr); + + RNA_float_set(&ptr, "frame_start", strip->start); + RNA_float_set(&ptr, "frame_end", strip->end); + } /* finally, make sure the strip's children (if it is a meta-itself), get updated */ BKE_nlameta_flush_transforms(strip); |