RogerW Posted August 12, 2019 Share Posted August 12, 2019 Hi all, I am having some trouble with the "on name change" event handler on an HDA. I want to be able to name nodes inside of my hda based off of a new name that I give the HDA after I have dropped it in my scene. The code works as a button but not when triggered on the change name event. I even tried hou.Parm.pressButton() in the on name changed even script but no dice... here is a sample : Quote def updatename(): hdaname = hou.node(".").name() mynode = hou.node(".").children()[0] mynode.setName(hdaname) print ("the nodes name has been changed to {}".format(hdaname)) attached a example otl as well... Is there any other way that I can do this.. Many Thanks change_my_name.hda Quote Link to comment Share on other sites More sharing options...
LaidlawFX Posted August 13, 2019 Share Posted August 13, 2019 Hello, This should work fine in the on name change event, without the button press node = kwargs["node"] hdaname = node.name() for child in node.children(): child.setName(hdaname) print ("the child node name has been changed to {}".format(hdaname)) As a warning though this style of renaming nodes will generally cause more issues than you are trying to solve. -Ben Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.