The previous commit introduced a new crash. This fixes it.
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sun, 30 Mar 2008 17:44:33 +0000 (17:44 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sun, 30 Mar 2008 17:44:33 +0000 (17:44 +0000)
git-svn-id: http://svn.voria.com/code@1945 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/duckmatic.cpp

index 817a79c..ac70cfd 100644 (file)
@@ -557,22 +557,17 @@ DuckDrag_Translate::duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector
                                        int t1_index(value_node_composite->get_link_index_from_name("t1"));
                                        int t2_index(value_node_composite->get_link_index_from_name("t2"));
                                        int width_index(value_node_composite->get_link_index_from_name("width"));
+                                       int vertex_amount_index(bline_vertex->get_link_index_from_name("amount"));
 
                                        ValueNode::Handle t1_value_node(value_node_composite->get_link(t1_index));
                                        ValueNode::Handle t2_value_node(value_node_composite->get_link(t2_index));
                                        ValueNode::Handle width_value_node(value_node_composite->get_link(width_index));
+                                       ValueNode::Handle amount_value_node(bline_vertex->get_link(vertex_amount_index));
 
                                        ValueNode_BLineCalcTangent::Handle bline_tangent_1(ValueNode_BLineCalcTangent::Handle::cast_dynamic(t1_value_node));
                                        ValueNode_BLineCalcTangent::Handle bline_tangent_2(ValueNode_BLineCalcTangent::Handle::cast_dynamic(t2_value_node));
                                        ValueNode_BLineCalcWidth::Handle bline_width(ValueNode_BLineCalcWidth::Handle::cast_dynamic(width_value_node));
 
-                                       // these 3 are all the same at the moment, but let's play it safe, just in case it changes
-                                       int tangent_amount_index(bline_tangent_1->get_link_index_from_name("amount"));
-                                       int vertex_amount_index(bline_vertex->get_link_index_from_name("amount"));
-                                       int width_amount_index(bline_width->get_link_index_from_name("amount"));
-
-                                       ValueNode::Handle amount_value_node(bline_vertex->get_link(vertex_amount_index));
-
                                        if (bline_tangent_1 || bline_tangent_2 || bline_width)
                                        {
                                                synfig::Real radius = 0.0;
@@ -582,7 +577,7 @@ DuckDrag_Translate::duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector
                                                // we need to update the position of the tangent ducks - but how do we find these ducks?
                                                // this is a brute force search - but is there a better way to do it?
                                                if (bline_tangent_1 &&
-                                                       bline_tangent_1->get_link(tangent_amount_index) == amount_value_node)
+                                                       bline_tangent_1->get_link(bline_tangent_1->get_link_index_from_name("amount")) == amount_value_node)
                                                {
                                                        Vector tangent = (*bline_tangent_1)(time, amount).get(Vector());
                                                        DuckList::iterator iter;
@@ -592,7 +587,7 @@ DuckDrag_Translate::duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector
                                                }
 
                                                if (bline_tangent_2 &&
-                                                       bline_tangent_2->get_link(tangent_amount_index) == amount_value_node)
+                                                       bline_tangent_2->get_link(bline_tangent_2->get_link_index_from_name("amount")) == amount_value_node)
                                                {
                                                        Vector tangent = (*bline_tangent_2)(time, amount).get(Vector());
                                                        DuckList::iterator iter;
@@ -602,7 +597,7 @@ DuckDrag_Translate::duck_drag(Duckmatic* duckmatic, const synfig::Vector& vector
                                                }
 
                                                if (bline_width &&
-                                                       bline_width->get_link(width_amount_index) == amount_value_node)
+                                                       bline_width->get_link(bline_width->get_link_index_from_name("amount")) == amount_value_node)
                                                {
                                                        Real width = (*bline_width)(time, amount).get(Real());
                                                        DuckList::iterator iter;