python equivalent of opadd

   4067   4   1
User Avatar
Member
201 posts
Joined: July 2005
Offline
Is there a python version of opadd … specifically getting a list of all operators? Workarounds would be great. Thanks.
Cheers,
Rob
Digital Supervisor | Stargate Studios Toronto
User Avatar
Staff
121 posts
Joined: Oct. 2010
Offline
Hi Rob,
If you look at the help card for opadd you will see it's python equivalents

“Replaced by hou.Node, hou.NodeTypeCategory ”
Side Effects Technical Support
User Avatar
Member
1904 posts
Joined: Nov. 2006
Online
As Jenny mentioned the best way to get a list is use the node type category classes and take advantage of their nodeTypes() method. This method gives a dictionary with the node type name as the key and a hou.NodeType object as the value.

The equivalent of just using opadd while at /obj is something like this.
nodetypes = hou.objNodeTypeCategory()
for ntype in nodetypes:
print ntype
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
133 posts
Joined: July 2005
Offline
Hi Graham:

The code that you submitted returns errors.

nodetypes = hou.objNodeTypeCategory()
for ntype in nodetypes:
print ntype

Here's the error:
Traceback (most recent call last):
File “<console>”, line 1, in <module>
TypeError: ‘NodeTypeCategory’ object is not iterable
Francisco Rodriguez
Effects Animator | Walt Disney Animation Studios
User Avatar
Member
1904 posts
Joined: Nov. 2006
Online
Oops. Sorry about that Frankie. Guess it's always best to check code before posting. The correct first line should be the following:
nodetypes = hou.objNodeTypeCategory().nodeTypes()
Graham Thompson, Technical Artist @ Rockstar Games
  • Quick Links