X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Fvaluenode_duplicate.cpp;h=a8e5801af6c987fd61ad4a92714fed57c4cb53a8;hb=756c0d29ac1742f231e6615f9a577e574e35a4af;hp=4c6ce2a5e6eaf47c0fa1e98dc198af8d673f8527;hpb=c548bdf3c6b899415810f9f9438fcfd6769b78ce;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/valuenode_duplicate.cpp b/synfig-core/trunk/src/synfig/valuenode_duplicate.cpp index 4c6ce2a..a8e5801 100644 --- a/synfig-core/trunk/src/synfig/valuenode_duplicate.cpp +++ b/synfig-core/trunk/src/synfig/valuenode_duplicate.cpp @@ -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 @@ -55,18 +55,19 @@ ValueNode_Duplicate::ValueNode_Duplicate(const ValueBase::Type &x): { } -ValueNode_Duplicate::ValueNode_Duplicate(const ValueNode::Handle &x): - LinkableValueNode(x->get_type()) +ValueNode_Duplicate::ValueNode_Duplicate(const ValueBase &x): + LinkableValueNode(x.get_type()) { - set_link("from", ValueNode_Const::create(int(0))); - set_link("to", ValueNode_Const::create(int(3))); - set_link("step", ValueNode_Const::create(int(1))); + set_link("from", ValueNode_Const::create(Real(1.0))); + set_link("to", ValueNode_Const::create(x.get(Real()))); + set_link("step", ValueNode_Const::create(Real(1.0))); + index = 1.0; } ValueNode_Duplicate* ValueNode_Duplicate::create(const ValueBase &x) { - return new ValueNode_Duplicate(ValueNode_Const::create(x)); + return new ValueNode_Duplicate(x); } LinkableValueNode* @@ -81,26 +82,24 @@ ValueNode_Duplicate::~ValueNode_Duplicate() } bool -ValueNode_Duplicate::set_link_vfunc(int i,ValueNode::Handle x) +ValueNode_Duplicate::set_link_vfunc(int i,ValueNode::Handle value) { - assert(i >= 0 && i < link_count()); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i= 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 ValueNode_Duplicate::count_steps(Time t)const { - int from = (*from_)(t).get(int()); - int to = (*to_ )(t).get(int()); - int step = (*step_)(t).get(int()); + Real from = (*from_)(t).get(Real()); + Real to = (*to_ )(t).get(Real()); + Real step = (*step_)(t).get(Real()); if (step == 0) return 1; @@ -187,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; } @@ -205,7 +207,8 @@ ValueNode_Duplicate::get_local_name()const } bool -ValueNode_Duplicate::check_type(ValueBase::Type type) +ValueNode_Duplicate::check_type(ValueBase::Type type __attribute__ ((unused))) { - return type==ValueBase::TYPE_INTEGER; + // never offer this as a choice. it's used automatically by the 'Duplicate' layer. + return false; }