**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
ACTION_INIT(Action::WaypointSetSmart);
ACTION_SET_NAME(Action::WaypointSetSmart,"waypoint_set_smart");
ACTION_INIT(Action::WaypointSetSmart);
ACTION_SET_NAME(Action::WaypointSetSmart,"waypoint_set_smart");
ACTION_SET_TASK(Action::WaypointSetSmart,"set");
ACTION_SET_CATEGORY(Action::WaypointSetSmart,Action::CATEGORY_WAYPOINT|Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
ACTION_SET_PRIORITY(Action::WaypointSetSmart,0);
ACTION_SET_VERSION(Action::WaypointSetSmart,"0.0");
ACTION_SET_CVS_ID(Action::WaypointSetSmart,"$Id$");
ACTION_SET_TASK(Action::WaypointSetSmart,"set");
ACTION_SET_CATEGORY(Action::WaypointSetSmart,Action::CATEGORY_WAYPOINT|Action::CATEGORY_VALUEDESC|Action::CATEGORY_VALUENODE);
ACTION_SET_PRIORITY(Action::WaypointSetSmart,0);
ACTION_SET_VERSION(Action::WaypointSetSmart,"0.0");
ACTION_SET_CVS_ID(Action::WaypointSetSmart,"$Id$");
/* === G L O B A L S ======================================================= */
/* === P R O C E D U R E S ================================================= */
/* === G L O B A L S ======================================================= */
/* === P R O C E D U R E S ================================================= */
- if(candidate_check(get_param_vocab(),x))
- {
- if(!ValueNode_Animated::Handle::cast_dynamic(x.find("value_node")->second.get_value_node()))
- return false;
- // We need either a waypoint or a time.
- if(x.count("waypoint") || x.count("time"))
- return true;
- return false;
- }
- return false;
+ return (candidate_check(get_param_vocab(),x) &&
+ // We need an animated valuenode.
+ ValueNode_Animated::Handle::cast_dynamic(x.find("value_node")->second.get_value_node()) &&
+ // We need either a waypoint or a time.
+ (x.count("waypoint") || x.count("time")));
if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
{
value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node());
if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
{
value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node());
if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT && !time_set)
{
waypoint=param.get_waypoint();
if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT && !time_set)
{
waypoint=param.get_waypoint();
try {
times.insert(value_node->find(waypoint)->get_time());
// synfig::info(__FILE__":%d: value_node->find(waypoint)->get_time()=%s",__LINE__,value_node->find(waypoint)->get_time().get_string().c_str());
try {
times.insert(value_node->find(waypoint)->get_time());
// synfig::info(__FILE__":%d: value_node->find(waypoint)->get_time()=%s",__LINE__,value_node->find(waypoint)->get_time().get_string().c_str());
// synfig::info(__FILE__":%d: prev_keyframe->time=%s",__LINE__,keyframe.get_time().get_string().c_str());
// synfig::info(__FILE__":%d: waypoint->time=%s",__LINE__,waypoint.get_time().get_string().c_str());
// synfig::info(__FILE__":%d: prev_keyframe->time=%s",__LINE__,keyframe.get_time().get_string().c_str());
// synfig::info(__FILE__":%d: waypoint->time=%s",__LINE__,waypoint.get_time().get_string().c_str());
// Try to find next keyframe
//synfig::info("FUTURE waypoint.get_time()=%s",waypoint.get_time().get_string().c_str());
Keyframe keyframe(*get_canvas()->keyframe_list().find_next(curr_time));
//synfig::info("FUTURE keyframe.get_time()=%s",keyframe.get_time().get_string().c_str());
curr_time=keyframe.get_time();
// Try to find next keyframe
//synfig::info("FUTURE waypoint.get_time()=%s",waypoint.get_time().get_string().c_str());
Keyframe keyframe(*get_canvas()->keyframe_list().find_next(curr_time));
//synfig::info("FUTURE keyframe.get_time()=%s",keyframe.get_time().get_string().c_str());
curr_time=keyframe.get_time();
if(times.count(keyframe.get_time())|| waypoint.get_time().is_equal(keyframe.get_time()))
throw int();
else
times.insert(keyframe.get_time());
if(times.count(keyframe.get_time())|| waypoint.get_time().is_equal(keyframe.get_time()))
throw int();
else
times.insert(keyframe.get_time());
// maintain the integrity of the keyframes.
enclose_waypoint(waypoint);
try
{
//synfig::info("WaypointSetSmart: Move/Update?");
// maintain the integrity of the keyframes.
enclose_waypoint(waypoint);
try
{
//synfig::info("WaypointSetSmart: Move/Update?");
WaypointList::iterator iter(value_node->find(waypoint));
if(iter == value_node->waypoint_list().end())
WaypointList::iterator iter(value_node->find(waypoint));
if(iter == value_node->waypoint_list().end())
// Check to see if a waypoint exists at this point in time
WaypointList::iterator iter=value_node->find(waypoint.get_time());
// Check to see if a waypoint exists at this point in time
WaypointList::iterator iter=value_node->find(waypoint.get_time());
// At this point we know that the old waypoint doesn't exist,
// so we need to create it.
Action::Handle action(WaypointAdd::create());
// At this point we know that the old waypoint doesn't exist,
// so we need to create it.
Action::Handle action(WaypointAdd::create());