#include <synfig/layer_pastecanvas.h>
+#include "general.h"
+
#endif
/* === U S I N G =========================================================== */
//recursion functions
void synfigapp::recurse_canvas(synfig::Canvas::Handle h, const std::set<Time> &tlist,
- timepoints_ref &vals)
+ timepoints_ref &vals, synfig::Time time_offset)
{
//synfig::info("Canvas...\n Recurse through layers");
for(; i != end; ++i)
{
const Node::time_set &tset = (*i)->get_times();
- if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end()))
+ if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end(),time_offset))
{
- recurse_layer(*i,tlist,vals);
+ recurse_layer(*i,tlist,vals,time_offset);
}
}
}
void synfigapp::recurse_layer(synfig::Layer::Handle h, const std::set<Time> &tlist,
- timepoints_ref &vals)
+ timepoints_ref &vals, synfig::Time time_offset)
{
// iterate through the layers
//check for special case of paste canvas
//synfig::info("We are a paste canvas so go into that");
//recurse into the canvas
const synfig::Node::time_set &tset = p->get_sub_canvas()->get_times();
+ synfig::Time subcanvas_time_offset(time_offset + p->get_time_offset());
- if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end()))
- {
- //we have to offset the times so it won't wreck havoc if the canvas is imported more than once...
- // and so we get correct results when offsets are present
- std::set<Time> tlistoff;
- std::set<Time>::iterator i = tlist.begin(), end = tlist.end();
- for(; i != end; ++i)
- {
- tlistoff.insert(*i - p->get_time_offset());
- }
-
- recurse_canvas(p->get_sub_canvas(),tlist,vals);
- }
+ if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end(),subcanvas_time_offset))
+ recurse_canvas(p->get_sub_canvas(),tlist,vals,subcanvas_time_offset);
}
//check all the valuenodes regardless...
{
const synfig::Node::time_set &tset = i->second->get_times();
- if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end()))
+ if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end(),time_offset))
{
- recurse_valuedesc(ValueDesc(h,i->first),tlist,vals);
+ recurse_valuedesc(ValueDesc(h,i->first),tlist,vals,time_offset);
}
}
}
}
void synfigapp::recurse_valuedesc(synfigapp::ValueDesc h, const std::set<Time> &tlist,
- timepoints_ref &vals)
+ timepoints_ref &vals, synfig::Time time_offset)
{
//special cases for Animated, DynamicList, and Linkable
{
//synfig::info("tpair t(%.3f) = %.3f", (float)*j, (float)(i->get_time()));
- if(j->is_equal(i->get_time()))
+ if((*j+time_offset).is_equal(i->get_time()))
{
vals.insert(p,*i);
++i,++j;
- }else if(*i < *j)
+ }else if(*i < *j+time_offset)
{
++i;
}else ++j;
for(; j != jend && i != end;)
{
- double it = *i;
+ double it = *i+time_offset;
double jt = j->get_time();
double diff = (double)(it - jt);
{
const Node::time_set &tset = i->get_times();
- if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end()))
+ if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end(),time_offset))
{
- recurse_valuedesc(ValueDesc(p,index),tlist,vals);
+ recurse_valuedesc(ValueDesc(p,index),tlist,vals,time_offset);
}
}
return;
ValueNode::Handle v = p->get_link(i);
const Node::time_set &tset = v->get_times();
- if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end()))
+ if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end(),time_offset))
{
- recurse_valuedesc(ValueDesc(p,i),tlist,vals);
+ recurse_valuedesc(ValueDesc(p,i),tlist,vals,time_offset);
}
}
}