BUTTONS_upBubble Up network editor tool

Take a selected node in a Network Editor pane and swap it (bubble up) with the node connected to the first input.

This tool does not work in the VOP context. This tool works best when you assign a hotkey to it.

Info
Date 01/12/2011
Compatibility Houdini 9.0
Dependencies nodeutils
Change Log Added the Bubble Up tool.
Tool Info
Submenu Utility
Network OBJ SOP POP CHOP ROP COP2 DOP
#
# Produced by:
#       Graham Thompson
#       captainhammy@gmail.com
#       www.captainhammy.com
#
# Name:         net_bubble_up.shelf
#
# Comments:     Take a selected node and bubble it up in the Network Editor.
#
# Version:      1.0
#
# Compatibility: Houdini 9.0
#
 
import nodeutils
 
# Get the pane the tool was invoked from.
pane = kwargs["pane"]
 
# If it isn't a Network Editor we need to look for some.
if not isinstance(pane, hou.NetworkEditor):
    # Get the current desktop.
    desktop = hou.ui.curDesktop()
 
    # Search for Network Editor pane tabs in the desktop that are the
    # current (displayed) tab.
    net_editors = [panetab for panetab in desktop.paneTabs()
                   if isinstance(panetab, hou.NetworkEditor)
                   and panetab.isCurrentTab()]
 
    # Throw an OperationFailed exception if none were found.
    if len(net_editors) is 0:
        raise hou.OperationFailed("No Network Editor pane tabs found.")
 
    # Set pane to be the first editor found.
    pane = net_editors[0]
 
# Get the current path of the editor.
cwd = pane.pwd()
 
# Get a list of the selected nodes.
selected_nodes = [child for child in cwd.children()
                  if child.isSelected()]
 
#TODO: Handle multiple nodes that are connected in a chain.
if len(selected_nodes) is not 0:
    for node in selected_nodes:
        nodeutils.swapPredecessor(node)

Valid XHTML 1.0 Strict