projects
/
synfig.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Typo: 'suposidly' -> 'supposedly'.
[synfig.git]
/
synfig-core
/
trunk
/
src
/
synfig
/
valuenode_blinecalctangent.cpp
diff --git
a/synfig-core/trunk/src/synfig/valuenode_blinecalctangent.cpp
b/synfig-core/trunk/src/synfig/valuenode_blinecalctangent.cpp
index
778fb42
..
e8fc826
100644
(file)
--- a/
synfig-core/trunk/src/synfig/valuenode_blinecalctangent.cpp
+++ b/
synfig-core/trunk/src/synfig/valuenode_blinecalctangent.cpp
@@
-6,6
+6,7
@@
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2007 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
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
@@
-57,7
+58,7
@@
using namespace synfig;
ValueNode_BLineCalcTangent::ValueNode_BLineCalcTangent(const ValueBase::Type &x):
LinkableValueNode(x)
{
ValueNode_BLineCalcTangent::ValueNode_BLineCalcTangent(const ValueBase::Type &x):
LinkableValueNode(x)
{
- if(x!=ValueBase::TYPE_VECTOR)
+ if(x!=ValueBase::TYPE_
ANGLE && x!=ValueBase::TYPE_
VECTOR)
throw Exception::BadType(ValueBase::type_name(x));
ValueNode_BLine* value_node(new ValueNode_BLine());
throw Exception::BadType(ValueBase::type_name(x));
ValueNode_BLine* value_node(new ValueNode_BLine());
@@
-69,7
+70,7
@@
ValueNode_BLineCalcTangent::ValueNode_BLineCalcTangent(const ValueBase::Type &x)
LinkableValueNode*
ValueNode_BLineCalcTangent::create_new()const
{
LinkableValueNode*
ValueNode_BLineCalcTangent::create_new()const
{
- return new ValueNode_BLineCalcTangent(
ValueBase::TYPE_VECTOR
);
+ return new ValueNode_BLineCalcTangent(
get_type()
);
}
ValueNode_BLineCalcTangent*
}
ValueNode_BLineCalcTangent*
@@
-95,7
+96,13
@@
ValueNode_BLineCalcTangent::operator()(Time t)const
BLinePoint blinepoint0, blinepoint1;
if (!looped) size--;
BLinePoint blinepoint0, blinepoint1;
if (!looped) size--;
- if (size < 1) return Vector();
+ if (size < 1)
+ switch (get_type())
+ {
+ case ValueBase::TYPE_ANGLE: return Angle();
+ case ValueBase::TYPE_VECTOR: return Vector();
+ default: assert(0); return ValueBase();
+ }
if (loop)
{
amount = amount - int(amount);
if (loop)
{
amount = amount - int(amount);
@@
-121,9
+128,19
@@
ValueNode_BLineCalcTangent::operator()(Time t)const
etl::derivative< etl::hermite<Vector> > deriv(curve);
#ifdef ETL_FIXED_DERIVATIVE
etl::derivative< etl::hermite<Vector> > deriv(curve);
#ifdef ETL_FIXED_DERIVATIVE
- return deriv(amount-from_vertex)*(0.5);
+ switch (get_type())
+ {
+ case ValueBase::TYPE_ANGLE: return (deriv(amount-from_vertex)*(0.5)).angle();
+ case ValueBase::TYPE_VECTOR: return deriv(amount-from_vertex)*(0.5);
+ default: assert(0); return ValueBase();
+ }
#else
#else
- return deriv(amount-from_vertex)*(-0.5);
+ switch (get_type())
+ {
+ case ValueBase::TYPE_ANGLE: return (deriv(amount-from_vertex)*(-0.5)).angle();
+ case ValueBase::TYPE_VECTOR: return deriv(amount-from_vertex)*(-0.5);
+ default: assert(0); return ValueBase();
+ }
#endif
}
#endif
}
@@
-219,5
+236,6
@@
ValueNode_BLineCalcTangent::get_link_index_from_name(const String &name)const
bool
ValueNode_BLineCalcTangent::check_type(ValueBase::Type type)
{
bool
ValueNode_BLineCalcTangent::check_type(ValueBase::Type type)
{
- return type==ValueBase::TYPE_VECTOR;
+ return (type==ValueBase::TYPE_ANGLE ||
+ type==ValueBase::TYPE_VECTOR);
}
}