Activepoint ValueNode_DynamicList::ListEntry::new_activepoint_at_time(const Time& time)const { Activepoint activepoint; activepoint.set_state(status_at_time(time)); activepoint.set_priority(0); return activepoint; }
void Action::KeyframeSet::process_value_desc(const synfigapp::ValueDesc& value_desc) { if(value_desc.is_value_node()) { ValueNode::Handle value_node(value_desc.get_value_node()); //if(guid_set.count(value_node->get_guid())) // return; //guid_set.insert(value_node->get_guid()); // If we are a dynamic list, then we need to update the ActivePoints if(ValueNode_DynamicList::Handle::cast_dynamic(value_node)) { ValueNode_DynamicList::Handle value_node_dynamic(ValueNode_DynamicList::Handle::cast_dynamic(value_node)); int i; for(i=0;i<value_node_dynamic->link_count();i++) { synfigapp::ValueDesc value_desc(value_node_dynamic,i); if(new_time>keyframe_prev && new_time<keyframe_next) { // In this circumstance, we need to adjust any // activepoints between the previous and next // keyframes scale_activepoints(value_desc,keyframe_prev,old_time,keyframe_prev,new_time); scale_activepoints(value_desc,old_time,keyframe_next,new_time,keyframe_next); } //else { Action::Handle action(ActivepointSetSmart::create()); action->set_param("canvas",get_canvas()); action->set_param("canvas_interface",get_canvas_interface()); action->set_param("value_desc",value_desc); Activepoint activepoint; try { activepoint=*value_node_dynamic->list[i].find(old_time); activepoint.set_time(new_time); } catch(...) { activepoint.set_time(new_time); activepoint.set_state(value_node_dynamic->list[i].status_at_time(old_time)); activepoint.set_priority(0); } action->set_param("activepoint",activepoint); assert(action->is_ready()); if(!action->is_ready()) throw Error(Error::TYPE_NOTREADY); add_action_front(action); } } } else if(ValueNode_Animated::Handle::cast_dynamic(value_node)) { if(new_time>keyframe_prev && new_time<keyframe_next) { // In this circumstance, we need to adjust any // waypoints between the previous and next // keyframes scale_waypoints(value_desc,keyframe_prev,old_time,keyframe_prev,new_time); scale_waypoints(value_desc,old_time,keyframe_next,new_time,keyframe_next); } //else { ValueNode_Animated::Handle value_node_animated(ValueNode_Animated::Handle::cast_dynamic(value_node)); Action::Handle action(WaypointSetSmart::create()); action->set_param("canvas",get_canvas()); action->set_param("canvas_interface",get_canvas_interface()); action->set_param("value_node",ValueNode::Handle(value_node_animated)); Waypoint waypoint; try { waypoint=*value_node_animated->find(old_time); waypoint.set_time(new_time); } catch(...) { waypoint.set_time(new_time); waypoint.set_value((*value_node_animated)(old_time)); waypoint.set_before(synfigapp::Main::get_interpolation()); waypoint.set_after(synfigapp::Main::get_interpolation()); } action->set_param("waypoint",waypoint); assert(action->is_ready()); if(!action->is_ready()) throw Error(Error::TYPE_NOTREADY); add_action_front(action); } } } }