Houdini 20.5 Nodes Geometry nodes

APEX Script geometry node

Executes code snippets written with the APEX Script syntax.

On this page
Since 20.5
This feature is still under development. The current functionality is unfinished and subject to change, and may have thin or no documentation. Please bear this in mind when using it.

This node executes code snippets written in the APEX Script syntax, and creates an APEX graph that represents the snippet. The resulting graph can be executed using the APEX Invoke Graph SOP. The graph can also be used in combination with other graph operations, allowing for procedural graph modifications and workflows before it is executed.

Parameters

Clear Setup Parms

This button clears all the numerical and string spare parameters used as input parameters for the snippet.

Reload Setup Parms

This button adds or updates the numerical and string spare parameters used by the snippet. Inputs to the snippet can be defined using the BindInput() function in the snippet.

Snippet

The APEX Script snippet to execute.

Script

Inspect Line

When turned on, the specified line of code in the Snippet is colored red. This helps with debugging.

Debug

When turned on, prints out the underlying Python ast module syntax structure of the snippet.

Show Traceback

When turned on, shows all the error messages with a full traceback.

Decompile

Convert To Snippet

Converts the pre-shipped component script or graph input (in the second input of this node) to an APEX Script snippet. The functionality of the APEX Script snippet and the input graph are exactly the same.

Keep Node Positions

When turned on, adds the position metadata of all the nodes from the input graph to the decompiled APEX Script snippet. This generates considerably more lines of code.

Keep Node Color

When turned on, adds the color metadata of all the nodes from the input graph to the decompiled APEX Script snippet. This generates considerably more lines of code.

Subgraphs

When turned on, the extra Subgraphs snippet section is used.

Save Subgraphs

Saves or updates all the functions decorated with the @subgraph decorator to a subgraph library located at the path specified in the Geometry File parameter. Once saved, the subgraphs are available as global functions in any other APEX Script SOP, or as a subgraph in the APEX network view.

Clear Existing Library

When turned on, all the existing functions in a library are removed and replaced with the currently defined subgraph/global functions.

Geometry File

The location to save the subgraphs defined in the Subgraphs snippet.

Subgraphs

An APEX Script snippet that allows you to store functions decorated with @subgraph. The function is stored to disk as a subgraph, and can be used in any other node like a regular function (it acts like a global function).

Header

When turned on, a header and footer is added to the snippet. Headers and footers are predefined code snippets that are inserted before and after the current snippet, and are executed together with the snippet. The header and footer help to standardize common operations such as converting a geometry input to a graph and then back into a geometry, and fetching a rig graph from a packed character.

Template

The header template to use for the current snippet.

Basic

Adds an empty template.

Graph

Converts a geometry that is bound to one of the graph inputs to a graph (in the header), and rewrites the graph back to geometry (in the footer).

Component

Fetches the rig graph from a packed character geometry (in the header), and updates the packed character geometry with the graph at the footer.

Custom

Allows the user to edit the header and footer.

Add Version

When turned on, adds the Houdini version to the header, which sets the version of APEX functions to use. This allows for backward compatibility in case new versions of functions with different arguments are added. See special functions for more information.

Show

When turned on, shows the header and footer.

Edit

When turned on, allows the header and footer to be manually edited.

File

File Type

Defines the format used to store the snippet.

Graph

Stores or loads the snippet as a graph, with the snippet text stored as a detail property.

Text

Stores or loads the snippet from a text file.

Graph File

When File Type is set to Graph, this is the location to load or store the snippet as a graph.

Load As Snippet

When File Type is set to Graph, this loads the Graph File and interprets it as a snippet. If the graph was created with APEX Script, the snippet is fetched from the geometry’s detail property.

Save Graph

When File Type is set to Graph, this stores the current snippet as a graph, with the snippet text stored as a detail property.

Text File

When File Type is set to Text, this is the location to load or store the snippet as text.

Load Text

When File Type is set to Text, this loads the current text to the Snippet parameter.

Save Snippet as Text

When File Type is set to Text, this saves the current snippet to the specified Text File.

Invocation
Input Bindings

Dictionary To Bind

When turned on, sets the input graph parameters from the specified dictionary attribute connected to this SOP’s Invoke Input.

Bind To Geometry Parameter

When turned on, sets the specified geometry parameter on the graph from the geometry connected to this SOP’s Invoke Input.

Bind Named Primitives as Inputs

When turned on, attempts to set the geometry parameters on the graph from packed primitives on the geometry connected to this SOP’s Invoke Input, matching parameter names to the s@name primitive attribute.

Output Dictionary Bindings

Apex Outputs Group

The name of an output node in this SOP’s Invoke Input. All of the output ports on the output node are included in the dictionary written to the output geometry.

Output Attrib

The name of the dictionary attribute to create on the output geometry.

Do Bind Output Geometry

When turned on, copies the geometry in Bind Output Geometry to the Invoked output.

Bind Output Geometry

The geometry on the specified output port to copy to the Invoked output.

Force Reload Graph

When turned on, reloads and recompiles the graph from this SOP’s Invoke Input.

Note

This option is useful for debugging, but should not be used in production scenes, as performance will be severely impacted.

Enable Partial Evaluation

When turned on, provides partial evaluation optimizations on the graph by only executing the portions of the graph that:

  • Depend on input parameters that have changed.

    and

  • Contribute to the outputs requested by this node.

When turned off, the evaluation assumes that all input parameters have changed, and does not check the propogation of all the individual parameters through the graph. In some cases, this can actually lead to a performance improvement, especially when there are a large number of animated input parameters, as APEX will skip checking the propagation of the large number of changed graph inputs.

Note

If there are multiple parameters in a dictionary (multiple entries in an Attribute Adjust Dictionary SOP) that are connected to this node, but only one of the parameters is changed, APEX still executes the portions of the graph that are connected to all the parameters in the dictionary. To avoid this, create separate Attribute Adjust Dictionary SOPs for different sets of parameters to isolate the graph evaluation to specific groups of parameters.

Visualizer

Show

Specifies the graph to show in the APEX network view.

Component Script

The APEX Script snippet represented as a graph.

Output 1

The result of the execution of the APEX Script snippet.

Inputs

Invoke Input

The source data used for setting the APEX Script input parameters.

Outputs

Invoked

The result of the APEX Script invocation. These are the results fetched from the graph, specified in Output Dictionary Bindings and Bind Output Geometry.

APEX Script Graph

The APEX graph that represents the APEX Script snippet.

See also

Geometry nodes