Merge branch 'genete_smart_link_master'
authorCarlos Lopez <genetita@gmail.com>
Fri, 17 Sep 2010 16:19:29 +0000 (18:19 +0200)
committerCarlos Lopez <genetita@gmail.com>
Fri, 17 Sep 2010 16:19:29 +0000 (18:19 +0200)
synfig-studio/src/gui/duckmatic.cpp
synfig-studio/src/gui/workarearenderer/renderer_ducks.cpp
synfig-studio/src/synfigapp/action.cpp
synfig-studio/src/synfigapp/actions/valuedesclink.cpp
synfig-studio/src/synfigapp/actions/valuedesclink.h
synfig-studio/src/synfigapp/value_desc.h

index fe2d6a3..18c3d50 100644 (file)
@@ -1614,7 +1614,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handle<Canva
                                return false;
                        etl::handle<Duck> vertex_duck(last_duck());
                        vertex_duck->set_type(Duck::TYPE_VERTEX);
-                       if(!add_to_ducks(synfigapp::ValueDesc(value_node,4),canvas_view,transform_stack))
+                       if(!add_to_ducks(synfigapp::ValueDesc(value_node,4,-TANGENT_HANDLE_SCALE),canvas_view,transform_stack))
                                return false;
                        etl::handle<Duck> t1_duck(last_duck());
 
@@ -1627,7 +1627,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handle<Canva
                        // If the tangents are split
                        if((*value_node->get_link("split"))(get_time()).get(bool()))
                        {
-                               if(!add_to_ducks(synfigapp::ValueDesc(value_node,5),canvas_view,transform_stack))
+                               if(!add_to_ducks(synfigapp::ValueDesc(value_node,5,TANGENT_HANDLE_SCALE),canvas_view,transform_stack))
                                        return false;
                                t2_duck=last_duck();
                                t2_duck->set_origin(vertex_duck);
@@ -1636,7 +1636,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handle<Canva
                        }
                        else
                        {
-                               if(!add_to_ducks(synfigapp::ValueDesc(value_node,4),canvas_view,transform_stack))
+                               if(!add_to_ducks(synfigapp::ValueDesc(value_node,4,TANGENT_HANDLE_SCALE),canvas_view,transform_stack))
                                        return false;
                                t2_duck=last_duck();
                                t2_duck->set_origin(vertex_duck);
@@ -1791,7 +1791,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handle<Canva
                                        // Add the tangent1 duck
                                        if(composite_vertex_value_node)
                                        {
-                                               if(!add_to_ducks(synfigapp::ValueDesc(composite_vertex_value_node,4),canvas_view,transform_stack))
+                                               if(!add_to_ducks(synfigapp::ValueDesc(composite_vertex_value_node,4,-TANGENT_BEZIER_SCALE),canvas_view,transform_stack))
                                                        return false;
                                                tduck=last_duck();
                                        }
@@ -1848,7 +1848,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handle<Canva
                                if(composite_vertex_value_node)
                                {
                                        int i=bline_point.get_split_tangent_flag()?5:4;
-                                       if(!add_to_ducks(synfigapp::ValueDesc(composite_vertex_value_node,i),canvas_view,transform_stack,0,2))
+                                       if(!add_to_ducks(synfigapp::ValueDesc(composite_vertex_value_node,i,TANGENT_BEZIER_SCALE),canvas_view,transform_stack,0,2))
                                                return false;
                                        tduck=last_duck();
                                }
index 5ad88cb..8760b79 100644 (file)
@@ -304,7 +304,34 @@ Renderer_Ducks::render_vfunc(
                if(!(*iter)->get_editable())
                        screen_duck.color=(DUCK_COLOR_NOT_EDITABLE);
                else if((*iter)->get_tangent())
-                       screen_duck.color=((*iter)->get_scalar()<0 ? DUCK_COLOR_TANGENT_1 : DUCK_COLOR_TANGENT_2);
+               {
+                       // Check if we can reach the canvas and set the time to
+                       // evaluate the split value accordingly
+                       synfig::Canvas::Handle canvas_h(get_work_area()->get_canvas());
+                       synfig::Time time(canvas_h?canvas_h->get_time():synfig::Time(0));
+                       // Retrieve the split value of the bline point.
+                       synfigapp::ValueDesc& v_d((*iter)->get_value_desc());
+                       synfig::LinkableValueNode::Handle parent;
+                       if(v_d.parent_is_linkable_value_node())
+                       {
+                               parent=v_d.get_parent_value_node();
+                               bool split;
+                               synfig::ValueNode::Handle child(parent->get_link("split"));
+                               if(synfig::ValueNode_Animated::Handle::cast_dynamic(child))
+                               {
+                                       synfig::ValueNode_Animated::Handle animated_child(synfig::ValueNode_Animated::Handle::cast_dynamic(child));
+                                       split=animated_child->new_waypoint_at_time(time).get_value(time).get(split);
+                               }
+                               else if(synfig::ValueNode_Const::Handle::cast_dynamic(child))
+                               {
+                                       synfig::ValueNode_Const::Handle const_child(synfig::ValueNode_Const::Handle::cast_dynamic(child));
+                                       split=(const_child->get_value()).get(split);
+                               }
+                               screen_duck.color=(split? DUCK_COLOR_TANGENT_2 : DUCK_COLOR_TANGENT_1);
+                       }
+                       else
+                               screen_duck.color=DUCK_COLOR_TANGENT_1;
+               }
                else if((*iter)->get_type()&Duck::TYPE_VERTEX)
                        screen_duck.color=DUCK_COLOR_VERTEX;
                else if((*iter)->get_type()&Duck::TYPE_RADIUS)
index 21d5f0c..4b89c3e 100644 (file)
@@ -196,6 +196,7 @@ Action::Main::Main()
        ADD_ACTION(Action::ValueDescConnect);
        ADD_ACTION(Action::ValueDescDisconnect);
        ADD_ACTION(Action::ValueDescLink);
+       ADD_ACTION(Action::ValueDescLinkOpposite);
        ADD_ACTION(Action::ValueDescBLineLink);
 
        ADD_ACTION(Action::WaypointAdd);
index 7f98228..6afde69 100644 (file)
@@ -7,6 +7,7 @@
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
 **     Copyright (c) 2007, 2008 Chris Moore
+**     Copyright (c) 2010 Carlos López
 **
 **     This package is free software; you can redistribute it and/or
 **     modify it under the terms of the GNU General Public License as
@@ -34,6 +35,7 @@
 
 #include <synfigapp/canvasinterface.h>
 #include <synfig/valuenode_const.h>
+#include <synfig/valuenode_scale.h>
 
 #include <synfigapp/general.h>
 
@@ -56,13 +58,23 @@ ACTION_SET_PRIORITY(Action::ValueDescLink,0);
 ACTION_SET_VERSION(Action::ValueDescLink,"0.0");
 ACTION_SET_CVS_ID(Action::ValueDescLink,"$Id$");
 
+ACTION_INIT(Action::ValueDescLinkOpposite);
+ACTION_SET_NAME(Action::ValueDescLinkOpposite,"ValueDescLinkOpposite");
+ACTION_SET_LOCAL_NAME(Action::ValueDescLinkOpposite,N_("Link Opposite"));
+ACTION_SET_TASK(Action::ValueDescLinkOpposite,"connect");
+ACTION_SET_CATEGORY(Action::ValueDescLinkOpposite,Action::CATEGORY_VALUEDESC);
+ACTION_SET_PRIORITY(Action::ValueDescLinkOpposite,0);
+ACTION_SET_VERSION(Action::ValueDescLinkOpposite,"0.0");
+ACTION_SET_CVS_ID(Action::ValueDescLinkOpposite,"$Id$");
+
 /* === G L O B A L S ======================================================= */
 
 /* === P R O C E D U R E S ================================================= */
 
 /* === M E T H O D S ======================================================= */
 
-Action::ValueDescLink::ValueDescLink(): poison(false), status_level(0)
+Action::ValueDescLink::ValueDescLink():
+poison(false), status_level(0), link_scalar(0.0), link_opposite(false)
 {
 }
 
@@ -72,7 +84,7 @@ Action::ValueDescLink::get_param_vocab()
        ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
 
        ret.push_back(ParamDesc("value_desc",Param::TYPE_VALUEDESC)
-               .set_local_name(_("ValueDesc to link"))
+               .set_local_name(_("ValueDesc to smart link"))
                .set_requires_multiple()
        );
 
@@ -116,6 +128,7 @@ Action::ValueDescLink::set_param(const synfig::String& name, const Action::Param
                        }
 
                        link_value_node=value_desc.get_value_node();
+                       link_scalar=value_desc.get_scalar();
                        status_message = _("Used exported ValueNode ('") + link_value_node->get_id() + _("').");
                }
                else if(value_desc.is_value_node())
@@ -125,6 +138,7 @@ Action::ValueDescLink::set_param(const synfig::String& name, const Action::Param
                                status_level = 1;
                                status_message = _("Using the only available ValueNode.");
                                link_value_node=value_desc.get_value_node();
+                               link_scalar=value_desc.get_scalar();
                        }
                        else if(link_value_node->is_exported())
                        {
@@ -138,6 +152,7 @@ Action::ValueDescLink::set_param(const synfig::String& name, const Action::Param
                                        status_level = 2;
                                        status_message = _("Using the most referenced ValueNode.");
                                        link_value_node=value_desc.get_value_node();
+                                       link_scalar=value_desc.get_scalar();
                                }
                                else if (status_level <= 2)
                                {
@@ -152,6 +167,7 @@ Action::ValueDescLink::set_param(const synfig::String& name, const Action::Param
                                status_level = 3;
                                status_message = _("There's a tie for most referenced; using the animated ValueNode.");
                                link_value_node=value_desc.get_value_node();
+                               link_scalar=value_desc.get_scalar();
                        }
                        else if(ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node()) && !ValueNode_Const::Handle::cast_dynamic(link_value_node))
                        {
@@ -173,6 +189,7 @@ Action::ValueDescLink::set_param(const synfig::String& name, const Action::Param
                                        status_level = 4;
                                        status_message = _("There's a tie for most referenced, and both are animated; using the one with the most waypoints.");
                                        link_value_node=value_desc.get_value_node();
+                                       link_scalar=value_desc.get_scalar();
                                }
                                else if (status_level <= 4)
                                {
@@ -192,6 +209,7 @@ Action::ValueDescLink::set_param(const synfig::String& name, const Action::Param
                                        status_level = 4;
                                        status_message = _("There's a tie for most referenced, and both are linkable value node animated; using the one with the most waypoints.");
                                        link_value_node=value_desc.get_value_node();
+                                       link_scalar=value_desc.get_scalar();
                                }
                                else if (status_level <= 4)
                                {
@@ -207,6 +225,7 @@ Action::ValueDescLink::set_param(const synfig::String& name, const Action::Param
                                        status_level = 5;
                                        status_message = _("Everything is tied; using the least recently modified value.");
                                        link_value_node=value_desc.get_value_node();
+                                       link_scalar=value_desc.get_scalar();
                                }
                                else if (status_level <= 5)
                                {
@@ -281,25 +300,57 @@ Action::ValueDescLink::prepare()
                add_action_front(action);
        }
 
-       /*
-       if(!link_value_node->is_exported())
-       {
-               Action::Handle action(Action::create("ValueNodeAdd"));
-
-               action->set_param("canvas",get_canvas());
-               action->set_param("canvas_interface",get_canvas_interface());
-               action->set_param("new",link_value_node);
-               action->set_param("name",strprintf(_("Unnamed%08d"),synfig::UniqueID().get_uid()));
-
-               assert(action->is_ready());
-               if(!action->is_ready())
-                       throw Error(Error::TYPE_NOTREADY);
-
-               add_action_front(action);
-       }
-       */
+       // Check if the selected  link value node is already a scale -1.0 Linkable Value Node
+       bool link_is_scaled(false);
+       if(synfig::ValueNode_Scale::Handle::cast_dynamic(link_value_node))
+               {
+                       synfig::ValueNode_Const::Handle scale_vn(
+                                       synfig::ValueNode_Const::Handle::cast_dynamic(
+                                                       synfig::ValueNode_Scale::Handle::cast_dynamic(link_value_node)->get_link(1)
+                                                       )
+                                               );
+                       if(scale_vn)
+                               if((*scale_vn)(synfig::Time(0))==synfig::ValueBase(Real(-1.0)))
+                                       link_is_scaled=true;
+               }
 
        std::list<ValueDesc>::iterator iter;
+       // Gets the scalar value of the current value node
+       Real current_scalar(value_desc_list.begin()->get_scalar());
+       bool found_inverse(false);
+       // Check if we are dealing the case of linking differnt types of tangents
+       for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
+       {
+               ValueDesc& v_desc(*iter);
+               // If parent is linkable value node
+               if(v_desc.parent_is_linkable_value_node())
+               {
+                       // if the link describe to any tangent (index 4 or 5), continue
+                       if(v_desc.get_index() == 4 || v_desc.get_index() == 5)
+                       {
+                               synfig::Real iter_scalar=v_desc.get_scalar();
+                               // Let's compare the sign  of scalar of the value node witht the current one
+                               // and remember if a change of sign is seen.
+                               if(iter_scalar*current_scalar < 0) // if they have different signs
+                               {
+                                       found_inverse=true;
+                                       current_scalar=iter_scalar;
+                               }
+                       }
+                       else // link doesn't describe a tangent
+                       {
+                               found_inverse=false;
+                               break;
+                       }
+               }
+               else // parent is not a linkable value node
+               {
+                       found_inverse=false;
+                       break;
+               }
+       }
+       // found_inverse =  true only if all they are tangents and some are inversed tangents
+       //Noe let's loop throug all the value desc
        for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
        {
                ValueDesc& value_desc(*iter);
@@ -308,20 +359,182 @@ Action::ValueDescLink::prepare()
                // don't link it to itself
                if (value_desc.is_exported())
                        continue;
+               // Don't link the selected to itself (maybe it is redundant with the previous check)
+               if(value_desc.get_value_node() == link_value_node)
+                       continue;
+               // found_inverse xor link_opposite
+               // If     found_inverse and not link_opposite then scale by -1 first (smart link)
+               // If     found inverse and     link_opposite then do a direct link instead
+               // If not found_inverse and not link_opposite then do a direct link instead
+               // If not found_inverse and     link_opposite then scale by -1 first (smart link)
+               if((found_inverse && !link_opposite) || (!found_inverse && link_opposite))
+               {
+                       //Check if the current value node has opposite scalar than the link
+                       // value node to convert to scale -1.0 before connect.
+                       // Check also if the link value node is NOT also a scale -1
+                       // And check also if we are linking opposite
+                       if( (value_desc.get_scalar()*link_scalar<0 || link_opposite) && (link_is_scaled==false))
+                       {
+                               //Let's create a Scale Value Node
+                               synfig::ValueNode::Handle scale_value_node=synfig::LinkableValueNode::create("scale",iter->get_value(time));
+                               if(!scale_value_node)
+                                       throw Error(Error::TYPE_BUG);
+                               scale_value_node->set_parent_canvas(get_canvas());
+                               //Let's connect the new Scale Value Node to the value node
+                               Action::Handle action1(Action::create("ValueDescConnect"));
+                               if(!action1)
+                                       throw Error(Error::TYPE_CRITICAL);
+                               action1->set_param("canvas",get_canvas());
+                               action1->set_param("canvas_interface",get_canvas_interface());
+                               action1->set_param("dest",value_desc);
+                               action1->set_param("src",scale_value_node);
+                               assert(action1->is_ready());
+                               if(!action1->is_ready())
+                                       throw Error(Error::TYPE_NOTREADY);
+                               add_action_front(action1);
+
+                               //Let's Connect the link value node to the scale value node link subparam
+                               Action::Handle action2(Action::create("ValueNodeLinkConnect"));
+                               if(!action2)
+                                       throw Error(Error::TYPE_CRITICAL);
+
+                               action2->set_param("canvas",get_canvas());
+                               action2->set_param("canvas_interface",get_canvas_interface());
+                               action2->set_param("parent_value_node",scale_value_node);
+                               action2->set_param("index",0);
+                               action2->set_param("value_node",link_value_node);
+                               assert(action2->is_ready());
+                               if(!action2->is_ready())
+                                       throw Error(Error::TYPE_NOTREADY);
+                               add_action_front(action2);
+
+                               //Let's Set the scale to -1
+                               Action::Handle action3(Action::create("ValueNodeConstSet"));
+                               if(!action3)
+                                       throw Error(Error::TYPE_CRITICAL);
+
+                               action3->set_param("canvas",get_canvas());
+                               action3->set_param("canvas_interface",get_canvas_interface());
+                               action3->set_param("value_node",synfig::LinkableValueNode::Handle::cast_dynamic(scale_value_node)->get_link(1));
+                               action3->set_param("new_value",synfig::ValueBase(Real(-1.0)));
+                               assert(action3->is_ready());
+                               if(!action3->is_ready())
+                                       throw Error(Error::TYPE_NOTREADY);
+                               add_action_front(action3);
+                       }
+                       else if((iter->get_scalar()*link_scalar<0 || link_opposite) && (link_is_scaled==true))
+                       {
+                               //Let's connect the link value node -> link to the value node
+                               // There is not needed conversion to scale of the value node
+                               // because the link value node is already a scale -1
+                               Action::Handle action4(Action::create("ValueDescConnect"));
+                               if(!action4)
+                                       throw Error(Error::TYPE_CRITICAL);
+                               action4->set_param("canvas",get_canvas());
+                               action4->set_param("canvas_interface",get_canvas_interface());
+                               action4->set_param("dest",value_desc);
+                               action4->set_param("src",synfig::ValueNode_Scale::Handle::cast_dynamic(link_value_node)->get_link(0));
+                               assert(action4->is_ready());
+                               if(!action4->is_ready())
+                                       throw Error(Error::TYPE_NOTREADY);
+                               add_action_front(action4);
+                       }
+                       else
+                       {
+                               //Let's connect the link value node to the value node
+                               Action::Handle action(Action::create("ValueDescConnect"));
 
-               Action::Handle action(Action::create("ValueDescConnect"));
+                               action->set_param("canvas",get_canvas());
+                               action->set_param("canvas_interface",get_canvas_interface());
+                               action->set_param("src",link_value_node);
+                               action->set_param("dest",value_desc);
 
-               action->set_param("canvas",get_canvas());
-               action->set_param("canvas_interface",get_canvas_interface());
-               action->set_param("src",link_value_node);
-               action->set_param("dest",value_desc);
+                               assert(action->is_ready());
+                               if(!action->is_ready())
+                                       throw Error(Error::TYPE_NOTREADY);
 
-               assert(action->is_ready());
-               if(!action->is_ready())
-                       throw Error(Error::TYPE_NOTREADY);
+                               add_action_front(action);
+                       }
+               } // found inverse
+               else // Not found inverse so do a regualr link
+               {
+                       //Let's connect the link value node to the value node
+                       Action::Handle action(Action::create("ValueDescConnect"));
 
-               add_action_front(action);
+                       action->set_param("canvas",get_canvas());
+                       action->set_param("canvas_interface",get_canvas_interface());
+                       action->set_param("src",link_value_node);
+                       action->set_param("dest",value_desc);
+
+                       assert(action->is_ready());
+                       if(!action->is_ready())
+                               throw Error(Error::TYPE_NOTREADY);
+
+                       add_action_front(action);
+               }
        }
 
        synfig::info("http://synfig.org/Linking#Tier_%d : %s", status_level, status_message.c_str());
 }
+
+
+Action::ValueDescLinkOpposite::ValueDescLinkOpposite()
+{
+}
+
+Action::ParamVocab
+Action::ValueDescLinkOpposite::get_param_vocab()
+{
+       return Action::ValueDescLink::get_param_vocab();
+}
+
+bool
+Action::ValueDescLinkOpposite::is_candidate(const ParamList &x)
+{
+       // If action parameters are not Value Desc
+       if(!candidate_check(get_param_vocab(),x))
+               return false;
+
+       int total_tangents=0;
+       ParamList::const_iterator iter;
+       //Search thru all the Param and pick up the value descriptions
+       for(iter=x.begin(); iter!=x.end(); iter++)
+       {
+               if(iter->first == "value_desc")
+               {
+                       ValueDesc v_desc(iter->second.get_value_desc());
+                       // if the value description parent is linkable value node, continue
+                       if(!v_desc.parent_is_linkable_value_node())
+                               return false;
+                       // if the link describe to any tangent (index 4 or 5), continue
+                       if(v_desc.get_index() != 4 && v_desc.get_index() != 5)
+                               return false;
+                       total_tangents++;
+               }
+       }
+       // If we found two tangents then continue
+       if(total_tangents!=2)
+               return false;
+       // We have reached exactly two tangents
+       return true;
+}
+
+bool
+Action::ValueDescLinkOpposite::set_param(const synfig::String& name, const Action::Param &param)
+{
+       return Action::ValueDescLink::set_param(name,param);
+}
+
+bool
+Action::ValueDescLinkOpposite::is_ready()const
+{
+       return Action::ValueDescLink::is_ready();
+}
+
+void
+Action::ValueDescLinkOpposite::prepare()
+{
+       // prepare to do a opposite link and reuse the code from ValueDescLink
+       link_opposite=true;
+       ValueDescLink::prepare();
+}
index a72e78f..e7c4ba6 100644 (file)
@@ -7,6 +7,7 @@
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
 **     Copyright (c) 2007 Chris Moore
+**     Copyright (c) 2010 Carlos López
 **
 **     This package is free software; you can redistribute it and/or
 **     modify it under the terms of the GNU General Public License as
@@ -46,13 +47,27 @@ class ValueDescLink :
        public Super
 {
 private:
-
+       friend class ValueDescLinkOpposite;
+       //! List of Value Descriptions retrieved from the action Parameters list
+       //! to be linked
        std::list<ValueDesc> value_desc_list;
+       //! Selected value node from the Value Descriptions (maybe none)
+       //! to which the others would link
        synfig::ValueNode::Handle link_value_node;
+       //! If poison is true then Link is not possible (two exported value nodes found)
        bool poison;
+       //! Used to monitorize the tie decision when selecting the link value node
        int status_level;
+       //! Message to inform the status of the tie decision when selecting the link value node
        synfig::String status_message;
+       //! Time where the value nodes are evaluated
        synfig::Time time;
+       //! Scalar value of the link value node. It is used for linking tangents.
+       //! In the synfig::ParamDesc list there is a value used to draw the tangents on the
+       //! canvas that is called scalar
+       synfig::Real link_scalar;
+       //! If true then link opposite is being called.
+       bool link_opposite;
 public:
 
        ValueDescLink();
@@ -68,6 +83,24 @@ public:
        ACTION_MODULE_EXT
 };
 
+class ValueDescLinkOpposite :
+       public ValueDescLink
+{
+public:
+
+       ValueDescLinkOpposite();
+
+       static ParamVocab get_param_vocab();
+       static bool is_candidate(const ParamList &x);
+
+       virtual bool set_param(const synfig::String& name, const Param &);
+       virtual bool is_ready()const;
+
+       virtual void prepare();
+
+       ACTION_MODULE_EXT
+};
+
 }; // END of namespace action
 }; // END of namespace studio
 
index 99b4604..56501a2 100644 (file)
@@ -59,6 +59,9 @@ class ValueDesc
        // Info for exported ValueNode
        synfig::Canvas::Handle canvas;
 
+       // Info for visual editon
+       synfig::Real scalar;
+
 public:
        bool operator==(const ValueDesc &rhs)const
        {
@@ -70,7 +73,9 @@ public:
                        return true;
                if((canvas||rhs.canvas) && canvas!=rhs.canvas)
                        return false;
-               if((parent_value_node||rhs.parent_value_node) && parent_value_node!=rhs.parent_value_node)
+               if((parent_value_node||rhs.parent_value_node) && (parent_value_node!=rhs.parent_value_node))
+                       return false;
+               if(scalar!=rhs.scalar)
                        return false;
                if(index!=rhs.index)
                        return false;
@@ -90,9 +95,10 @@ public:
                layer(layer),
                name(param_name) { }
 
-       ValueDesc(synfig::LinkableValueNode::Handle parent_value_node,int index):
+       ValueDesc(synfig::LinkableValueNode::Handle parent_value_node,int index, synfig::Real s=1.0):
                parent_value_node(parent_value_node),
-               index(index) { }
+               index(index),
+               scalar(s) { }
 
 //     ValueDesc(synfig::LinkableValueNode::Handle parent_value_node,const synfig::String& param_name):
 //             parent_value_node(parent_value_node),
@@ -131,6 +137,7 @@ public:
 
        synfig::ValueNode::Handle get_parent_value_node()const { assert(parent_is_value_node()); return parent_value_node; }
        int get_index()const { assert(parent_is_linkable_value_node()); return index; }
+       synfig::Real get_scalar()const { assert(parent_is_linkable_value_node()); return scalar; }
        synfig::String get_name()const { assert(parent_is_linkable_value_node()); return (synfig::LinkableValueNode::Handle::cast_reinterpret(parent_value_node))->link_name(index); }
        synfig::Time get_waypoint_time()const { assert(parent_is_waypoint()); return waypoint_time; }
 
@@ -194,6 +201,7 @@ public:
 
        synfig::String
        get_description(bool show_exported_name = true)const;
+
 }; // END of class ValueDesc
 
 }; // END of namespace synfigapp_instance