X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fsynfigapp%2Factions%2Fblinepointtangentmerge.cpp;h=d6dfab23a613d830937c0cb6c2a931e4d833bf00;hb=37600b4b217caa5e316984ec0b035c5e8f9698af;hp=fd32ef1ba3e071ead595c7c755533256ed1ca4e7;hpb=fb8370e0abee3275c3b7d80aa8bff2a04656542d;p=synfig.git diff --git a/synfig-studio/trunk/src/synfigapp/actions/blinepointtangentmerge.cpp b/synfig-studio/trunk/src/synfigapp/actions/blinepointtangentmerge.cpp index fd32ef1..d6dfab2 100644 --- a/synfig-studio/trunk/src/synfigapp/actions/blinepointtangentmerge.cpp +++ b/synfig-studio/trunk/src/synfigapp/actions/blinepointtangentmerge.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 @@ -142,63 +143,19 @@ Action::BLinePointTangentMerge::prepare() Action::Handle action; - { - action=Action::create("value_desc_set"); - if(!action) - throw Error(_("Couldn't find action \"value_desc_set\"")); - - action->set_param("canvas",get_canvas()); - action->set_param("canvas_interface",get_canvas_interface()); - action->set_param("value_desc",ValueDesc(value_node,3)); - action->set_param("time",time); - action->set_param("new_value",synfig::ValueBase(false)); + action=Action::create("value_desc_set"); + if(!action) + throw Error(_("Couldn't find action \"value_desc_set\"")); - assert(action->is_ready()); - if(!action->is_ready()) - throw Error(Error::TYPE_NOTREADY); + action->set_param("canvas",get_canvas()); + action->set_param("canvas_interface",get_canvas_interface()); + action->set_param("value_desc",ValueDesc(value_node,3)); + action->set_param("time",time); + action->set_param("new_value",synfig::ValueBase(false)); - add_action(action); - } + assert(action->is_ready()); + if(!action->is_ready()) + throw Error(Error::TYPE_NOTREADY); - // the merged tangent should be the average of the 2 tangents we're merging - ValueBase average(((Vector)((*value_node->get_link("t1"))(time)) + - (Vector)((*value_node->get_link("t2"))(time))) / 2); - - { - // set tangent1 - action=Action::create("value_desc_set"); - if(!action) - throw Error(_("Couldn't find action \"value_desc_set\"")); - - action->set_param("canvas",get_canvas()); - action->set_param("canvas_interface",get_canvas_interface()); - action->set_param("value_desc",ValueDesc(value_node,4)); - action->set_param("time",time); - action->set_param("new_value",average); - - assert(action->is_ready()); - if(!action->is_ready()) - throw Error(Error::TYPE_NOTREADY); - - add_action(action); - } - - { - // set tangent2 - action=Action::create("value_desc_set"); - if(!action) - throw Error(_("Couldn't find action \"value_desc_set\"")); - - action->set_param("canvas",get_canvas()); - action->set_param("canvas_interface",get_canvas_interface()); - action->set_param("value_desc",ValueDesc(value_node,5)); - action->set_param("time",time); - action->set_param("new_value",average); - - assert(action->is_ready()); - if(!action->is_ready()) - throw Error(Error::TYPE_NOTREADY); - - add_action(action); - } + add_action(action); }