X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Fvaluenode_duplicate.cpp;h=5bb65f151fad284dfcb0b6d60447d8576ec80e8e;hb=4cee6cb5283901c57c97cae3c464ac25ead814b4;hp=2af20e77e41666140f853c67938e25f37a8aa513;hpb=6f8559ddcb82636029d07776700d51b0e0c35e92;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/valuenode_duplicate.cpp b/synfig-core/trunk/src/synfig/valuenode_duplicate.cpp index 2af20e7..5bb65f1 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 @@ -188,7 +189,7 @@ ValueNode_Duplicate::count_steps(Time t)const } ValueBase -ValueNode_Duplicate::operator()(Time t)const +ValueNode_Duplicate::operator()(Time t __attribute__ ((unused)))const { return index; } @@ -206,7 +207,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;