From: dooglus Date: Tue, 15 Jan 2008 19:30:30 +0000 (+0000) Subject: Leave the Duplicate ValueNode's Index sub-parameter at the last value that is actuall... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=ae7d8004068f9256c30a4f3e5c470d9c9cf17faf;p=synfig.git Leave the Duplicate ValueNode's Index sub-parameter at the last value that is actually used. For example, if it's stepping (From 0) (To 8) (Step 3), the used values will be 0, 3, and 6, and it will be left at value 6, finally, rather than 9 as before. git-svn-id: http://svn.voria.com/code@1383 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/src/synfig/valuenode_duplicate.cpp b/synfig-core/trunk/src/synfig/valuenode_duplicate.cpp index 2af20e7..56f7425 100644 --- a/synfig-core/trunk/src/synfig/valuenode_duplicate.cpp +++ b/synfig-core/trunk/src/synfig/valuenode_duplicate.cpp @@ -158,6 +158,7 @@ ValueNode_Duplicate::step(Time t)const Real from = (*from_)(t).get(Real()); Real to = (*to_ )(t).get(Real()); Real step = (*step_)(t).get(Real()); + Real prev = index; if (step == 0) return false; @@ -165,14 +166,14 @@ ValueNode_Duplicate::step(Time t)const if (from < to) { - index += step; - return index <= to; + if ((index += step) <= to) return true; } else - { - index -= step; - return index >= to; - } + if ((index -= step) >= to) return true; + + // at the end of the loop, leave the index at the last value that was used + index = prev; + return false; } int