Leave the Duplicate ValueNode's Index sub-parameter at the last value that is actuall...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Tue, 15 Jan 2008 19:30:30 +0000 (19:30 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Tue, 15 Jan 2008 19:30:30 +0000 (19:30 +0000)
git-svn-id: http://svn.voria.com/code@1383 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-core/trunk/src/synfig/valuenode_duplicate.cpp

index 2af20e7..56f7425 100644 (file)
@@ -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