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
9 ** Copyright (c) 2007 Chris Moore
11 ** This package is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU General Public License as
13 ** published by the Free Software Foundation; either version 2 of
14 ** the License, or (at your option) any later version.
16 ** This package is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ** General Public License for more details.
22 /* ========================================================================= */
24 /* === H E A D E R S ======================================================= */
33 #include "timepointcollect.h"
34 #include "valuenode_animated.h"
35 #include "layer_pastecanvas.h"
42 /* === U S I N G =========================================================== */
46 using namespace synfig;
48 /* === M A C R O S ========================================================= */
50 /* === G L O B A L S ======================================================= */
52 /* === P R O C E D U R E S ================================================= */
54 /* === M E T H O D S ======================================================= */
58 synfig::waypoint_collect(set<Waypoint, std::less<UniqueID> > &waypoint_set,
60 const etl::handle<Node> &node)
62 const TimePointSet& timepoint_set(node->get_times());
64 // Check to see if there is anything in here at the given time
65 if(timepoint_set.find(time)==timepoint_set.end())
68 // Check if we are a linkable value node
69 LinkableValueNode::Handle linkable_value_node;
70 linkable_value_node=linkable_value_node.cast_dynamic(node);
71 if(linkable_value_node)
73 const int link_count(linkable_value_node->link_count());
75 for(i=0;i<link_count;i++)
76 ret+=waypoint_collect(waypoint_set,time,linkable_value_node->get_link(i).get());
81 // Check if we are a layer
83 layer=layer.cast_dynamic(node);
86 const Layer::DynamicParamList& dyn_param_list(layer->dynamic_param_list());
87 Layer::DynamicParamList::const_iterator iter;
89 for(iter=dyn_param_list.begin();iter!=dyn_param_list.end();++iter)
90 ret+=waypoint_collect(waypoint_set,time,iter->second);
92 ValueBase canvas_value(layer->get_param("canvas"));
93 if(canvas_value.get_type()==ValueBase::TYPE_CANVAS)
95 etl::handle<Layer_PasteCanvas> p = etl::handle<Layer_PasteCanvas>::cast_dynamic(layer);
97 ret+=waypoint_collect(waypoint_set, time + p->get_time_offset(),
98 Canvas::Handle(canvas_value.get(Canvas::Handle())));
100 ret+=waypoint_collect(waypoint_set, time,
101 Canvas::Handle(canvas_value.get(Canvas::Handle())));
106 // Check if we are a canvas
107 Canvas::Handle canvas;
108 canvas=canvas.cast_dynamic(node);
111 Canvas::const_iterator iter;
113 for(iter=canvas->begin();iter!=canvas->end();++iter)
114 ret+=waypoint_collect(waypoint_set,time,*iter);
118 // Check if we are an animated value node
119 ValueNode_Animated::Handle value_node_animated;
120 value_node_animated=value_node_animated.cast_dynamic(node);
121 if(value_node_animated)
124 Waypoint waypoint=*value_node_animated->find(time);
126 // If it is already in the waypoint set, then
127 // don't bother adding it again
128 if(waypoint_set.find(waypoint)!=waypoint_set.end())
131 waypoint_set.insert(waypoint);
144 synfig::activepoint_collect(set<Activepoint, std::less<UniqueID> >& /*activepoint_set*/,const Time& time, const etl::handle<Node>& node)
146 const TimePointSet& timepoint_set(node->get_times());
148 // Check to see if there is anything in here at the given time
149 if(timepoint_set.find(time)==timepoint_set.end())