1 /* === S Y N F I G ========================================================= */
3 ** \brief Time Gather Header
5 ** $Id: timegather.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
8 ** Copyright (c) 2004 Adrian Bentley
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === S T A R T =========================================================== */
24 #ifndef __SYNFIG_TIMEGATHER_H
25 #define __SYNFIG_TIMEGATHER_H
27 /* === H E A D E R S ======================================================= */
28 #include <synfig/valuenode_animated.h>
29 #include <synfig/valuenode_dynamiclist.h>
30 #include <synfig/time.h>
31 #include "value_desc.h"
33 /* === M A C R O S ========================================================= */
35 /* === T Y P E D E F S ===================================================== */
37 /* === C L A S S E S & S T R U C T S ======================================= */
44 struct ValueBaseTimeInfo
46 synfig::ValueNode_Animated::Handle val;
47 mutable std::set<synfig::Waypoint> waypoints;
49 bool operator<(const ValueBaseTimeInfo &rhs) const
59 bool operator()(const synfig::Activepoint &lhs, const synfig::Activepoint &rhs) const
61 return lhs.time < rhs.time;
65 synfigapp::ValueDesc val;
67 typedef std::set<synfig::Activepoint,actcmp> set;
69 mutable set activepoints;
71 bool operator<(const ActiveTimeInfo &rhs) const
73 return val.get_parent_value_node() == rhs.val.get_parent_value_node() ?
74 val.get_index() < rhs.val.get_index() :
75 val.get_parent_value_node() < rhs.val.get_parent_value_node();
81 typedef std::set<ValueBaseTimeInfo> waytracker;
82 typedef std::set<ActiveTimeInfo> acttracker;
84 waytracker waypointbiglist;
85 acttracker actpointbiglist;
87 void insert(synfig::ValueNode_Animated::Handle v, synfig::Waypoint w);
88 void insert(synfigapp::ValueDesc v, synfig::Activepoint a);
91 //assumes they're sorted... (incremental advance)
92 //checks the intersection of the two sets... might be something better in the stl
93 template < typename I1, typename I2 >
94 bool check_intersect(I1 b1, I1 end1, I2 b2, I2 end2)
96 if(b1 == end1 || b2 == end2)
99 for(; b1 != end1 && b2 != end2;)
102 else if(*b2 < *b1) ++b2;
112 //pointer kind of a hack, gets the accurate times from a value desc
113 // (deals with dynamic list member correctly... i.e. gathers activepoints)
114 const synfig::Node::time_set *get_times_from_vdesc(const synfigapp::ValueDesc &v);
116 //get's the closest time inside the set
117 bool get_closest_time(const synfig::Node::time_set &tset, const synfig::Time &t,
118 const synfig::Time &range, synfig::Time &out);
120 //recursion functions based on time restrictions (can be expanded later)...
121 //builds a list of relevant waypoints and activepoints inside the timepoints_ref structure
122 void recurse_valuedesc(synfigapp::ValueDesc valdesc, const std::set<synfig::Time> &tlist,
123 timepoints_ref &vals);
124 void recurse_layer(synfig::Layer::Handle layer, const std::set<synfig::Time> &tlist,
125 timepoints_ref &vals);
126 void recurse_canvas(synfig::Canvas::Handle canvas, const std::set<synfig::Time> &tlist,
127 timepoints_ref &vals);
131 }; // END of namespace studio
133 /* === E N D =============================================================== */