From: Genete <ge...@us...> - 2009-10-25 17:50:57
|
Module: synfig Branch: genete_master Commit: eb7452cee3567a8124c7a0fc2b9e2b6ee854a001 URL: http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig;a=commit;h=eb7452cee3567a8124c7a0fc2b9e2b6ee854a001 Author: Carlos Lopez <gen...@gm...> Date: Sun Oct 25 17:45:20 2009 +0100 Fix bug in value node range. If link is smaller than minimum it was returned link. --- synfig-core/src/synfig/valuenode_range.cpp | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/synfig-core/src/synfig/valuenode_range.cpp b/synfig-core/src/synfig/valuenode_range.cpp index c45f369..c4107f8 100644 --- a/synfig-core/src/synfig/valuenode_range.cpp +++ b/synfig-core/src/synfig/valuenode_range.cpp @@ -127,7 +127,9 @@ synfig::ValueNode_Range::operator()(Time t)const Angle minimum = (* min_)(t).get(Angle()); Angle maximum = (* max_)(t).get(Angle()); Angle link = (*link_)(t).get(Angle()); - +// This code was removed because it didn't work with link < minimum +// It is sane to completely delete it if the replacement code is fine. +/* *********************************************** // if link is between min and max, use it if (Angle::deg((link-minimum).mod()).get() < Angle::deg((maximum-minimum).mod()).get()) return link; @@ -136,6 +138,13 @@ synfig::ValueNode_Range::operator()(Time t)const return minimum; else return maximum; +*********************************************** */ + if(Angle::rad(maximum).get()>=Angle::rad(link).get() && Angle::rad(link).get()>=Angle::rad(minimum).get()) + return link; + else if (Angle::rad(minimum).get()>Angle::rad(link).get()) + return minimum; + else + return maximum; } case ValueBase::TYPE_INTEGER: return std::max((*min_)(t).get(int()), std::min((*max_)(t).get(int()), (*link_)(t).get(int()))); |