From 9748dd06994596fffa1a9ae601c9acf328233305 Mon Sep 17 00:00:00 2001 From: dooglus Date: Thu, 6 Mar 2008 00:35:48 +0000 Subject: [PATCH] Allow Real values to be converted to "BLine Tangent". The ValueNode returns the length of the tangent at the selected point. git-svn-id: http://svn.voria.com/code@1862 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/synfig/valuenode_blinecalctangent.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/synfig-core/trunk/src/synfig/valuenode_blinecalctangent.cpp b/synfig-core/trunk/src/synfig/valuenode_blinecalctangent.cpp index 0d271570..9dfc0676 100644 --- a/synfig-core/trunk/src/synfig/valuenode_blinecalctangent.cpp +++ b/synfig-core/trunk/src/synfig/valuenode_blinecalctangent.cpp @@ -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); } -- 2.11.4.GIT