7.24. SetNodeTableValue

set_node_table_value ‐ Dynamic modification of the value of a table attached to a node

7.24.1. Attributes

NameTypeDefaults
idSTRINGNone (required)
indexINTEGERNone (undefined if not given)
valueINTEGER0
valueFLOAT0.0
valueSTRINGEmpty string
operatorSTRINGNone (required)

7.24.2. Description

This action is used to modify the values of a table variable associated with a scene node. If the index attribute is provided, the value i of the index attribute defines the rank of the table value that is modified. In this case, the value attribute must be a scalar. If the index attribute is not provided, all the values of the table are modified. In this case, the value of the value attribute must be an array of the same size as the target table. If so, the target table is assigned the value of the value attribute.

If the attribute values contain parenthesized expressions, they are dynamically evaluated as numerical expressions and their values are replaced in the attribute value strings. The string value of the operator attribute is an operator string. The values of the operator must be "=", "=", "+=", "-=", "*=", or "/=".

The values v of the value attribute are called source value(s). The string value id of the id attribute defines the reference to the target table. The target node must have a table named id. If so, the target table is assigned the source value(s).

7.24.3. Expected children

None.

7.24.4. Expected target

The target node must have a table named id.

7.24.5. Example

The first example below defines an action that modifies the three values of the table relativePhysLoc of the node main node. The target values are the values of the x_phys, y_phys, z_phys variables of the node birdPath_{#n}. (These values correspond to the translation of this node in its locate coordinates.) The second example assigns to the table absolutePhysLoc the outcome of the product of the inverse of the local matrix of the node birdPath_{#n} by the table relativePhysLoc of the node birdPath_{#n}.

<set_node_table_value id="relativePhysLoc" 
        value="({$bird {#n}:x_phys},{$bird {#n}:y_phys},{$bird {#n}:z_phys})" 
        operator="="/>
<set_node_table_value id="absolutePhysLoc" 
        value="(inv({@birdPath_{#n}:matrix}) * {@birdPath_{#n}:relativePhysLoc})" 
        operator="="/>
<target type="single_node" value="#birdPath_{#n}" />

The example below defines an action that modifies the ({$root:n})th value of a table . The target value is a random number between -2 and +2.

<set_node_table_value id="PositionsMotsX2" index="({$root:n})"
                      value="(rand(-2,2))" />