1 /* === S Y N F I G ========================================================= */
3 ** \brief Template File
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
10 ** This package is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU General Public License as
12 ** published by the Free Software Foundation; either version 2 of
13 ** the License, or (at your option) any later version.
15 ** This package is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** General Public License for more details.
21 /* ========================================================================= */
23 /* === H E A D E R S ======================================================= */
33 #include "valuenode_const.h"
37 /* === U S I N G =========================================================== */
41 using namespace synfig;
43 /* === M A C R O S ========================================================= */
45 /* === G L O B A L S ======================================================= */
47 /* === P R O C E D U R E S ================================================= */
49 /* === M E T H O D S ======================================================= */
51 Waypoint::Waypoint(ValueBase value, Time time):
53 before(INTERPOLATION_TCB),
54 after(INTERPOLATION_TCB),
55 value_node(ValueNode_Const::create(value)),
63 if(value.get_type()==ValueBase::TYPE_ANGLE)
64 after=before=INTERPOLATION_LINEAR;
67 Waypoint::Waypoint(etl::handle<ValueNode> value_node, Time time):
69 before(INTERPOLATION_TCB),
70 after(INTERPOLATION_TCB),
71 value_node(value_node),
78 if(value_node->get_type()==ValueBase::TYPE_ANGLE)
79 after=before=INTERPOLATION_LINEAR;
84 before(INTERPOLATION_TCB),
85 after(INTERPOLATION_TCB),
94 Waypoint::set_value(const ValueBase &x)
96 //! If the value node is not set and we are seting the value
97 //! of an angle, then set both interpolation to linear... why?
98 if(!value_node && x.get_type()==ValueBase::TYPE_ANGLE)
99 after=before=INTERPOLATION_LINEAR;
101 value_node=ValueNode_Const::create(x);
105 Waypoint::set_value_node(const etl::handle<ValueNode> &x)
107 //! If the value node is not set and we are seting the value
108 //! of an angle, then set both interpolation to linear... why?
109 if(!value_node && x->get_type()==ValueBase::TYPE_ANGLE)
110 after=before=INTERPOLATION_LINEAR;
116 Waypoint::is_static()const
118 return static_cast<bool>(ValueNode_Const::Handle::cast_dynamic(value_node)) && value_node && !value_node->is_exported();
122 Waypoint::set_time(const Time &x)
128 Waypoint::apply_model(const Model &x)
130 if(x.priority_flag) set_priority(x.get_priority());
131 if(x.before_flag) set_before(x.get_before());
132 if(x.after_flag) set_after(x.get_after());
133 if(x.tension_flag) set_tension(x.get_tension());
134 if(x.continuity_flag) set_continuity(x.get_continuity());
135 if(x.bias_flag) set_bias(x.get_bias());
136 if(x.temporal_tension_flag) set_temporal_tension(x.get_temporal_tension());
140 Waypoint::clone(const GUID& deriv_guid)const
144 if(!ret.value_node->is_exported())
145 ret.value_node=value_node->clone(deriv_guid);
151 Waypoint::get_value()const { return (*value_node)(0); }
154 Waypoint::get_value(const Time &t)const { return (*value_node)(t); }
157 Waypoint::get_guid()const
159 return GUID::hasher(get_uid());