X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Fvaluenode_scale.cpp;h=a6f05530a6078f944a976f477f17a057340ddf6f;hb=756c0d29ac1742f231e6615f9a577e574e35a4af;hp=9c2924a1590dbec678a9fae922e632ca23e685f2;hpb=c6b0c050710376d3cf99b7c083a7c47f1a0516c9;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/valuenode_scale.cpp b/synfig-core/trunk/src/synfig/valuenode_scale.cpp index 9c2924a..a6f0553 100644 --- a/synfig-core/trunk/src/synfig/valuenode_scale.cpp +++ b/synfig-core/trunk/src/synfig/valuenode_scale.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 @@ -59,7 +59,7 @@ using namespace synfig; ValueNode_Scale::ValueNode_Scale(const ValueBase &value): LinkableValueNode(value.get_type()) { - set_scalar(1.0); + set_link("scalar",ValueNode::Handle(ValueNode_Const::create(Real(1.0)))); ValueBase::Type id(value.get_type()); switch(id) @@ -84,11 +84,11 @@ ValueNode_Scale::ValueNode_Scale(const ValueBase &value): break; default: assert(0); - throw runtime_error("synfig::ValueNode_Scale:Bad type "+ValueBase::type_name(value.get_type())); + throw runtime_error(get_local_name()+_(":Bad type ")+ValueBase::type_local_name(id)); } assert(value_node); - assert(get_value_node()->get_type()==id); + assert(value_node->get_type()==id); assert(get_type()==id); } @@ -109,56 +109,6 @@ synfig::ValueNode_Scale::~ValueNode_Scale() unlink_all(); } -void -ValueNode_Scale::set_scalar(Real x) -{ - set_link("scalar",ValueNode::Handle(ValueNode_Const::create(x))); -} - -bool -ValueNode_Scale::set_scalar(const ValueNode::Handle &x) -{ - if(!x - || x->get_type()!=ValueBase::TYPE_REAL - && !PlaceholderValueNode::Handle::cast_dynamic(x) - ) - return false; - scalar=x; - return true; -} - -ValueNode::Handle -ValueNode_Scale::get_scalar()const -{ - return scalar; -} - -bool -ValueNode_Scale::set_value_node(const ValueNode::Handle &x) -{ - assert(get_type()); - - // if this isn't a proper value - if(!x || - // or we don't have a type, and this value isn't one of the types we accept - (get_type()==ValueBase::TYPE_NIL && !check_type(x->get_type())) || - // or we have a type and this value is a different type and (placeholder?) - (get_type()!=ValueBase::TYPE_NIL && x->get_type()!=get_type() && !PlaceholderValueNode::Handle::cast_dynamic(x))) - // then fail to set the value - return false; - - value_node=x; - - return true; -} - -ValueNode::Handle -ValueNode_Scale::get_value_node()const -{ - return value_node; -} - - synfig::ValueBase synfig::ValueNode_Scale::operator()(Time t)const { @@ -190,19 +140,16 @@ synfig::ValueNode_Scale::operator()(Time t)const bool -ValueNode_Scale::set_link_vfunc(int i,ValueNode::Handle x) +ValueNode_Scale::set_link_vfunc(int i,ValueNode::Handle value) { assert(i>=0 && i