From: dooglus Date: Fri, 2 Nov 2007 20:54:27 +0000 (+0000) Subject: Simplify the block structure without changing the behaviour. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=6784db1651239a30b80f9b798663a55c1450242f;p=synfig.git Simplify the block structure without changing the behaviour. git-svn-id: http://svn.voria.com/code@1107 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/gtkmm/state_draw.cpp b/synfig-studio/trunk/src/gtkmm/state_draw.cpp index 58b0778..e00baa3 100644 --- a/synfig-studio/trunk/src/gtkmm/state_draw.cpp +++ b/synfig-studio/trunk/src/gtkmm/state_draw.cpp @@ -1202,86 +1202,83 @@ StateDraw_Context::new_region(std::list bline, synfig::Real break; } - if(value_desc.parent_is_value_node() && - value_next.parent_is_value_node() && - value_desc.get_parent_value_node() == value_next.get_parent_value_node() && - next != vertex_list.end()) + if (value_desc.parent_is_value_node() && value_next.parent_is_value_node()) { - // Fill in missing vertices - if(value_desc.get_index()set_link(5,value_node_next->get_link(5)); - value_node->set_link(3,ValueNode_Const::create(true)); - - get_canvas_interface()->auto_export(value_node); - assert(value_node->is_exported()); - *iter=synfigapp::ValueDesc(get_canvas(),value_node->get_id()); - vertex_list.erase(next); - done=false; - break; } - else + // Ensure that connections between blines are properly connected + else if (value_desc.get_value_node() != value_next.get_value_node()) { - DEBUGPOINT(); - bool positive_trend(value_desc.get_index()>value_prev.get_index()); + BLinePoint vertex(value_desc.get_value(get_time()).get(BLinePoint())); + BLinePoint vertex_next(value_next.get_value(get_time()).get(BLinePoint())); - if(!positive_trend && value_desc.get_index()>0) + //synfig::info("--------"); + //synfig::info(__FILE__":%d: vertex: [%f, %f]",__LINE__,vertex.get_vertex()[0],vertex.get_vertex()[1]); + //synfig::info(__FILE__":%d: vertex_next: [%f, %f]",__LINE__,vertex_next.get_vertex()[0],vertex_next.get_vertex()[1]); + + if((vertex.get_vertex()-vertex_next.get_vertex()).mag_squared()set_link(5,value_node_next->get_link(5)); + value_node->set_link(3,ValueNode_Const::create(true)); + + get_canvas_interface()->auto_export(value_node); + assert(value_node->is_exported()); + *iter=synfigapp::ValueDesc(get_canvas(),value_node->get_id()); + vertex_list.erase(next); done=false; break; } - if(positive_trend && value_desc.get_index()link_count()-1) + else { DEBUGPOINT(); - vertex_list.insert(next,synfigapp::ValueDesc(value_desc.get_parent_value_node(),value_desc.get_index()+1)); - done=false; - break; + bool positive_trend(value_desc.get_index()>value_prev.get_index()); + + if(!positive_trend && value_desc.get_index()>0) + { + DEBUGPOINT(); + vertex_list.insert(next,synfigapp::ValueDesc(value_desc.get_parent_value_node(),value_desc.get_index()-1)); + done=false; + break; + } + if(positive_trend && value_desc.get_index()link_count()-1) + { + DEBUGPOINT(); + vertex_list.insert(next,synfigapp::ValueDesc(value_desc.get_parent_value_node(),value_desc.get_index()+1)); + done=false; + break; + } } } - } } }