Houdini 20.0 Nodes APEX Nodes

RunVex

Executes a vex snippet.

On this page
Since 20.0

This node empowers users to implement their own callbacks using the vex language. Each input and output port is accessible as a variable in the vex snippet. The port names dictate the names of the bound variables. In the vex snippet, users should read from the input variables, perform the user defined calculations, and write the results to the output variables.

Here is an example of a vex snippet which calculates various properties of a circle:

diameter = 2*radius;
circumference = 2*M_PI*radius;
area = M_PI*radius*radius;

There a couple of noteworthy observations to make about this snippet:

  1. The constant M_PI is available to us because “math.h” is implicitly included for convenience.

  2. The snippet writes to three undeclared variables (diameter, circumference, and area). These are the names of the node’s output ports. They are accessible because the node binds the output ports to variables of the same name.

  3. The snippet reads from the undeclared variable radius. This is the name of the node’s input port, so it is bound to variable of the same. The input variables are read only, so an error is generated if an attempt is made to assign it a new value.

Here is an example of a graph which reads the radius from the input, calculates the circle statistics, and writes the results to an output.

  1. Take note that RunVex node “calculate_circle_stats” has an input port named radius and output ports named diameter, circumference, and area. These are the names of the bound variables in the vex snippet.

  2. There are several Value<Float> nodes between the input and output nodes. These nodes are placed in the graph so that the RunVex node recognizes the data type of the variable it is binding. The ports on the input and output nodes are gray, and therefore do not provide sufficient type info to the RunVex node. The value nodes are not necessary when connecting port for other nodes which have an explicit type.

Tip

Set the “Error Handling” parameter to “Report as Warnings” on the APEX Edit Graph node to more easily identity errors when using the RunVex node.

Supported Apex Types In Vex

Apex Type

Vex Type

Int

int

Float

float

Vector2

vector2

Vector3

vector

Vector4

vector4

Matrix3

matrix3

Matrix4

matrix

String

string

Dict

dict

IntArray

int

FloatArray

float

Vector2Array

vector2

Vector3Array

vector

Vector4Array

vector4

Matrix3Array

matrix3

Matrix4Array

matrix

StringArray

string

DictArrayh

dict

Inputs

snippet: String

Vex code implementing the user defined callback behavior.

inputs: VariadicArg<void>

Each connected input is bound to a read only variable in vex. The port name dictates the name of the bound variable.

Outputs

outputs: VariadicArg<void>

Each connected output is bound to an assignable variable in vex. The port name dictates the name of the bound variable.

APEX Nodes