Add one extra parameter to Value Description (Scale) to allow distinguish tangent...
authorCarlos Lopez <genetita@gmail.com>
Wed, 1 Sep 2010 18:03:06 +0000 (20:03 +0200)
committerCarlos Lopez <genetita@gmail.com>
Wed, 1 Sep 2010 18:03:06 +0000 (20:03 +0200)
synfig-studio/src/gui/duckmatic.cpp
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 99b4604..621788c 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.12):
                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