shadowst17 Posted October 7, 2019 Share Posted October 7, 2019 (edited) Hey guys, I was wondering if anyone new of a simple way to run a function when I select a different node? I've currently got a little UI with pyQt and I've gotten to it to update using the ChildSelectionChanged node callbackEvent but that is only for specific networks. The only thing I can come up with is I have the script check for new sub networks everytime it runs and creates new callbacks for them. Surely there is a more efficient less dirty way to do this? Doing it the dirty way this is what i'm using when running the script, updating it per change on selection and when calling the close event: Only works with networks one down from obj but I imagine if I made this find all sub children it will have a performance impact? def callBacks(self, enable): nodes = hou.node('/obj/').children() for node in nodes: if enable: if len(node.eventCallbacks()) == 0: node.addEventCallback((hou.nodeEventType.ChildSelectionChanged,), self.updateUI) else: node.removeAllEventCallbacks() Edited October 7, 2019 by shadowst17 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.