1 /* === S Y N F I G ========================================================= */
2 /*! \file timepointcollect.cpp
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 ======================================================= */
32 #include "timepointcollect.h"
33 #include "valuenode_animated.h"
40 /* === U S I N G =========================================================== */
44 using namespace synfig;
46 /* === M A C R O S ========================================================= */
48 /* === G L O B A L S ======================================================= */
50 /* === P R O C E D U R E S ================================================= */
52 /* === M E T H O D S ======================================================= */
56 synfig::waypoint_collect(set<Waypoint, std::less<UniqueID> >& waypoint_set,const Time& time, const etl::handle<Node>& node)
58 const TimePointSet& timepoint_set(node->get_times());
60 // Check to see if there is anything in here at the given time
61 if(timepoint_set.find(time)==timepoint_set.end())
64 // Check if we are a linkable value node
65 LinkableValueNode::Handle linkable_value_node;
66 linkable_value_node=linkable_value_node.cast_dynamic(node);
67 if(linkable_value_node)
69 const int link_count(linkable_value_node->link_count());
71 for(i=0;i<link_count;i++)
73 ret+=waypoint_collect(waypoint_set,time,linkable_value_node->get_link(i).get());
78 // Check if we are a layer
80 layer=layer.cast_dynamic(node);
83 const Layer::DynamicParamList& dyn_param_list(layer->dynamic_param_list());
84 Layer::DynamicParamList::const_iterator iter;
86 for(iter=dyn_param_list.begin();iter!=dyn_param_list.end();++iter)
88 ret+=waypoint_collect(waypoint_set,time,iter->second);
90 ValueBase canvas_value(layer->get_param("canvas"));
91 if(canvas_value.get_type()==ValueBase::TYPE_CANVAS)
93 ret+=waypoint_collect(waypoint_set,time,Canvas::Handle(canvas_value.get(Canvas::Handle())));
98 // Check if we are a canvas
99 Canvas::Handle canvas;
100 canvas=canvas.cast_dynamic(node);
103 Canvas::const_iterator iter;
105 for(iter=canvas->begin();iter!=canvas->end();++iter)
106 ret+=waypoint_collect(waypoint_set,time,*iter);
110 // Check if we are an animated value node
111 ValueNode_Animated::Handle value_node_animated;
112 value_node_animated=value_node_animated.cast_dynamic(node);
113 if(value_node_animated)
116 Waypoint waypoint=*value_node_animated->find(time);
118 // If it is already in the waypoint set, then
119 // don't bother adding it again
120 if(waypoint_set.find(waypoint)!=waypoint_set.end())
124 waypoint_set.insert(waypoint);
137 synfig::activepoint_collect(set<Activepoint, std::less<UniqueID> >& activepoint_set,const Time& time, const etl::handle<Node>& node)
139 const TimePointSet& timepoint_set(node->get_times());
141 // Check to see if there is anything in here at the given time
142 if(timepoint_set.find(time)==timepoint_set.end());