Houdini 19.5 Examples Python panel examples

Node path

How to listen for changes to the current node path.


In this example, the onNodePathChanged(node) hook is implemented in the Python Panel code in order to listen for changes to the current node path.

Select different nodes, jump in and jump out of nodes to see the Python Panel follow the current node.

<?xml version="1.0" encoding="UTF-8"?>
  <!-- This file contains definitions of Python interfaces and the
 interfaces menu.  It should not be hand-edited when it is being
 used by the application.  Note, that two definitions of the
 same interface or of the interfaces menu are not allowed
 in a single file. -->
  <interface name="NodePathExample" label="Node Path Example" icon="hicon:/SVGIcons.index?DATATYPES_node_path.svg" showNetworkNavigationBar="true" help_url="">
    <script><![CDATA[from hutil.Qt import QtWidgets

class NodePathExample(QtWidgets.QWidget):
    def __init__(self):
        super(NodePathExample, self).__init__()

        instruction_label = QtWidgets.QLabel(
            "Please navigate the Houdini node network using the network editor.")

        self.currentNodePathLabel = QtWidgets.QLabel()

        layout = QtWidgets.QVBoxLayout()


    def updateCurrentNodePathLabel(self, node_path):
        self.currentNodePathLabel.setText("Current Node Path: %s" % node_path)

theExampleWidget = NodePathExample()

def onCreateInterface():
    global theExampleWidget
    return theExampleWidget

def onNodePathChanged(node):
    global theExampleWidget

    if node:
        node_path = node.path()
        node_path = "None"

    <includeInToolbarMenu menu_position="102" create_separator="false"/>

Python panel examples

  • Custom Graphics

    Custom OpenGL drawing in a Python Panel.

  • Drag and Drop

    How to implement drag and drop functionality in a Python Panel.

  • Linked parameters

    How to link PySide parameter widgets (i.e. text fields and sliders) to Houdini node parameters and vice versa.

  • Node path

    How to listen for changes to the current node path.

  • Qt designer

    How to load user interface layout from a Qt Designer file.

  • Qt events

    How Python Panels can listen to Qt events.

  • Viewport color editor

    A PySide interface for editing viewport colors.