Plugins

From Synfig Studio :: Documentation
Jump to: navigation, search
m (Summary: Update note about what values can be retrieved)
m (little update about what can be retrieved : a certain time ++(the ones fixed by Waypoints)++)
Line 8: Line 8:
 
The Plugins feature 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.  
 
The Plugins feature 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.  
  
With the current script feature, has it work with the file itself you can't retrieve the current {{l|Time_Cursor}} position when the script is invoked. But you can know the value of a {{l|Parameter}} or {{l|ValueNode}} at a certain time, because the {{l|ValueNode#Animated ValueNodes|Animated Value Nodes}} are stored (other problem is to know the interpolated value, which is not trivial for other thing rather than {{l|Linear}} or {{l|Constant}} interpolation)
+
With the current script feature, has it work with the file itself you can't retrieve the current {{l|Time_Cursor}} position when the script is invoked. But you can know the value of a {{l|Parameter}} or {{l|ValueNode}} at a certain time (the ones fixed by {{l|Waypoints}}), because the {{l|ValueNode#Animated ValueNodes|Animated Value Nodes}} are stored (other problem is to know the interpolated value, which is not trivial for other thing rather than {{l|Linear}} or {{l|Constant}} interpolation)
  
 
All plugins are located in the "Plug-Ins" submenu of the canvas.
 
All plugins are located in the "Plug-Ins" submenu of the canvas.

Revision as of 12:05, 21 April 2014

Languages Language: 

English



Summary

The Plugins feature 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.

With the current script feature, has it work with the file itself you can't retrieve the current Time Cursor position when the script is invoked. But you can know the value of a Parameter or ValueNode at a certain time (the ones fixed by Waypoints), because the Animated Value Nodes are stored (other problem is to know the interpolated value, which is not trivial for other thing rather than Linear or Constant interpolation)

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

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.

How to install plugins

Plugin is a directory, containing the python script (*.py file), plugin.xml and maybe some other files if they are required by python script.

To install the plugin user should copy its directory into USER_DIRECTORY/SYNFIG_CONFIGURATION_DIR/plugins. For Linux case this is equivalent to "~/.synfig/plugins".

The system-wide location for the plugins is USER_DIRECTORY/SYNFIG_CONFIGURATION_DIR/plugins

Tutorial


Details

Each plugin located in a separate subdirectory with unique name. The part of the name before first "-" symbol is used to set the group 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 :

<?xml version="1.0" encoding="UTF-8"?>
<plugin>
   <name>Unhide All Layers</name>
   <name xml:lang="es">Activa todas las capas</name>
   <name xml:lang="eu">Erakutsi geruza guztiak</name>
   <name xml:lang="eu_ES">Erakutsi geruza guztiak</name>
   <name xml:lang="fr">Afficher Tous les Calques</name>
   <name xml:lang="lt">Parodyti visus sluoksnius</name>
   <name xml:lang="ru">Показать все скрытые слои</name>
   <exec>view-unhide-all-layers.py</exec>
</plugin>

All scripts are interpreted with python 3.

In Linux and Mac OSX case Synfig Studio looks for "python" or "python3" binary. For windows case Python binary is expected at INSTALL_PREFIX/python/python.exe. New environment variable SYNFIG_PYTHON_BINARY allows to set custom path to the python 3 binary.


Languages Language: 

English