Jump to content
Morrorz

How to python rename node in subnet

Recommended Posts

Posted (edited)

I have Subnet node name is "subnet1".

In "subnet1" i have ROP node.The same name as subnet is "subnet1".

When i change my subnet name change the my ROP name too.

How to write in "On Name Change" python ?

 

Thank you.

Edited by Morrorz

Share this post


Link to post
Share on other sites

Have exemple for me please !!

hou.node("/subnet1").addEventCallback((hou.nodeEventType.NameChanged, ), name_changed)

it's error sir

Share this post


Link to post
Share on other sites

I typed this (the example provided in the link I sent) in the Python Shell and it works fine :

def name_changed(node, event_type, **kwargs):
     print("Geo node is now named %s" % node.name())
 
hou.node("/obj/geo1").addEventCallback((hou.nodeEventType.NameChanged, ), name_changed)

You have to define a function to link to the event callback, and no just copy one line... Note this will work only for the current session, it won't be saved in the file if you close Houdini (as written in the doc link).

 

Cheers,

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

×