From: Carlos Lopez Date: Sun, 25 Oct 2009 16:45:20 +0000 (+0100) Subject: Fix bug in value node range. If link is smaller than minimum it was returned link. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=eb7452cee3567a8124c7a0fc2b9e2b6ee854a001;p=synfig.git Fix bug in value node range. If link is smaller than minimum it was returned link. --- 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())));