From: Nikita Kitaev Date: Sat, 28 Nov 2009 19:35:02 +0000 (-0800) Subject: Merge branch 'nikitakit_smoothbline' into nikitakit_ducks X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=c8dfc1fcfebdcc765fac4de28731a783b6099c35;p=synfig.git Merge branch 'nikitakit_smoothbline' into nikitakit_ducks Conflicts: synfig-core/po/fr.po synfig-core/po/ru.po synfig-studio/po/es.po synfig-studio/po/fr.po synfig-studio/po/ru.po synfig-studio/src/gtkmm/duckmatic.cpp --- c8dfc1fcfebdcc765fac4de28731a783b6099c35 diff --cc synfig-studio/src/gtkmm/canvasview.cpp index 594ad39,ee39ade..95fe556 --- a/synfig-studio/src/gtkmm/canvasview.cpp +++ b/synfig-studio/src/gtkmm/canvasview.cpp @@@ -2883,20 -2881,10 +2883,20 @@@ CanvasView::on_duck_changed(const synfi if (ValueNode_BLineCalcVertex::Handle bline_vertex = ValueNode_BLineCalcVertex::Handle::cast_dynamic(value_desc.get_value_node())) { - ValueNode_BLine::Handle bline = ValueNode_BLine::Handle::cast_dynamic(bline_vertex->get_link(bline_vertex->get_link_index_from_name("bline"))); + ValueNode_BLine::Handle bline = ValueNode_BLine::Handle::cast_dynamic(bline_vertex->get_link("bline")); Real radius = 0.0; - Real amount = synfig::find_closest_point((*bline)(get_time()), value, radius, bline->get_loop()); - return canvas_interface()->change_value(synfigapp::ValueDesc(bline_vertex,bline_vertex->get_link_index_from_name("amount")), amount); + if (((*(bline_vertex->get_link("loop")))(get_time()).get(bool()))){ + Real amount_old((*(bline_vertex->get_link("amount")))(get_time()).get(Real())); + Real amount_new = synfig::find_closest_point((*bline)(get_time()), value, radius, bline->get_loop()); + Real difference = fmod( fmod(amount_new - amount_old, 1.0) + 1.0 , 1.0); + //fmod is called twice to avoid negative values + if (difference > 0.5) difference=difference-1.0; + return canvas_interface()->change_value(synfigapp::ValueDesc(bline_vertex,bline_vertex->get_link_index_from_name("amount")), amount_old+difference); + + } else { + Real amount = synfig::find_closest_point((*bline)(get_time()), value, radius, bline->get_loop()); + return canvas_interface()->change_value(synfigapp::ValueDesc(bline_vertex,bline_vertex->get_link_index_from_name("amount")), amount); + } } if (ValueNode_BLineCalcTangent::Handle bline_tangent = ValueNode_BLineCalcTangent::Handle::cast_dynamic(value_desc.get_value_node()))