Jump to content

Current Network View


csp

Recommended Posts

Apparently this code work only from inside self-tool script! When I try to run it though an imported script as part of pyqt interface will not work because of kwargs.

 

EDIT: No worries, I fixed it myself, again! I pass the kwargs as argument to the imported script.

Edited by cparliaros
Link to comment
Share on other sites

I will continue to correct myself as nobody else willing to contribute ;)

Apparently the script above will give me the parent node of the active Scene View pane which will always be under /obj.

But what I want is the parent node of the active Network View pane. I can't find anything one that.

Link to comment
Share on other sites

The parent node of the active Network View pane

import hou

def activeNetworkPanes():
    desktop = hou.ui.curDesktop()
    panes = desktop.paneTabs()
    network_panes = []
    
    for pane in panes:
        if isinstance(pane, hou.NetworkEditor):
            if pane.isCurrentTab():
                network_panes.append(pane)
        
    return network_panes

root_node = None
selected_nodes = hou.selectedNodes()
network_panes = activeNetworkPanes()

if selected_nodes:
    root_node = selected_nodes[-1].parent()
elif network_panes:
    root_node = network_panes[0].pwd()
  • Thanks 1
Link to comment
Share on other sites

import hou

def activeNetworkPanes():
    desktop = hou.ui.curDesktop()
    panes = desktop.paneTabs()
    network_panes = []
    
    for pane in panes:
        if isinstance(pane, hou.NetworkEditor):
            if pane.isCurrentTab():
                network_panes.append(pane)
        
    return network_panes

root_node = None
selected_nodes = hou.selectedNodes()
network_panes = activeNetworkPanes()

if selected_nodes:
    root_node = selected_nodes[-1].parent()
elif network_panes:
    root_node = network_panes[0].pwd()

 

 

Thanks Arthur, thats exactly what I was looking for!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...