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"
34 #include "layer_pastecanvas.h"
41 /* === U S I N G =========================================================== */
45 using namespace synfig;
47 /* === M A C R O S ========================================================= */
49 /* === G L O B A L S ======================================================= */
51 /* === P R O C E D U R E S ================================================= */
53 /* === M E T H O D S ======================================================= */
57 synfig::waypoint_collect(set<Waypoint, std::less<UniqueID> >& waypoint_set,const Time& time, const etl::handle<Node>& node)
59 const TimePointSet& timepoint_set(node->get_times());
61 // Check to see if there is anything in here at the given time
62 if(timepoint_set.find(time)==timepoint_set.end())
65 // Check if we are a linkable value node
66 LinkableValueNode::Handle linkable_value_node;
67 linkable_value_node=linkable_value_node.cast_dynamic(node);
68 if(linkable_value_node)
70 const int link_count(linkable_value_node->link_count());
72 for(i=0;i<link_count;i++)
74 ret+=waypoint_collect(waypoint_set,time,linkable_value_node->get_link(i).get());
79 // Check if we are a layer
81 layer=layer.cast_dynamic(node);
84 const Layer::DynamicParamList& dyn_param_list(layer->dynamic_param_list());
85 Layer::DynamicParamList::const_iterator iter;
87 for(iter=dyn_param_list.begin();iter!=dyn_param_list.end();++iter)
89 ret+=waypoint_collect(waypoint_set,time,iter->second);
91 ValueBase canvas_value(layer->get_param("canvas"));
92 if(canvas_value.get_type()==ValueBase::TYPE_CANVAS)
94 etl::handle<Layer_PasteCanvas> p = etl::handle<Layer_PasteCanvas>::cast_dynamic(layer);
96 ret+=waypoint_collect(waypoint_set, time + p->get_time_offset(),
97 Canvas::Handle(canvas_value.get(Canvas::Handle())));
99 ret+=waypoint_collect(waypoint_set, time,
100 Canvas::Handle(canvas_value.get(Canvas::Handle())));
105 // Check if we are a canvas
106 Canvas::Handle canvas;
107 canvas=canvas.cast_dynamic(node);
110 Canvas::const_iterator iter;
112 for(iter=canvas->begin();iter!=canvas->end();++iter)
113 ret+=waypoint_collect(waypoint_set,time,*iter);
117 // Check if we are an animated value node
118 ValueNode_Animated::Handle value_node_animated;
119 value_node_animated=value_node_animated.cast_dynamic(node);
120 if(value_node_animated)
123 Waypoint waypoint=*value_node_animated->find(time);
125 // If it is already in the waypoint set, then
126 // don't bother adding it again
127 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())