Module: synfig/synfig
Branch: nikitakit_bones
Commit: 1efad88f9d2a8855df740e014f2cd00ce04502b4
URL:    
http://synfig.git.sourceforge.net/git/gitweb.cgi?p=synfig/synfig;a=commit;h=1efad88f9d2a8855df740e014f2cd00ce04502b4

Author: Nikita Kitaev <nikita...@gmail.com>
Date:   Tue Sep 28 20:12:01 2010 -0700

Allow boneinfluenced width duck reverse manipulation

---

 synfig-studio/src/gui/duck.cpp      |    3 ++-
 synfig-studio/src/gui/duckmatic.cpp |   29 ++++++++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/synfig-studio/src/gui/duck.cpp b/synfig-studio/src/gui/duck.cpp
index 7237d31..6aa6f1d 100644
--- a/synfig-studio/src/gui/duck.cpp
+++ b/synfig-studio/src/gui/duck.cpp
@@ -279,7 +279,8 @@ Duck::set_sub_trans_point(const synfig::Point &x)
 synfig::Point
 Duck::get_sub_trans_origin()const
 {
-       return origin_duck?origin_duck->get_sub_trans_point():origin;
+       // The origin needs to have the same transform stack as this duck
+       return 
origin_duck?transform_stack_.unperform(origin_duck->get_trans_point()):origin;
 }
 
 #ifdef _DEBUG
diff --git a/synfig-studio/src/gui/duckmatic.cpp 
b/synfig-studio/src/gui/duckmatic.cpp
index 5b19def..30c5d29 100644
--- a/synfig-studio/src/gui/duckmatic.cpp
+++ b/synfig-studio/src/gui/duckmatic.cpp
@@ -1752,7 +1752,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& 
value_desc,etl::handle<Canva
                                if (param_desc && 
param_desc->get_hint().empty())
                                {
                                        // if it's a parameter without a hint, 
then don't add the width duck
-                                       // \todo: determine why these 
conditions are necessary
+                                       // (This prevents width ducks from 
being added to region layers, and possibly other cases)
                                }
                                else
                                if(composite_vertex_value_node)
@@ -1782,6 +1782,33 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& 
value_desc,etl::handle<Canva
                                                synfig::error("Unable to add 
width duck!");
                                }
                                else
+                               if (composite_bone_link_value_node)
+                               {
+                                       if 
(add_to_ducks(synfigapp::ValueDesc(composite_bone_link_value_node,1),canvas_view,transform_stack,REAL_COOKIE))
+                                       {
+                                               width=last_duck();
+                                               width->set_origin(duck);
+                                               
width->set_type(Duck::TYPE_WIDTH);
+                                               
width->set_name(guid_string(synfigapp::ValueDesc(value_node,i))+".w");
+
+                                               // if the bline is a layer's 
parameter, scale the width duck by the layer's "width" parameter
+                                               if (param_desc)
+                                               {
+                                                       ValueBase 
value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_hint()).get_value(get_time()));
+                                                       
if(value.same_type_as(synfig::Real()))
+                                                               
width->set_scalar(value.get(synfig::Real())*0.5f);
+                                                       // if it doesn't have a 
"width" parameter, scale by 0.5f instead
+                                                       else
+                                                               
width->set_scalar(0.5f);
+                                               }
+                                               // otherwise just present the 
raw unscaled width
+                                               else
+                                                       width->set_scalar(0.5f);
+                                       }
+                                       else
+                                               synfig::error("Unable to add 
width duck!");
+                               }
+                               else
                                {
                                        synfig::error("Cannot add width duck to 
non-composite blinepoint");
                                }


------------------------------------------------------------------------------
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
Synfig-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to