The addon_loader.lua
script aims to load external programs or scripts as Graphite add-ons.
- Graphite > v3-1.8.8
- Download the script file
addon_loader.lua
- Put this script into a directory of your choice, preferably in a non-volatile directory with a well-formed path
You have to go to File -> Preferences -> Startup
and add the lua script addon_loader.lua
. Don't forget to click on Save Config.
and restart Graphite.
Graphite will start and execute this script. A menu Add-ons
should appear.
You can add many add-ons at once by choosing an add-ons directory via the menu Add-ons -> Manage add-ons -> Choose add-ons directory
. The directory will be scanned (browsing all subdirectories) and all executables with extension .exe
or .addon
will be recognized as add-ons.
When you add or remove an add-on or change its interface, you have to synchronize Graphite with these modifications. You can update your add-ons by via the menu Add-ons -> Manage add-ons -> Synchronize and Quit
. One this command applied Then, you have to restart Graphite manually.
As you probably don't have any add-ons at hand, we've put together a series of small add-on examples for you. You can go to:
https://github.com/ultimaille/graphite-addon-examples/releases/tag/v2.0
You will find binary of add-ons that you can add to Graphite.
Note: Mac OS binaries are not signed, but we hope that this will be the case in the future.
To turn a program into an add-on recognizable by addon_loader
, your program must:
- Have
.exe
or.addon
extension, for example:my_program.exe
,my_program.addon
- Respond to the
--show-params
argument, returning program parameters as EPF format - Accept to be called with arguments as the following format:
k1=v2 k2=v2 ... kn=vn
withki
the parameter name andvi
the value of the parameter (e.g:my_program param_string=hello param_bool=true param_int=1 ...
)
Note: for the programs written in C++, we encourage you to use https://github.com/ultimaille/param-parser. This micro library help you to declare parameters and return EPF format when --show-params
is requested.
You will find add-on source C++ examples at https://github.com/ultimaille/graphite-addon-examples.
To enable Graphite loading add-ons and generate the appropriate user interface (UI), it is necessary to present program parameters in a specific format that can be read and understood by Graphite. Let's call this format EPF format for External add-on Format / Expose Parameter Format.
This format is obtained by Graphite when executing addon_loader.lua
by calling a program with --show-params
argument, returning program parameters as EPF format.
EPF format is very simple and looks like this:
#This file contains reflexion information for calling a binary file
name=param1;type=bool;value=false;possible_values=undefined;description=A bool;type_of_param=undefined
name=param2;type=double;value=0;possible_values=undefined;description=A double;type_of_param=undefined
...
Each line contains data about one parameter:
- name: parameter name (displayed as a label in UI)
- type: parameter type {int, float, double, bool, string, file, input}
- possible_values: a list of values to be selected if parameter is an enum
- description: a description of the parameter that can be displayed as a tooltip text in UI
- type_of_param: {basic, advanced or system} describe how the parameter should be appear in UI
- visible (optional): indicate whether the parameter is visible in the UI
Line that start with #
are comments.