Module: synfig/synfig
Branch: genete_smart_link
Commit: 409983412122b6681911ae2b71b1ba3ce7b5d816
URL:    
http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig/synfig;a=commit;h=409983412122b6681911ae2b71b1ba3ce7b5d816

Author: Carlos Lopez <[email protected]>
Date:   Wed Sep 15 20:35:47 2010 +0200

Suit a more elegant way to distinguish split tangents by colour and also that 
allows BLine tool draw the tangent ducks with correct colors

---

 synfig-studio/src/gui/duck.h                       |    6 +++-
 synfig-studio/src/gui/duckmatic.cpp                |   10 ++++++-
 synfig-studio/src/gui/states/state_bline.cpp       |    4 +++
 .../src/gui/workarearenderer/renderer_ducks.cpp    |   29 +-------------------
 4 files changed, 19 insertions(+), 30 deletions(-)

diff --git a/synfig-studio/src/gui/duck.h b/synfig-studio/src/gui/duck.h
index fb96c45..1ed3bd6 100644
--- a/synfig-studio/src/gui/duck.h
+++ b/synfig-studio/src/gui/duck.h
@@ -138,6 +138,7 @@ private:
        bool tangent_;
        bool hover_;
        bool ignore_;
+       bool tangent_split_;
 
        synfig::TransformStack transform_stack_;
 
@@ -171,6 +172,9 @@ public:
        //! \writeme
        bool get_tangent()const { return tangent_; }
 
+       void set_tangent_split( bool x) { tangent_split_=x; }
+       bool get_tangent_split()const { return tangent_split_; }
+
        //! Sets whether to show the duck as if it is being hovered over
        void set_hover(bool h) { hover_=h; }
 
@@ -222,7 +226,7 @@ public:
         *  so that the duck can me rotated more than 180 degrees
         */
        synfig::Angle get_rotations()const { return rotations; };
-       
+
        //! Sets the rotations of the duck
        void set_rotations(const synfig::Angle &x) { rotations=x; };
 
diff --git a/synfig-studio/src/gui/duckmatic.cpp 
b/synfig-studio/src/gui/duckmatic.cpp
index 18c3d50..49a700f 100644
--- a/synfig-studio/src/gui/duckmatic.cpp
+++ b/synfig-studio/src/gui/duckmatic.cpp
@@ -1621,11 +1621,13 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& 
value_desc,etl::handle<Canva
                        t1_duck->set_origin(vertex_duck);
                        t1_duck->set_scalar(-TANGENT_HANDLE_SCALE);
                        t1_duck->set_tangent(true);
+                       bool 
split((*value_node->get_link("split"))(get_time()).get(bool()));
+                       t1_duck->set_tangent_split(split);
 
                        etl::handle<Duck> t2_duck;
 
                        // If the tangents are split
-                       
if((*value_node->get_link("split"))(get_time()).get(bool()))
+                       if(split)
                        {
                                
if(!add_to_ducks(synfigapp::ValueDesc(value_node,5,TANGENT_HANDLE_SCALE),canvas_view,transform_stack))
                                        return false;
@@ -1633,6 +1635,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& 
value_desc,etl::handle<Canva
                                t2_duck->set_origin(vertex_duck);
                                t2_duck->set_scalar(TANGENT_HANDLE_SCALE);
                                t2_duck->set_tangent(true);
+                               t2_duck->set_tangent_split(split);
                        }
                        else
                        {
@@ -1642,6 +1645,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& 
value_desc,etl::handle<Canva
                                t2_duck->set_origin(vertex_duck);
                                t2_duck->set_scalar(TANGENT_HANDLE_SCALE);
                                t2_duck->set_tangent(true);
+                               t2_duck->set_tangent_split(split);
                        }
                        return true;
                }
@@ -1810,6 +1814,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& 
value_desc,etl::handle<Canva
                                        tduck->set_origin(duck);
                                        
tduck->set_scalar(-TANGENT_BEZIER_SCALE);
                                        tduck->set_tangent(true);
+                                       
tduck->set_tangent_split(bline_point.get_split_tangent_flag());
 
                                        bezier->p2=duck;
                                        bezier->c2=tduck;
@@ -1896,6 +1901,8 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& 
value_desc,etl::handle<Canva
                                tduck->set_origin(duck);
                                tduck->set_scalar(TANGENT_BEZIER_SCALE);
                                tduck->set_tangent(true);
+                               
tduck->set_tangent_split(bline_point.get_split_tangent_flag());
+
 
                                bezier->p1=duck;
                                bezier->c1=tduck;
@@ -1935,6 +1942,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& 
value_desc,etl::handle<Canva
                                tduck->set_origin(duck);
                                tduck->set_scalar(-TANGENT_BEZIER_SCALE);
                                tduck->set_tangent(true);
+                               
tduck->set_tangent_split(bline_point.get_split_tangent_flag());
 
                                bezier->p2=duck;
                                bezier->c2=tduck;
diff --git a/synfig-studio/src/gui/states/state_bline.cpp 
b/synfig-studio/src/gui/states/state_bline.cpp
index d020374..f792c60 100644
--- a/synfig-studio/src/gui/states/state_bline.cpp
+++ b/synfig-studio/src/gui/states/state_bline.cpp
@@ -1035,6 +1035,7 @@ StateBLine_Context::refresh_ducks(bool button_down)
                tduck->set_origin(duck);
                tduck->set_scalar(-0.33333333333333333);
                tduck->set_tangent(true);
+               tduck->set_tangent_split(bline_point.get_split_tangent_flag());
                tduck->set_guid(value_node->get_guid()^synfig::GUID::hasher(3));
                tduck->signal_edited().connect(
                        
sigc::bind(sigc::mem_fun(*this,&studio::StateBLine_Context::on_tangent1_change),value_node)
@@ -1084,6 +1085,7 @@ StateBLine_Context::refresh_ducks(bool button_down)
                tduck->set_origin(duck);
                tduck->set_scalar(0.33333333333333333);
                tduck->set_tangent(true);
+               tduck->set_tangent_split(bline_point.get_split_tangent_flag());
                if(bline_point.get_split_tangent_flag())
                {
                        
tduck->set_name(strprintf("%x-tangent2",value_node.get()));
@@ -1138,6 +1140,7 @@ StateBLine_Context::refresh_ducks(bool button_down)
                tduck->set_origin(duck);
                tduck->set_scalar(-0.33333333333333333);
                tduck->set_tangent(true);
+               tduck->set_tangent_split(bline_point.get_split_tangent_flag());
                tduck->signal_edited().connect(
                        
sigc::bind(sigc::mem_fun(*this,&studio::StateBLine_Context::on_tangent1_change),bline_point_list.front())
                );
@@ -1176,6 +1179,7 @@ StateBLine_Context::refresh_ducks(bool button_down)
                tduck->set_scalar(-0.33333333333333333);
 
                tduck->set_tangent(true);
+               tduck->set_tangent_split(bline_point.get_split_tangent_flag());
                bezier->p2=duck;
                bezier->c2=tduck;
 
diff --git a/synfig-studio/src/gui/workarearenderer/renderer_ducks.cpp 
b/synfig-studio/src/gui/workarearenderer/renderer_ducks.cpp
index 8760b79..0ba5fad 100644
--- a/synfig-studio/src/gui/workarearenderer/renderer_ducks.cpp
+++ b/synfig-studio/src/gui/workarearenderer/renderer_ducks.cpp
@@ -304,34 +304,7 @@ Renderer_Ducks::render_vfunc(
                if(!(*iter)->get_editable())
                        screen_duck.color=(DUCK_COLOR_NOT_EDITABLE);
                else if((*iter)->get_tangent())
-               {
-                       // 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;
-               }
+                       screen_duck.color=((*iter)->get_tangent_split()? 
DUCK_COLOR_TANGENT_2 : 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)


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to