Chapter 5. VC Element References

This chapter provides a detailed definition of the syntax and semantics of VC scene description language. VC markups divide into three categories: media objects, transformations, materials, and elements:

5.1. AliasScript (element)

<aliasScript> ‐ An alias script

5.1.1. Attributes

NameTypeDefaults
idIDNone (required)

5.1.2. Description

This element is used to contain a script of commands triggered by input OSC messages made of an address and a list of parameters. The alias script is attached to the root node of a scene graph.

Alias script commands have no triggers since they are automatically triggered by OSC messages. For this purpose, alias script commands must all have a pattern attribute. The pattern value of the pattern attribute is a string that defines a filter for OSC commands. Only OSC commands that match the pattern string can trigger the corresponding script command.

The pattern value of the pattern attribute has the same syntax as an OSC command. (OSC commands are described in the udp_remote_client element.) Each pattern is made of:

  • An address: a string made of the contatenation of '/' characters followed by a sequence of alphanumerical characters. For instance, /here/and/now is a correct address.

  • A list of parameter types: parameter types are defined by 's' for strings, 'f' for floats, and 'i' for integers. For instance, s f f i is a list of four parameters: a string, two floats, and one integer, in this order. The values of the parameters of the matching OSC commands can be used in the actions that build up the corresponding command. they must be referenced by {$1}, {$2}, {$3}... and they must be embedded into parenthesized expressions in order to be evaluated. The index correspond to the rank of the parameter in the OSC command. In our case, {$1} refers to a string, {$2} and {$3} to a float, and {$4} to an integer.

5.1.3. Expected child

This element expects a list of commands as child nodes.

5.1.4. Example

In the example below, the alias script contains one command. The command is triggered by the reception of an OSC command made of the /rotateeye address and two parameters: one string and one float. The first action associated with this command modifies a rotation angle by accessing the value of the scalar angle of the node with the ID "({$1}) rotX" (where ({$1}) is the string value of the first parameter). The second action modifies a rotation angle by the value of its second parameter (a float). The node IDs of the targets of these two action are strings that are defined by using the string value of the first parameter.

<aliasScript>
  <command pattern="/rotateeye s f">
    <action>
      <set_node_attribute_value operator="=">
        <transformation angle="({$({$1}) rotX:angle})" />
      </set_node_attribute_value>
      <target type="single_node" value="#rotX ({$1}) 1" />
    </action>
    <action>
      <set_node_attribute_value operator="=">
        <transformation angle="({$2})" />
      </set_node_attribute_value>
      <target type="single_node" value="#rotX ({$1}) 2" />
    </action>
  </command>
</aliasScript>