X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fsynfigapp%2Factions%2Fwaypointset.cpp;h=577161b6759ce7359df37a5b07e5b5ef04f901f0;hb=c34eaa5441242b3e9a7b7645e9ee4983d14eae85;hp=00c916afcbf7932ce7287f510d96e720ba5a3d7b;hpb=02252941b29de64037116f4d37991a38d9ff0d94;p=synfig.git diff --git a/synfig-studio/trunk/src/synfigapp/actions/waypointset.cpp b/synfig-studio/trunk/src/synfigapp/actions/waypointset.cpp index 00c916a..577161b 100644 --- a/synfig-studio/trunk/src/synfigapp/actions/waypointset.cpp +++ b/synfig-studio/trunk/src/synfigapp/actions/waypointset.cpp @@ -5,16 +5,17 @@ ** $Id: waypointset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $ ** ** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** -** This software and associated documentation -** are CONFIDENTIAL and PROPRIETARY property of -** the above-mentioned copyright holder. +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. ** -** You may not copy, print, publish, or in any -** other way distribute this software without -** a prior written agreement with -** the copyright holder. +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. ** \endlegal */ /* ========================================================================= */ @@ -65,7 +66,7 @@ Action::ParamVocab Action::WaypointSet::get_param_vocab() { ParamVocab ret(Action::CanvasSpecific::get_param_vocab()); - + ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE) .set_local_name(_("Destination ValueNode (Animated)")) ); @@ -80,9 +81,9 @@ Action::WaypointSet::get_param_vocab() } bool -Action::WaypointSet::is_canidate(const ParamList &x) +Action::WaypointSet::is_candidate(const ParamList &x) { - return canidate_check(get_param_vocab(),x); + return candidate_check(get_param_vocab(),x); } bool @@ -91,14 +92,14 @@ Action::WaypointSet::set_param(const synfig::String& name, const Action::Param & if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE) { value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node()); - + return static_cast(value_node); } if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT) { //NOTE: at the moment there is no error checking for multiple sets!!! waypoints.push_back(param.get_waypoint()); - + return true; } @@ -115,13 +116,13 @@ Action::WaypointSet::is_ready()const void Action::WaypointSet::perform() -{ +{ WaypointList::iterator iter; -#if 1 +#if 1 vector iters; - vector::iterator i = waypoints.begin(), end = waypoints.end(); - + vector::iterator i = waypoints.begin(), end = waypoints.end(); + for(; i != end; ++i) { try { iters.push_back(value_node->find(*i)); } @@ -130,16 +131,16 @@ Action::WaypointSet::perform() throw Error(_("Unable to find waypoint")); } } - + //check to see which valuenodes are going to override because of the time... ValueNode_Animated::findresult timeiter; - + for(i = waypoints.begin(); i != end; ++i) { timeiter = value_node->find_time(i->get_time()); - + bool candelete = timeiter.second; - + //we only want to track overwrites (not waypoints that are also being modified) if(candelete) { @@ -152,7 +153,7 @@ Action::WaypointSet::perform() } } } - + //if we can still delete it after checking, record it, and then remove them all later if(candelete) { @@ -160,7 +161,7 @@ Action::WaypointSet::perform() overwritten_waypoints.push_back(w); } } - + //overwrite all the valuenodes we're supposed to set { i = waypoints.begin(); @@ -170,7 +171,7 @@ Action::WaypointSet::perform() **ii = *i; //set the point to the corresponding point in the normal waypoint list } } - + //remove all the points we're supposed to be overwritting { vector::iterator oi = overwritten_waypoints.begin(), @@ -191,27 +192,27 @@ Action::WaypointSet::perform() //find the value at the old time before we replace it ValueNode_Animated::findresult timeiter; timeiter = value_node->find_time(waypoint.get_time()); - + //we only want to track overwrites (not inplace modifications) if(timeiter.second && waypoint.get_uid() == timeiter.first->get_uid()) { - timeiter.second = false; + timeiter.second = false; } - + //copy and overwrite old_waypoint=*iter; *iter=waypoint; - + //if we've found a unique one then we need to erase it, but store it first if(timeiter.second) { time_overwrite = true; overwritten_wp = *timeiter.first; - + value_node->erase(overwritten_wp); } #endif - + // Signal that a valuenode has been changed value_node->changed(); } @@ -220,10 +221,10 @@ void Action::WaypointSet::undo() { WaypointList::iterator iter; - + #if 1 - vector::iterator i = old_waypoints.begin(), end = old_waypoints.end(); - + vector::iterator i = old_waypoints.begin(), end = old_waypoints.end(); + for(; i != end; ++i) { try { iter = value_node->find(*i); } @@ -231,11 +232,11 @@ Action::WaypointSet::undo() { throw Error(_("Unable to find waypoint")); } - + //overwrite with old one *iter = *i; } - + //add back in all the points that we removed before... { vector::iterator oi = overwritten_waypoints.begin(), @@ -251,16 +252,16 @@ Action::WaypointSet::undo() catch(synfig::Exception::NotFound) { throw Error(_("Unable to find waypoint")); - } + } *iter=old_waypoint; - + if(time_overwrite) { value_node->add(overwritten_wp); } #endif - + // Signal that a valuenode has been changed value_node->changed(); }