Use LinkableValueNode members functions when possible in the derived valuenodes.
[synfig.git] / synfig-core / src / synfig / valuenode_duplicate.cpp
index d371d75..98921a7 100644 (file)
@@ -58,6 +58,8 @@ ValueNode_Duplicate::ValueNode_Duplicate(const ValueBase::Type &x):
 ValueNode_Duplicate::ValueNode_Duplicate(const ValueBase &x):
        LinkableValueNode(x.get_type())
 {
+       Vocab ret(get_children_vocab());
+       set_children_vocab(ret);
        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)));
@@ -107,44 +109,6 @@ ValueNode_Duplicate::get_link_vfunc(int i)const
        return 0;
 }
 
-int
-ValueNode_Duplicate::link_count()const
-{
-       return 3;
-}
-
-String
-ValueNode_Duplicate::link_local_name(int i)const
-{
-       assert(i>=0 && i<link_count());
-
-       if(i==0) return _("From");
-       if(i==1) return _("To");
-       if(i==2) return _("Step");
-       return String();
-}
-
-String
-ValueNode_Duplicate::link_name(int i)const
-{
-       assert(i>=0 && i<link_count());
-
-       if(i==0) return "from";
-       if(i==1) return "to";
-       if(i==2) return "step";
-       return String();
-}
-
-int
-ValueNode_Duplicate::get_link_index_from_name(const String &name)const
-{
-       if(name=="from") return 0;
-       if(name=="to")   return 1;
-       if(name=="step") return 2;
-
-       throw Exception::BadLinkName(name);
-}
-
 void
 ValueNode_Duplicate::reset_index(Time t)const
 {
@@ -219,6 +183,9 @@ ValueNode_Duplicate::check_type(ValueBase::Type type __attribute__ ((unused)))
 LinkableValueNode::Vocab
 ValueNode_Duplicate::get_children_vocab_vfunc()const
 {
+       if(children_vocab.size())
+               return children_vocab;
+
        LinkableValueNode::Vocab ret;
 
        ret.push_back(ParamDesc(ValueBase(),"from")