Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-core / trunk / src / synfig / valuenode_duplicate.cpp
index 2af20e7..540c3a9 100644 (file)
@@ -6,7 +6,7 @@
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**     Copyright (c) 2007 Chris Moore
+**     Copyright (c) 2007, 2008 Chris Moore
 **
 **     This package is free software; you can redistribute it and/or
 **     modify it under the terms of the GNU General Public License as
@@ -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
@@ -188,8 +189,11 @@ ValueNode_Duplicate::count_steps(Time t)const
 }
 
 ValueBase
-ValueNode_Duplicate::operator()(Time t)const
+ValueNode_Duplicate::operator()(Time t __attribute__ ((unused)))const
 {
+       if (getenv("SYNFIG_DEBUG_VALUENODE_OPERATORS"))
+               printf("%s:%d operator()\n", __FILE__, __LINE__);
+
        return index;
 }
 
@@ -206,7 +210,7 @@ ValueNode_Duplicate::get_local_name()const
 }
 
 bool
-ValueNode_Duplicate::check_type(ValueBase::Type type)
+ValueNode_Duplicate::check_type(ValueBase::Type type __attribute__ ((unused)))
 {
        // never offer this as a choice.  it's used automatically by the 'Duplicate' layer.
        return false;