void synfigapp::recurse_layer(synfig::Layer::Handle h, const std::set<Time> &tlist, timepoints_ref &vals, synfig::Time time_offset, synfig::Real time_dilation) { // iterate through the layers //check for special case of paste canvas etl::handle<synfig::Layer_PasteCanvas> p = etl::handle<synfig::Layer_PasteCanvas>::cast_dynamic(h); //synfig::info("Layer..."); if(p) { //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::Real subcanvas_time_dilation(p->get_time_dilation()); synfig::Time subcanvas_time_offset(time_offset * subcanvas_time_dilation + p->get_time_offset()); subcanvas_time_dilation *= time_dilation; if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end(),subcanvas_time_offset,subcanvas_time_dilation)) recurse_canvas(p->get_sub_canvas(),tlist,vals,subcanvas_time_offset,subcanvas_time_dilation); } //check all the valuenodes regardless... //synfig::info("Recurse all valuenodes"); synfig::Layer::DynamicParamList::const_iterator i = h->dynamic_param_list().begin(), end = h->dynamic_param_list().end(); for(; i != end; ++i) { const synfig::Node::time_set &tset = i->second->get_times(); if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end(),time_offset,time_dilation)) { recurse_valuedesc(ValueDesc(h,i->first),tlist,vals,time_offset,time_dilation); } } }
void Action::LayerDuplicate::export_dup_nodes(synfig::Layer::Handle layer, Canvas::Handle canvas, int &index) { // automatically export the Index parameter of Duplicate layers when duplicating if (layer->get_name() == "duplicate") while (true) { String name = strprintf(_("Index %d"), index++); try { canvas->find_value_node(name, true); } catch (Exception::IDNotFound x) { Action::Handle action(Action::create("ValueNodeAdd")); action->set_param("canvas",canvas); action->set_param("canvas_interface",get_canvas_interface()); action->set_param("new",layer->dynamic_param_list().find("index")->second); action->set_param("name",name); add_action_front(action); break; } } else { Layer::ParamList param_list(layer->get_param_list()); for (Layer::ParamList::const_iterator iter(param_list.begin()) ; iter != param_list.end() ; iter++) if (layer->dynamic_param_list().count(iter->first)==0 && iter->second.get_type()==type_canvas) { Canvas::Handle subcanvas(iter->second.get(Canvas::Handle())); if (subcanvas && subcanvas->is_inline()) for (IndependentContext iter = subcanvas->get_independent_context(); iter != subcanvas->end(); iter++) export_dup_nodes(*iter, canvas, index); } for (Layer::DynamicParamList::const_iterator iter(layer->dynamic_param_list().begin()) ; iter != layer->dynamic_param_list().end() ; iter++) if (iter->second->get_type()==type_canvas) { Canvas::Handle canvas((*iter->second)(0).get(Canvas::Handle())); if (canvas->is_inline()) //! \todo do we need to implement this? and if so, shouldn't we check all canvases, not just the one at t=0s? warning("%s:%d not yet implemented - do we need to export duplicate valuenodes in dynamic canvas parameters?", __FILE__, __LINE__); } } }