synfig/synfig — pull request #1 by morevnaproject (2012-06-08 08:16:19+00:00)
Title: Plugins

= Summary =
This modification allows to run custom python scripts directly from Synfig Studio menu. Each script takes .sif file as first argument and should modify its contents in some way. After script execution finished the file is automatically reopened back in Synfig Studio.

= Rationale =
People often write some scripts to make useful things on Synfig (sif) files. The most of these scripts are written in python. But for ordinary users running custom scripts from terminal is tricky. With plugins feature user can install scripts as easy as they copy files and transparently run them in the same way as they use standard Synfig Studio commands. Also, runing scripts from menu is much faster than from terminal and it greatly improves the workflow for advanced users. Having this feature allows to easily add simple functions to Synfig Studio by writting scripts in python.

= Details =

All plugins are located in the "Plug-Ins" submenu of the canvas.

Plugins are read from two places:
* System location: INSTALL_PREFIX/share/synfig/plugins
* User location: USER_DIRECTORY/SYNFIG_CONFIGURATION_DIR/plugins
Each plugin located in a separate subdirectory with unique name. The part of the name before first "-" symbol is used to set thegroup plugin belongs to (not implemented yet). The main information about plugin (plugins name and script to execute) is stored in the plugin.xml file. It's self-explanatory.

There is a sample plugin to add simple skeleton (stickman) into current document.

All scripts are interpreted with python. That means that we should bundle python into Windows build. For windows case Python binary is expected at INSTALL_PREFIX/python/python.exe.

New env variable SYNFIG_PYTHON_BINARY allows to set custom path to the python binary.

= ToDo List =

* Add support for localizing script names (using intltool)
* Group plugins into different submenus of "Plug-Ins" menu
* Add more plugins

P.S. Apologies if my code is crappy. ^__^"