Author: Carlos Lopez <[email protected]>
Date:   Wed Aug 31 20:41:08 2011 +0200

When a real value node is bline linked and is is converted to Linear, keep it 
in real linear homogeneous movement

---

 synfig-core/src/synfig/valuenode_linear.cpp |   28 ++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/synfig-core/src/synfig/valuenode_linear.cpp 
b/synfig-core/src/synfig/valuenode_linear.cpp
index 2e4d530..113dc99 100644
--- a/synfig-core/src/synfig/valuenode_linear.cpp
+++ b/synfig-core/src/synfig/valuenode_linear.cpp
@@ -33,6 +33,7 @@
 
 #include "valuenode_linear.h"
 #include "valuenode_const.h"
+#include "valuenode_bline.h"
 #include "general.h"
 #include "color.h"
 #include <ETL/misc>
@@ -121,7 +122,22 @@ ValueNode_Linear::operator()(Time t)const
        case ValueBase::TYPE_INTEGER:
                return round_to_int((*m_)(t).get(int())*t+(*b_)(t).get(int()));
        case ValueBase::TYPE_REAL:
-               return (*m_)(t).get(  Real())*t+(*b_)(t).get(  Real());
+               {
+                       Real hb, linear;
+                       ValueNode::Handle bline_value_node(get_bline());
+                       if(bline_value_node)
+                       {
+                               ValueBase bline((*bline_value_node)(t));
+                               hb=std_to_hom(bline, (*b_)(t).get(  Real()), 
bline.get_loop());
+                               linear=(*m_)(t).get(  Real())*t+hb;
+                               linear=hom_to_std(bline, linear, 
bline.get_loop());
+                       }
+                       else
+                       {
+                               linear=(*m_)(t).get(  Real())*t+(*b_)(t).get(  
Real());
+                       }
+                       return linear;
+               }
        case ValueBase::TYPE_TIME:
                return (*m_)(t).get(  Time())*t+(*b_)(t).get(  Time());
        case ValueBase::TYPE_VECTOR:
@@ -200,6 +216,11 @@ ValueNode_Linear::get_children_vocab_vfunc()const
                        .set_local_name(_("Rate"))
                        .set_description(_("Value that is multiplied by the 
current time (in seconds)"))
                );
+       ret.push_back(ParamDesc(ValueBase(),"offset")
+               .set_local_name(_("Offset"))
+               .set_description(_("Returned value when the current time is 
zero"))
+               .set_is_bline_linked(true)
+       );
        break;
        case ValueBase::TYPE_VECTOR:
        default:
@@ -207,12 +228,13 @@ ValueNode_Linear::get_children_vocab_vfunc()const
                        .set_local_name(_("Slope"))
                        .set_description(_("Value that is multiplied by the 
current time (in seconds)"))
                );
-       }
-
        ret.push_back(ParamDesc(ValueBase(),"offset")
                .set_local_name(_("Offset"))
                .set_description(_("Returned value when the current time is 
zero"))
        );
+       }
+
+
 
        return ret;
 }


------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to