Skip to content

XML node description

David Moreno Montero edited this page May 24, 2013 · 4 revisions

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:

Elements

name

The name of the attribute, as presented to the user

description

Long description as presented to the user at the help (TODO).

type

The type of node, needed to classify it, and propose the proper default drawing.

icon

Icon name, stored at /static/img/[name].png.

js

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.

params

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.

type

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

Description of the parameter.

default

Default value of the parameter

max (only float)

Maximum value.

min (only float)

Minimum value

Clone this wiki locally