Create & Format Node
This function outlines the process for adding a geo node to the object network and formatting some of its display settings. The same process can be applied to nodes in other networks and can be a utility for the
456.py startup files to automate its creation upon loading Houdini.
Set Node Shape
Using the available options noted in the list Node Shapes, the following snippet can be used to set a node's shape.
Add Custom Metadata To Node
The prefix of "nodeinfo_" is recognized by Houdini and allows for the custom metadata to be viewed in node info, as shown to the right.
Specify Node Creator
Create Network Boxes with Names
Network Box Comment
Network boxes have a field at the top of each where a string can be input to serve as a title; this is noted as the network box's 'Comment'. Multiple network boxes can have the same 'Comment' without issue.
Network Box Name
However, at the same time, each network box has a unique identifier as noted by its 'Name'. With Python, the
createNetworkBox() method includes an argument to specify the unique name for each network box.
The value applied to this 'Name' is not visible from the network view, but can be called with Python using the following:
which then returns the following:
Get/Set Default Sticky Note & Network Box Colors
Get and set default colors for Houdini sticky notes, text, and network boxes. Default Houdini color codes are outlined in the following list: Default Node Colors.
Sets the default color that will be used for new network elements such as network boxes and sticky notes. Node default colors are controlled with methods on the hou.NodeType for each node type. The color parameter can either be a hou.Color or None, in which case the default color is cleared, and the standard default colors are used.
Group Name Via Operator Label
Group SOP can use this script to set the group name to the name of the node, which mitigates the need to set the group name parameter within the SOP and the SOP name itself. Ultimately, this aligns the name of the node with the group name and can help with keeping group names organized.
Add Custom Parameters To Nodes
This script is intended to add custom parameters and folder organization to nodes for relaying parametric data to other nodes in the network, such as a control panel for an HDA.
Add Custom Parameter Values To Nodes
Method for setting parameter values with specified data type or expressions.
Clarification of the available operations that can be applied to a menu parameter.
Numeric Digits From Node Names
Python Module code requires the HDA naming to be specified as
Search Nodes By Name & Composite Query
Using the nodesearch module, queries can be composed with matcher objects that isolate specific criteria, but can then be used individually or as part of a composite matcher group. In this example, the 2 geo and 1 material network nodes all have the string "sphere" in their names. The following matchers isolate by name and type, but are then combined.
The script above returns the following output based on the type of matcher.
Query By Name
(<hou.ObjNode of type geo at /obj/sphere0>, <hou.ObjNode of type geo at /obj/sph ere1>, <hou.ShopNode of type matnet at /obj/sphere2>)
Composite Query: By Name & Type
[<hou.ObjNode of type geo at /obj/sphere0>, <hou.ObjNode of type geo at /obj/sph ere1>]
Rename Primitive Attribute Values
Python snippet for use in Houdini to rename a primitive attribute string value.
Callbacks are triggered by user-specified parameter value changes or via the
parm.pressButton() function. For instance, the following links the color parameter select with the node color using a Python script callback.
In the case of an HDA created inside of a GEO node, the following function is created within the
Python Module event handler:
Meanwhile, the following call to the function above is made in the
On Created event handler within the same HDA:
The output notes how each of the event handlers recognizes the corresponding node when the function is called from the
On Created event. It reflects the HDA as the node while the
Python Module recognizes the parent node, geo, as the node.
Node from OnCreated: hda Node from Python Module: geo
kwargs global dictionary variable.
kwargs to get node and parameter information can be coordinated with the node's
Python Module and individual callback scripts for each parameter.
Output when the string parameter is triggered:
Node Name: hda Parameter: <hou.Parm string_parm in /obj/geo1/hda> Parameter Name: string_parm Parameter Value: ['custom string']
Output when the integer vector parameter is triggered:
Node Name: hda Parameter: <hou.Parm int_vector_parmx in /obj/geo1/hda> Parameter Name: int_vector_parm Parameter Value: ['0', '1', '2']
Output when each of the multiparm instances are triggered:
Parameter Name: float_vector_parm1 Parameter Index: 1 Parameter Name: float_vector_parm2 Parameter Index: 2 Parameter Name: float_vector_parm3 Parameter Index: 3
Dialog Message Boxes
hou.ui module, the following are some opportunities to provide user feedback in the form of a dialog box with interactive buttons.
Details Label toggle displays the section with additional details, as specified in the argument.
Python Script In Node
Add a string parameter to the selected node and enable the following options:
Callback Scriptto the following, which navigates to the user-defined content within the Python panel and executes it whenever the content is changed.
- An alternative is to add a button to the node and have the above snippet input into its
Callback Scriptfield. This will allow the user to click the button to specify when to run the code input into the node's new Python panel rather than automatically whenever it is changed.
The following collects all of the above and collects them into a script to add the Python panel to selected nodes.
123.py & 456.py Startup Scripts
Upon starting up Houdini, the
123.py startup script file is configured in Python to automate the creation of several nodes and specific settings in the
out networks. This includes the configuration of relevant parameter settings, all with the intent of being able to quickly start a project file consistently and with a basic project management structure.
My own custom
456.py startup scripts as well as collection of custom scripts are currently kept updated in the following GitHub repository and are available for anyone's use and own customization.
Edit Network Editor UI Preferences
Edit UI preferences for a Network Editor pane in a Houdini desktop/session via Python. Available preferences are noted in the following list Editor Preferences.
This enables the realtime playback toggle on Houdini playbar. It can be integrated within the startup script to have it enabled when Houdini is opened.
Global Animation Options
FPS Frames Per Second sets the rate for animation playback when Real Time playback is enabled. You generally want to set the FPS for your animation only once, and do so before you begin animating anything at all. This is because when you change the FPS, the time of the last keyframe will not match the new animation length.
Remove all Python callbacks that have been registered with hou.playbar.addEventCallback(). Remove all Python callbacks that have been registered with hou.playbar.addEventCallback(). Return a tuple of all the Python callbacks that have been registered with hou.playbar.addEventCallback(). Return a tuple of all the Python callbacks that have been registered with hou.playbar.addEventCallback().
These images capture some of the aspects that the workspace automation script addresses, namely the creation, formatting, and placement of nodes in the applicable networks:
obj (Fig. 1),
mat (Fig. 2), and
out (Fig. 3). Other setup operations include configuring light and camera placements in the scene, material setups within each of the
RS Material Builder nodes, and
Redshift ROP node settings.
External Python Editor
Setup Environment File
Setup PyCharm to be the external editor for Houdini by specifying it in the Houdini Environment file as follows:
# PYTHON EDITOR EDITOR = "<ABSOLUTE_PATH_TO>\pycharm64.exe"
Python from PyCharm To Houdini
External Python Source Editor will open a Python file in PyCharm titled
__python_source_editor.py that can be used to input Python for use in the current Houdini session.
Hython to PyCharm
In PyCharm, add the following paths to the Interpreter's Paths collection:
PATH: $HFS/bin PATH: $HFS/houdini/python3.7libs
Note that the file may be capped by PyCharm's file size limit, but if encountered, can be resolved with this resolution.
To autocomplete the Houdini library, set the following path as a
Resource in the
Classes appended with _swigregister are included in the list simply because the hou module is constructed with swig.
geo = hou.node('obj/geo1') tx = geo.parm('tx') tx.eval() tx.set(5.0)
hou.session is stored in the .hip file
Available under the Windows menu
Functions defined here are stored in the hou.session module
Python in HDAs
Reference the following section for an example of applying Python States in HDAs.
Function defined in PythonModule (Edit Operator Type Properties > Scripts > Event Handler > Python Module) can be accessed in Python using hdaModule()
External .py files can be added to HDA in this Scripts section via
Guide for installing additional libraries:
- Copy get-pip.py file from link to Houdini's Python directory.
- In command prompt shell, navigate to Houdini's Python directory and run copied file to install pip:
Viewport Color Schemes Location:
C:\Program Files\Side Effects Software\Houdini <version>\houdini\config
List of schemes:
Default Node Colors
The following RGB values are for the default node colors available in the
Color Palette for use in the
Network View. The palette can be accessed with the
C keyboard shortcut. These RGB values can be used with
hou.Color(), as shown above in Create & Format Node.
This is used access the available list of node shapes under the
Shape Palette for use in the
Network View. The shapes can be accessed by way of the
Z keyboard shortcut.
Network Editor UI Preferences
List of available UI preferences for a Network Editor pane in a Houdini desktop/session.
On This Page
- Content Creation
- Create & Format Node
- Set Node Shape
- Add Custom Metadata To Node
- Specify Node Creator
- Create Network Boxes with Names
- Get/Set Default Sticky Note & Network Box Colors
- Group Name Via Operator Label
- Add Custom Parameters To Nodes
- Add Custom Parameter Values To Nodes
- Menu Parameters
- Node Data
- Numeric Digits From Node Names
- HDA Module
- Search Nodes By Name & Composite Query
- Attribute Management
- Rename Primitive Attribute Values
- Event Handlers
- Keyword Arguments
- User Interface
- Dialog Message Boxes
- Python Script In Node
- Workspace Settings
- 123.py & 456.py Startup Scripts
- Edit Network Editor UI Preferences
- Playbar Configuration
- Process Automation
- External Python Editor
- Setup Environment File
- Python from PyCharm To Houdini
- Configuring PyCharm
- Hython to PyCharm
- hou Module
- hou.session SubModule
- Python in HDAs
- Additional Libraries
- Workspace Configuration
- User Interface
- Houdini Resources
- Default Node Colors
- Node Shapes
- Network Editor UI Preferences
- Python Resources