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.
Executing Callback on Multi-Selected OTLs
Started by fxrod, Apr 20 2012 09:44 PM
2 replies to this topic
#1
Posted 20 April 2012 - 09:44 PM
----------------------------------
Francisco Xavier Rodriguez (fxrod)
ILM FX TD
Francisco Xavier Rodriguez (fxrod)
ILM FX TD
#2
Posted 24 May 2012 - 01:37 AM
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?
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 by glassman3d, 24 May 2012 - 01:40 AM.
#3
Posted 03 June 2012 - 04:10 PM
Thanks! I'm going to look into your suggestion and see how it goes. Cheers!
----------------------------------
Francisco Xavier Rodriguez (fxrod)
ILM FX TD
Francisco Xavier Rodriguez (fxrod)
ILM FX TD
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users










