Convert static lists entirely consisting of blinepoints into 'bline' valuenodes,...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sun, 17 Feb 2008 20:43:03 +0000 (20:43 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sun, 17 Feb 2008 20:43:03 +0000 (20:43 +0000)
git-svn-id: http://svn.voria.com/code@1741 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/synfigapp/canvasinterface.cpp

index 0677669..c062522 100644 (file)
@@ -234,9 +234,27 @@ CanvasInterface::add_layer_to(synfig::String name, synfig::Canvas::Handle canvas
                {
                        ValueNode::Handle value_node;
 
-                       // if we find any which are list values then make them into dynamic list valuenodes
+                       // if we find any which are list values then make them
+                       // into dynamic list valuenodes, unless every element of
+                       // the list is a blinepoint, in which case convert it to a
+                       // bline
                        if(iter->second.get_type()==ValueBase::TYPE_LIST)
-                               value_node=LinkableValueNode::create("dynamic_list",iter->second);
+                       {
+                               // check whether it's a list of blinepoints only
+                               vector<ValueBase> list(iter->second.get_list());
+                               if (list.size())
+                               {
+                                       vector<ValueBase>::iterator iter2;
+                                       for (iter2 = list.begin(); iter2 != list.end(); iter2++)
+                                               if (iter2->get_type() != ValueBase::TYPE_BLINEPOINT)
+                                                       break;
+                                       if (iter2 == list.end())
+                                               value_node=LinkableValueNode::create("bline",iter->second);
+                               }
+
+                               if (!value_node)
+                                       value_node=LinkableValueNode::create("dynamic_list",iter->second);
+                       }
                        // otherwise, if it's a type that can be converted to
                        // 'composite' (other than the types that can be radial
                        // composite) then do so