X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftags%2Fstable%2Fsrc%2Fsynfigapp%2Factions%2Fwaypointsetsmart.cpp;h=23a0ea2afea85094043fb99e9d33bf9a4f368dbe;hb=47fce282611fbba1044921d22ca887f9b53ad91a;hp=ffaa8e9bbb3251610d56136274aaf4e6137dbf85;hpb=f6184c2a9c2245aae802c31c8f3300e1b744359c;p=synfig.git diff --git a/synfig-studio/tags/stable/src/synfigapp/actions/waypointsetsmart.cpp b/synfig-studio/tags/stable/src/synfigapp/actions/waypointsetsmart.cpp index ffaa8e9..23a0ea2 100644 --- a/synfig-studio/tags/stable/src/synfigapp/actions/waypointsetsmart.cpp +++ b/synfig-studio/tags/stable/src/synfigapp/actions/waypointsetsmart.cpp @@ -6,6 +6,7 @@ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -41,6 +42,8 @@ #include #include +#include + #endif using namespace std; @@ -53,19 +56,13 @@ using namespace Action; ACTION_INIT(Action::WaypointSetSmart); ACTION_SET_NAME(Action::WaypointSetSmart,"waypoint_set_smart"); -ACTION_SET_LOCAL_NAME(Action::WaypointSetSmart,"Connect"); +ACTION_SET_LOCAL_NAME(Action::WaypointSetSmart,N_("Add Waypoint")); 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$"); - -/*#ifdef DEBUGPOINT -#undef DEBUGPOINT -#endif -#define DEBUGPOINT() -*/ /* === G L O B A L S ======================================================= */ /* === P R O C E D U R E S ================================================= */ @@ -111,16 +108,11 @@ Action::WaypointSetSmart::get_param_vocab() bool Action::WaypointSetSmart::is_candidate(const ParamList &x) { - 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"))); } bool @@ -129,7 +121,6 @@ Action::WaypointSetSmart::set_param(const synfig::String& name, const Action::Pa if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE) { value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node()); - DEBUGPOINT(); if(time_set) calc_waypoint(); @@ -138,7 +129,6 @@ Action::WaypointSetSmart::set_param(const synfig::String& name, const Action::Pa if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT && !time_set) { waypoint=param.get_waypoint(); - DEBUGPOINT(); return true; } @@ -150,7 +140,6 @@ Action::WaypointSetSmart::set_param(const synfig::String& name, const Action::Pa if(value_node) calc_waypoint(); - DEBUGPOINT(); return true; } @@ -188,7 +177,6 @@ Action::WaypointSetSmart::is_ready()const void Action::WaypointSetSmart::calc_waypoint() { - DEBUGPOINT(); Time time=waypoint.get_time(); try { @@ -235,11 +223,9 @@ Action::WaypointSetSmart::enclose_waypoint(const synfig::Waypoint& 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()); -// DEBUGPOINT(); }catch (...) { } -// DEBUGPOINT(); - // First we need to to add any waypoints necessary to + // First we need to add any waypoints necessary to // maintain the integrity of the keyframes. if(get_edit_mode()&MODE_ANIMATE_PAST) try { @@ -254,20 +240,16 @@ Action::WaypointSetSmart::enclose_waypoint(const synfig::Waypoint& waypoint) // 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()); -// DEBUGPOINT(); if(times.count(keyframe.get_time())) { -// DEBUGPOINT(); throw int(); } if(waypoint.get_time().is_equal(keyframe.get_time())) { -// DEBUGPOINT(); throw int(); } times.insert(keyframe.get_time()); -// DEBUGPOINT(); try { value_node->find(keyframe.get_time()); @@ -303,12 +285,10 @@ Action::WaypointSetSmart::enclose_waypoint(const synfig::Waypoint& waypoint) } } catch(Error x) { throw x; } - catch(synfig::Exception::NotFound) { DEBUGPOINT(); } - catch(int) { DEBUGPOINT(); } - catch(...) { DEBUGPOINT(); } - //DEBUGPOINT(); + catch(synfig::Exception::NotFound) { } + catch(int) { } + catch(...) { } - //DEBUGPOINT(); if(get_edit_mode()&MODE_ANIMATE_FUTURE)try { Time curr_time(waypoint.get_time()); @@ -316,19 +296,16 @@ Action::WaypointSetSmart::enclose_waypoint(const synfig::Waypoint& waypoint) //while(value_node->waypoint_list().back().get_time()>=curr_time) { - //DEBUGPOINT(); // 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(); - //DEBUGPOINT(); if(times.count(keyframe.get_time())|| waypoint.get_time().is_equal(keyframe.get_time())) throw int(); else times.insert(keyframe.get_time()); - //DEBUGPOINT(); try { @@ -365,30 +342,27 @@ Action::WaypointSetSmart::enclose_waypoint(const synfig::Waypoint& waypoint) add_action(action); } } - //DEBUGPOINT(); } catch(Error x) { throw x; } - catch(synfig::Exception::NotFound) { DEBUGPOINT(); } - catch(int) { DEBUGPOINT(); } - catch(...) { DEBUGPOINT(); } - //DEBUGPOINT(); + catch(synfig::Exception::NotFound) { } + catch(int) { } + catch(...) { } } void Action::WaypointSetSmart::prepare() { - //DEBUGPOINT(); clear(); times.clear(); - // First we need to to add any waypoints necessary to + // First we need to add any waypoints necessary to // maintain the integrity of the keyframes. enclose_waypoint(waypoint); try { //synfig::info("WaypointSetSmart: Move/Update?"); - // Lets try to replace the old waypoint, if it exists + // Let's try to replace the old waypoint, if it exists WaypointList::iterator iter(value_node->find(waypoint)); if(iter == value_node->waypoint_list().end()) @@ -416,7 +390,6 @@ Action::WaypointSetSmart::prepare() try { //synfig::info("WaypointSetSmart: Replace?"); - //DEBUGPOINT(); // Check to see if a waypoint exists at this point in time WaypointList::iterator iter=value_node->find(waypoint.get_time()); @@ -444,7 +417,6 @@ Action::WaypointSetSmart::prepare() try { //synfig::info("WaypointSetSmart: Add?"); - //DEBUGPOINT(); // At this point we know that the old waypoint doesn't exist, // so we need to create it. Action::Handle action(WaypointAdd::create()); @@ -464,5 +436,5 @@ Action::WaypointSetSmart::prepare() } catch(synfig::Exception::NotFound){ } catch(int){ } - throw Error(_("Unable to determine how to procede. This is a bug.")); + throw Error(_("Unable to determine how to proceed. This is a bug.")); }