Jump to content
willlinks

How to get the current network type category on the Network Editor Pane in python?

Recommended Posts

Hello,
I'm trying to network type category (like sop, dop, lop ...) on the Network Editor Pane in Python.
I could get the parent node of the network on the current Network Editor so far.

def get_network_type():
	# Find the node of the network showed on a current Network Editor Pane. 
	desktop = hou.ui.curDesktop()
	pane =  desktop.paneTabOfType(hou.paneTabType.NetworkEditor)
	parent_node = pane.pwd()
	
	# I'd like to get the network type category of the inside of the parent_node (like Sop, Lop, Object, CopNet, TopNet etc).
	network_type = ??????

	return network_type

I have some case that I'm viewing the Sop network in sop_create Lop node or Vop network  in material_library Lop so it is not necessary to be the top or parent network is the same network type I'm viewing on the current Network Editor pane.
I could pick one node in the current network to figure out the network type by getting node type but I also have situation that there are no node in the network yet but I need to figure out the network type.

It would be really nice to have some help.
Thank you in advance!

Share this post


Link to post
Share on other sites

Hi,

You can get it like this:

context = parent_node.childTypeCategory().name()

 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×