synfig::ValueBase
synfig::ValueNode_Scale::operator()(Time t)const
{
+ if (getenv("SYNFIG_DEBUG_VALUENODE_OPERATORS"))
+ printf("%s:%d operator()\n", __FILE__, __LINE__);
+
if(!value_node || !scalar)
throw runtime_error(strprintf("ValueNode_Scale: %s",_("One or both of my parameters aren't set!")));
else if(get_type()==ValueBase::TYPE_ANGLE)
return ValueBase();
}
+synfig::ValueBase
+synfig::ValueNode_Scale::get_inverse(Time t, const synfig::Vector &target_value) const
+{
+ Real scalar_value((*scalar)(t).get(Real()));
+ if(scalar_value==0)
+ throw runtime_error(strprintf("ValueNode_Scale: %s",_("Attempting to get the inverse of a non invertible Valuenode")));
+ else
+ {
+ switch (get_type())
+ {
+ case ValueBase::TYPE_REAL:
+ return target_value.mag() / scalar_value;
+ case ValueBase::TYPE_ANGLE:
+ return Angle::tan(target_value[1] / scalar_value ,target_value[0] / scalar_value);
+ default:
+ return target_value / scalar_value;
+ }
+ }
+ return ValueBase();
+}
+
+synfig::ValueBase
+synfig::ValueNode_Scale::get_inverse(Time t, const synfig::Angle &target_value) const
+{
+ Real scalar_value((*scalar)(t).get(Real()));
+ if(scalar_value==0)
+ throw runtime_error(strprintf("ValueNode_Scale: %s",_("Attempting to get the inverse of a non invertible Valuenode")));
+ else
+ {
+ switch (get_type())
+ {
+ default:
+ return (*value_node)(t).get(Angle()) + target_value / scalar_value;
+ }
+ }
+ return ValueBase();
+}
+
+bool
+synfig::ValueNode_Scale::is_invertible(Time t) const
+{
+ Real scalar_value((*scalar)(t).get(Real()));
+ return (!scalar_value==0);
+}
bool
ValueNode_Scale::set_link_vfunc(int i,ValueNode::Handle value)