Author: Carlos Lopez <[email protected]>
Date:   Wed Aug 31 18:31:33 2011 +0200

Move the code of transfer the bline reference and the homogenous option to the 
new replacement ValueNode, to the code of valuenode.cpp because it will cover 
any other future case than the animation mode.
Add some documentation to ValueNode::replace member

---

 synfig-core/src/synfig/valuenode.cpp               |   14 +++++++++++++-
 .../src/synfigapp/actions/valuedescset.cpp         |    6 ------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/synfig-core/src/synfig/valuenode.cpp 
b/synfig-core/src/synfig/valuenode.cpp
index 1473354..78463f1 100644
--- a/synfig-core/src/synfig/valuenode.cpp
+++ b/synfig-core/src/synfig/valuenode.cpp
@@ -223,9 +223,12 @@ ValueNode::subsys_stop()
 int
 ValueNode::replace(etl::handle<ValueNode> x)
 {
+       // If this ValueNode is exactly the same than its replacement
+       // then there is not replacement and returns zero
        if(x.get()==this)
                return 0;
-
+       // First give to the replacement ValueNode all the parents
+       // of this ValueNode
        while(parent_set.size())
        {
                (*parent_set.begin())->add_child(x.get());
@@ -233,8 +236,17 @@ ValueNode::replace(etl::handle<ValueNode> x)
                //x->parent_set.insert(*parent_set.begin());
                //parent_set.erase(parent_set.begin());
        }
+       // Also, transfer the bline stuff of this ValueNode
+       // to the replacement one
+       if(get_bline())
+               x->set_bline(get_bline(), get_homogeneous());
+       // Finally replace this ValueNode by the replacement
+       // and count the number of times this ValueNode is referenced
        int r(RHandle(this).replace(x));
+       // Set the replacement ValueNode as changed to update all its
+       // new parents
        x->changed();
+       // and return the number of references replaced.
        return r;
 }
 
diff --git a/synfig-studio/src/synfigapp/actions/valuedescset.cpp 
b/synfig-studio/src/synfigapp/actions/valuedescset.cpp
index 4cb12d3..2ac5722 100644
--- a/synfig-studio/src/synfigapp/actions/valuedescset.cpp
+++ b/synfig-studio/src/synfigapp/actions/valuedescset.cpp
@@ -667,12 +667,6 @@ Action::ValueDescSet::prepare()
                        else
                                value=value_desc.get_value();
                        
if(!value_node)value_node=ValueNode_Animated::create(value,time);
-                       // Transfer the bline to the new animated value node if 
bline is not NULL
-                       if(value_desc.is_value_node())
-                       {
-                               if(value_desc.get_value_node()->get_bline())
-                                       
value_node->set_bline(value_desc.get_value_node()->get_bline(), 
value_desc.get_value_node()->get_homogeneous());
-                       }
                        Action::Handle action;
                        if(!value_desc.is_value_node())
                        {


------------------------------------------------------------------------------
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