Automatically export the Index parameter of new Duplicate layers.
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 7 Jan 2008 18:06:03 +0000 (18:06 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 7 Jan 2008 18:06:03 +0000 (18:06 +0000)
git-svn-id: http://svn.voria.com/code@1283 1f10aa63-cdf2-0310-b900-c93c546f37ac

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

index bc2f180..33b6273 100644 (file)
@@ -193,6 +193,22 @@ CanvasInterface::add_layer_to(synfig::String name, synfig::Canvas::Handle canvas
                return 0;
        }
 
+       // automatically export the Index parameter of new Duplicate layers
+       if (name == "duplicate")
+               for (int i = 1; ; i++)
+               {
+                       String name = strprintf(_("Index %d"), i);
+                       try
+                       {
+                               canvas->find_value_node(name);
+                       }
+                       catch (Exception::IDNotFound x)
+                       {
+                               add_value_node(layer->dynamic_param_list().find("index")->second, name);
+                               break;
+                       }
+               }
+
        layer->set_canvas(canvas);
 
        // Apply some defaults