Allow Real values to be converted to "BLine Tangent". The ValueNode returns the...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Thu, 6 Mar 2008 00:35:48 +0000 (00:35 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Thu, 6 Mar 2008 00:35:48 +0000 (00:35 +0000)
git-svn-id: http://svn.voria.com/code@1862 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-core/trunk/src/synfig/valuenode_blinecalctangent.cpp

index 0d27157..9dfc067 100644 (file)
@@ -58,7 +58,7 @@ using namespace synfig;
 ValueNode_BLineCalcTangent::ValueNode_BLineCalcTangent(const ValueBase::Type &x):
        LinkableValueNode(x)
 {
-       if(x!=ValueBase::TYPE_ANGLE && x!=ValueBase::TYPE_VECTOR)
+       if(x!=ValueBase::TYPE_ANGLE && x!=ValueBase::TYPE_REAL && x!=ValueBase::TYPE_VECTOR)
                throw Exception::BadType(ValueBase::type_local_name(x));
 
        ValueNode_BLine* value_node(new ValueNode_BLine());
@@ -100,6 +100,7 @@ ValueNode_BLineCalcTangent::operator()(Time t)const
                switch (get_type())
                {
                        case ValueBase::TYPE_ANGLE:  return Angle();
+                       case ValueBase::TYPE_REAL:   return Real();
                        case ValueBase::TYPE_VECTOR: return Vector();
                        default: assert(0); return ValueBase();
                }
@@ -130,6 +131,7 @@ ValueNode_BLineCalcTangent::operator()(Time t)const
        switch (get_type())
        {
                case ValueBase::TYPE_ANGLE:  return deriv(amount-from_vertex).angle();
+               case ValueBase::TYPE_REAL:   return deriv(amount-from_vertex).mag();
                case ValueBase::TYPE_VECTOR: return deriv(amount-from_vertex);
                default: assert(0); return ValueBase();
        }
@@ -223,5 +225,6 @@ bool
 ValueNode_BLineCalcTangent::check_type(ValueBase::Type type)
 {
        return (type==ValueBase::TYPE_ANGLE ||
+                       type==ValueBase::TYPE_REAL  ||
                        type==ValueBase::TYPE_VECTOR);
 }