HOU: How to get a networkItem's categoy/context equivalent ?

   2293   2   0
User Avatar
Member
30 posts
Joined: 10月 2011
オフライン
I'm trying to find out what category/context a networkItem(netbox, sticky, dot) is in via python.

working with nodes is easy:

selection = hou.selectedNodes()

print selection.type().category().name()

If I selected a bunch of sop nodes, it would return “Sop”


My question is how do I get the equivalent of: .category().name() from a networkItem?

my selection is now a tuple of items mixed with nodes:

selection = hou.selectedItems()

If my fist selection item is a dot/sticky/netbox, there is no type() property. So if I selected a netbox in a sop context, I'd like a hou fn to return “Sop”


Cheers
User Avatar
スタッフ
4566 posts
Joined: 7月 2005
オフライン
That's because a network box, or dot, or sticky note in a SOP context is indistinguishable from a network box, dot, or sticky note in an OBJ context. These things don't have “types”… I guess I'd start by asking why you need this information? If you are just trying to figure out the type of nodes that can be created in the same network as these items, you can do:
item.parent().childTypeCategory().name()

Is that what you're looking for?
User Avatar
Member
30 posts
Joined: 10月 2011
オフライン
thanks mtucker!
item.parent().childTypeCategory().name() is exactly what I am looking for.

I'm saving the selected items to the clipboard, then moving the cpio file to a managed library directory. I needed to know that context to rename the cpio file to.
Cheers
  • Quick Links