In the attached example, selecting and moving the purple star over the colored circles will change the color of the circle on the canvas by automatically changing the alpha channel amount value of the layers to zero or one depending on the place of the purple star . Would it be possible to write a python script that writes a new sif.file containing only the layers that have a alpha channel amount value of 1 without deleting the original file? Looking further than a few circles, imagine a character with 10 different heads, 10 different hairstyles, 10 different beards etc… The script would then pick the ones that are visible and dump the rest. So that you have one character file with a specific head and a specific hairstyle etc without the need to carry all the other possibilities into the newly created file. In other words you will get some kind of character generator in which you can choose certain elements and the script saves your choices to a valid file with only one head, one hairstyle etc…
switchlayer.sifz (5.69 KB)
if have done a little test script for you … and others also … this one simply copy current file to “same_path/new_filename” .
I have thinked also that you can use metadata panel to give extra argument to the plugin (layer to hide name list ?)
if “”"<meta name=“plugin-layerlist” “”" in line:
test-file-duplicate.zip (1.29 KB)
How to install : wiki.synfig.org/wiki/Doc:Plugins
this is possible you use the open() function with one of the following options – “x” or “w” – to create a new file** : “x” – Create: this [word combine] generator command will create a new file if and only if there is no file already in existence with that name or else it will return an error.