You can build your own custom modules to add some functionality to Chataigne or support a specific system or device.
Custom modules are localized in the <Documents>/Chataigne/modules
folder.
To create a custom module, you first need to create a new folder inside the modules
folder. Inside this folder, you need a module.json
file that contains all of the module's metadata, as well as the module structure definition (values, parameters, commands, etc). You can find the description for the module.json
file below.
Most of the time, you'll also want to add a module script file. This file will handle all of the logic behind the module. You can read about how to write a module script here : Module Scripts
When you make changes to the module.json
file, don't forget to hit File > Reload custom modules
if Chataigne is running. You will also have to delete the module and create it back.
You can also add a 32x32 pixels icon.png
file in the module folder if you want to use a custom icon for your module.
You can find a custom module example here : https://github.com/tommag/Sample-Chataigne-module . Feel free to fork this repository to create your own module, and don't forget to share it with the community if you feel that it could be useful to someone else !
You can also create a "local" module by putting your module's folder inside a folder called "modules" aside the noisette file. In this case, this module will only be visible when the noisette file is loaded
module.json
file definitionIf you've never heard about json, you can check out a short explanation here : https://learnxinyminutes.com/docs/json/
Key | Description | Example |
---|---|---|
name |
The custom module name | "name":"My custom module" |
type |
The custom module type. It indicates which base module you want to extend. You can choose here any of the base module names. | "type":"WebSocket Client" |
path |
(Optional) The modules menu path. Choose one of the base submenus or create your own. | "path":"Hardware" |
version |
(Optional) The module version. | "version":"1.0.0" |
description |
(Optional) Module description | "description":"My module description" |
url |
(Optional) Where to find info about this module | "url":"<https://github.com/tommag/Sample-Chataigne-module>" |
downloadURL |
(Optional) Where to download this module | "downloadURL":"<https://github.com/tommag/Sample-Chataigne-module/archive/master.zip>" |
The following JSON keys let you decide what you want to keep from the base module. You can get the "short name" of the parameters that you want to control by hovering your mouse over the parameter and checking the control address.
Key | Description | Example |
---|---|---|
hasInput |
(Optional) Set to false if your module doesn't receive data. This will disable input streams (if applicable), hide the input activity monitor and hide the module values (unless alwaysShowValues is set). |
"hasInput":true |
hasOutput |
(Optional) Set to false if your module doesn't send data. This will disable output streams (if applicable) and hide the output activity monitor. | "hasOutput":true |
defaults |
(Optional) A collection of values to use for the base module parameters | "defaults": { "autoAdd":false } (for an OSC module) |
hideDefaultParameters |
(Optional) An array of the parameters you want to hide in the Inspector | "hideDefaultParameters": [ "autoAdd", "oscInput/localPort"] |
hideDefaultCommands |
(Optional) Set to true if you want to hide the base module commands (for example in an OSC module, hide the "Custom Message" command) | "hideDefaultCommands":false |
alwaysShowValues |
(Optional) Set to true if hasInput is set to false and you have no values in this module but you still want to be able to add them manually later |
"alwaysShowValues":true |
Check out the Data types section to learn more about the different data types and the options you can use for them.
Key | Description | Example |
---|---|---|
parameters |
A collection of the parameters that you want to add to the module | "parameters": { "My parameter": { "type":"Integer" } }" |
values |
A collection of the values that you want to add to the module | "values": { "My value": { "type":"Float" } } |
You can also set custom commands. Every command is linked to a "callback function" in the module script.