-
Notifications
You must be signed in to change notification settings - Fork 1
XML node description
On the behaviours client side, there exists the need to setup the configuration of the nodes. Each node can have several parameters and depending on such parameters change the specific behaviour. For example the timeout node needs to know each how many seconds it needs to be activated.
This setup also contains several documentation bits.
For example, the timeout has this definition:
<node-description id="timeout">
<name lang="en">Timeout</name>
<name lang="es">Temporiz.</name>
<description lang="en">Triggers the event every T seconds.</description>
<description lang="es">Activa el evento cada T segundos.</description>
<type>event</type>
<icon src="timeout.png"/>
<params>
<param id="timeout">
<type>float</type>
<description lang="en">Seconds between event each event activation </description>
<description lang="es">Cada cuantos segundos se activa el evento </description>
<max>100</max>
<min>0.1</min>
<default>0.5</default>
</param>
</params>
</node-description>Every node must be described into a node-description and provide an id attribute that must match the server side type name. Textual elements can be repeated and have with a lang attribute used for internationalization.
Nodes can be described just one per XML file, or several in a single XML file. If there are several all them must be inside a node-descriptions tag. See here for a full example.
The XML files must be on each plugin static/nodes directory; the name is not important as all XML in this directory will be loaded.
These are the known attributes:
The name of the attribute, as presented to the user
Long description as presented to the user at the help (TODO).
The type of node, needed to classify it, and propose the proper default drawing.
Icon name, stored at /static/img/[name].png.
Javascript file to load into the client. Normally this code expands or adds the node type, adding a custom representation on both the node on the graph and edition, but it has access to modify all it wants.
List of parameters on this node type, each param must have an id that matches the server implementation name, and may have a definition on how to edit it on the interface. Default type is a text line.
The type of the parameter, depending on the type it may have more type definitions, for example float needs to know the limits max and min.
Known types are:
- string (default)
- float
- array
If your type is more complex and needs a custom interface, all interface can be modified using javascript.
Description of the parameter.
Default value of the parameter
Maximum value.
Minimum value