fxrod Posted April 21, 2012 Share Posted April 21, 2012 Hey Guys: I have an otl with a button and a callback script. When I select multiple instances of the tool and hit the button, it executes the callback as many times as there are instances. In other words, if my button prints "Hello World" and I select 10 instances, then hit the button on one of the instances, "Hello World" prints 10 times. Is there any way to have it execute the callback only once from the button on the otl? Thanks much in advance. Quote Link to comment Share on other sites More sharing options...
glassman3d Posted May 24, 2012 Share Posted May 24, 2012 (edited) I would do something like: in your callback script first return a list of selected nodes using selectedNodes = hou.selectedNodes() filter this selection to only count your otl nodes (in case you have other nodetypes selected) using filteredSelection = [x for x in selectedNodes if x.type().name() == 'myOtlTypeName'] if your node is not the first node in this list, do not fire the callback as a bonus this will make your otl aware of other otl instances does that help? Edited May 24, 2012 by glassman3d Quote Link to comment Share on other sites More sharing options...
fxrod Posted June 4, 2012 Author Share Posted June 4, 2012 Thanks! I'm going to look into your suggestion and see how it goes. Cheers! 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.