Anatomy of a plugin
Everything a plugin can declare. All of it is optional except the id and the name.
What it can declare
| Key | Adds |
|---|---|
id, name | Required. The id is the plugin's own short name (letters, digits, - . _), unlike any other plugin's. |
about, author | Shown in the list of plugins. |
version | The plugin's version, such as 1.2.0. A later one that is released is offered as an update. |
icon, color | The plugin's sign and the color it is shown on, in the list of plugins and in the catalog. |
tools | Tools in the toolbox. |
elements | Things to insert that the plugin draws itself, with adjustable settings. |
properties | A group of settings in a layer's properties. |
effects, filters | Live effects in the effects window; one-off filters in the Filter menu. |
backdrops | Background effects a theme can use. |
overlays | Drawing over the picture on the canvas. |
docks | A whole view of the plugin's own, opened from the toolbox. |
animations | Something drawn as the loop runs, played and exported as an animation. |
exports | Kinds of file in the export window. |
inserts, commands | Items in the Insert menu; commands in a Plugins menu. |
templates, palettes, sizes | Templates to start from; color palettes; image sizes. |
settings, uses | Settings of the plugin's own; whether a project needs the plugin. |
Things a plugin adds are known inside the program as pluginId:key. A tool with the key spray in the plugin example is example:spray.
Fields
Wherever a plugin has settings (a tool's, an element's, a filter's, a window's, its own), they are a list of fields.
fields: [
{ key: 'amount', label: 'Amount', low: 0, high: 100, step: 1, usual: 50 }, // a slider with a number
{ key: 'tint', label: 'Color', usual: '#F7C56B', color: true }, // a color
{ key: 'size', label: 'Size', usual: 'Medium', choices: ['Small', 'Medium', 'Large'] }, // one of several
{ key: 'outline', label: 'Outline only', usual: false, toggle: true }, // on or off
{ key: 'title', label: 'Title', usual: '', text: true }, // a line of text
],
from rassam import slider, color, choice, toggle, text
fields = [
slider('amount', 'Amount', 0, 100, 50, step=1), # a slider with a number
color('tint', 'Color', '#F7C56B'), # a color
choice('size', 'Size', ['Small', 'Medium', 'Large'], 'Medium'), # one of several
toggle('outline', 'Outline only', False), # on or off
text('title', 'Title', ''), # a line of text
]
usual is the value a field starts with. A number may have a unit, a few letters shown after it. What is set arrives as settings, keyed by each field's key (in Python, also as attributes: settings.amount).
Icons
Where an icon is asked for, it is the name of one of the program's own signs, among them: Brush, Pencil, Eraser, Fill, Wand, Gradient, Line, Rectangle, Ellipse, Polygon, Text, Layer, Media, Canvas, Slot, star, plug, gear, points, play, open, user. An unknown name shows the plug.