On this page |
Using the Plug-in Programmatically ¶
The plug-in can be used programmatically instead of just through the UI. This allows to create custom tools and workflows around Houdini Engine, but does require knowledge of C# scripting within Unity.
There are several layers of programmatic interfaces available, ordered from high to low levels of access:
-
Interface Layer
-
Asset Layer
-
Utility Layer
-
HAPI Layer
The layers are described below. Note that these layers are loosely defined and can be used together if needed.
Interface Layer ¶
As of Houdini 19, all classes and functions intended to be a part of the public API (With the exception of PDG-related classes) inherit from interface classes, prefixed by I. Here are examples of some of some interfaces that you may find useful to look over:
Class |
Description |
---|---|
|
This is the interface for |
|
This is the interface for modifying HDA parameters |
|
This is the interface for modifying HDA inputs |
Asset Layer ¶
This is the highest programming interface layer available, and is used by the plug-in’s own user interface to query and interact with Houdini Engine. It is recommended to use this layer if working with HDAs for simple parameter querying and manipulation.
The layer covers several classes:
Class |
Description |
---|---|
|
This is the root component for a Houdini Engine asset in Unity. It is lightweight and simply serves as the root in the hierarchy as well as to provide the user interface |
|
This is the main asset component containing all the meta data for the asset, as well as functionality to build, cook, query, and modify the asset |
|
This contains convenience functions to query and modify parameters on an asset |
An example of using this layer can be found in Plugins/HoudiniEngineUnity/Scripts/Examples/HEU_ExampleEvergreenQuery.cs. Another great example is the HEU_HoudiniAsset::DuplicateAsset function which instantiates an HDA, and copies data from another HDA.
Utility Layer ¶
This is considered a mid-level programming interface layer, and is widely used by the plug-in to interact with the Houdini Engine. It is recommended to use this layer if working with HDAs, nodes, connections, and building more complex networks dynamically.
The layer covers several utility classes:
Class |
Description |
---|---|
|
Contains helper functions for doing Houdini Engine specific work, such as creating nodes, loading assets, cooking, and a variety of conversion functions for transmitting data to and from Houdini |
|
Contains general helper functions for common tasks |
|
Contains general helper functions for Unity Editor-specific tasks |
|
Contains the input mechanism for create input nodes, uploading data, and managing custom input hooks. See Custom Input Scripts |
|
Contains helper functions for uploading mesh data into Houdini |
|
A geometry cache class containing data buffers and functions for generating and converting polygonal output data from a Houdini node or asset |
|
A geometry cache class containing data buffers and functions for generating and converting output data from a Houdini volume |
|
Contains helper functions for generating and managing Unity materials, based on output from Houdini |
|
Contains helper functions to create and manage Houdini Engine sessions |
|
This wraps a Houdini Engine session, and provides convenient wrapper and helper functions to interact with the session. Almost all of the Houdini Engine API calls for the plug-in go through here |
An example of using this layer can be found in _Plugins/HoudiniEngineUnity/Scripts/Examples/HEU_ScriptMeshInputUVLayoutExample.cs_. It shows how to create input node, upload mesh data, connect to a UVLayout node, and generate the output mesh as a copy or replace it.
HAPI Layer ¶
This is the lowest programming interface layer in the plug-in. This is essentially directly interacting with Houdini Engine API (HAPI) using the imported native functions and data structures. It is recommended to use this layer if need full control over the use of Houdini Engine within Unity, and wanting to forego the use of the plug-in.
The layer consists of just the import classes:
Class |
Description |
---|---|
|
Contains the Houdini Engine API data structures redefined in C# for .Net |
|
Contains the Houdini Engine API function imports in C# for .Net |
A good reference for usage of this layer is the Houdini Engine API documentation.
Another good reference would be the plug-in code itself, such as the higher level layers described above.