Python script to change operator type

   2460   2   1
User Avatar
Member
10 posts
Joined: 12月 2006
Offline
Hi,

I would like to use python to run whatever functions are executed when you use the righ click menu > “Change Type…” on a Node. Because I have to do it on a number of nodes.

Does anyone have an idea how to change the operator type of a node?

That's what I have so far:
changeNodes =
objs = hou.root().recursiveGlob('*', hou.nodeTypeFilter.Obj)
for o in objs:
if o.type().name() == ‘nodeType_A’:
changeNodes.append(o)
for c in changeNodes:
#change nodeType to ‘nodeType_B’
#Keep name
#Keep Parameters

Any ideas? If there is a way to just get whatever code is run when I use the “Change Type…” that would already be of huge help!

Thanks a lot!

–Markus
User Avatar
Member
1922 posts
Joined: 11月 2006
Online
You want hou.Node.changeNodeType()
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
10 posts
Joined: 12月 2006
Offline
Oh wow, that was easy! ops:

I wasn't thinking of looking in the API for the operations on Node. I only looked at NodeType…

Thanks so much!!!
  • Quick Links