void Action::TimepointsMove::prepare() { clear(); //synfig::info("Preparing TimepointsMove by %f secs",(float)timemove); if(sel_times.empty()) return; //all our lists should be set correctly... /*{ std::set<synfig::Time>::iterator i = sel_times.begin(), end = sel_times.end(); for(; i != end; ++i) { synfig::info("Time %f", (float)*i); } }*/ //build our sub-action list // and yes we do need to store it temporarily so we don't duplicate // an operation on a specific valuenode, etc.... timepoints_ref match; Time fps = get_canvas()->rend_desc().get_frame_rate(); //std::vector<synfig::Layer::Handle> //synfig::info("Layers %d", sel_layers.size()); { std::vector<synfig::Layer::Handle>::iterator i = sel_layers.begin(), end = sel_layers.end(); for(; i != end; ++i) { //synfig::info("Recurse through a layer"); recurse_layer(*i,sel_times,match); } } //std::vector<synfig::Canvas::Handle> sel_canvases; //synfig::info("Canvases %d", sel_canvases.size()); { std::vector<synfig::Canvas::Handle>::iterator i = sel_canvases.begin(), end = sel_canvases.end(); for(; i != end; ++i) { //synfig::info("Recurse through a canvas"); recurse_canvas(*i,sel_times,match); } } //std::vector<synfigapp::ValueDesc> //synfig::info("ValueBasedescs %d", sel_values.size()); { std::vector<synfigapp::ValueDesc>::iterator i = sel_values.begin(), end = sel_values.end(); for(; i != end; ++i) { //synfig::info("Recurse through a valuedesc"); recurse_valuedesc(*i,sel_times,match); } } //synfig::info("built list of waypoints/activepoints to modify"); //synfig::info("\t There are %d waypoint sets and %d activepointsets", // match.waypointbiglist.size(), match.actpointbiglist.size()); //process them... { //must build from both lists timepoints_ref::waytracker::const_iterator i = match.waypointbiglist.begin(), end = match.waypointbiglist.end(); for(; i != end; ++i) { Action::Handle action(WaypointSet::create()); action->set_param("canvas",get_canvas()); action->set_param("canvas_interface",get_canvas_interface()); action->set_param("value_node",ValueNode::Handle(i->val)); synfig::Time dilated_timemove(timemove * i->time_dilation); //iterate through each waypoint for this specific valuenode std::set<synfig::Waypoint>::const_iterator j = i->waypoints.begin(), end = i->waypoints.end(); for(; j != end; ++j) { //synfig::info("add waypoint mod..."); //NOTE: We may want to store the old time for undoing the action... Waypoint w = *j; w.set_time((w.get_time() + dilated_timemove).round(fps)); action->set_param("waypoint",w); } //run the action now that we've added everything assert(action->is_ready()); if(!action->is_ready()) throw Error(Error::TYPE_NOTREADY); add_action_front(action); } } { //must build from both lists timepoints_ref::acttracker::const_iterator i = match.actpointbiglist.begin(), end = match.actpointbiglist.end(); for(; i != end; ++i) { Action::Handle action(ActivepointSet::create()); action->set_param("canvas",get_canvas()); action->set_param("canvas_interface",get_canvas_interface()); action->set_param("value_desc",i->val); synfig::Time dilated_timemove(timemove * i->time_dilation); //iterate through each activepoint for this specific valuenode std::set<synfig::Activepoint>::const_iterator j = i->activepoints.begin(), jend = i->activepoints.end(); for(; j != jend; ++j) { //synfig::info("add activepoint mod..."); //NOTE: We may want to store the old time for undoing the action... Activepoint a = *j; a.set_time((a.get_time() + dilated_timemove).round(fps)); action->set_param("activepoint",a); } assert(action->is_ready()); if(!action->is_ready()) { throw Error(Error::TYPE_NOTREADY); } add_action_front(action); } } }
bool operator()(const Activepoint &rhs) const { return t.is_equal(rhs.get_time()); }