Update script with callback: #selectionSetChanged

Hi,
I want to make my script recognize any changes in the current selection. I think its a nice feature to have, instead of using an "update" button.
Basically I want to do something like what has been written by mertens3d here:
http://www.scriptspot.com/forums/3ds-max/general-scripting/how-to-enable...
But it does not work. When I run this the first time, it fails. The 2nd time will work. I think (maybe I am totally wrong) the problem is, that I have a rollout that creates a callback, which fires a function everytime the selection changes. The function itself must be global and above the rollout, so the callback can find it. The function then tries to access the rollout (changing arrays and stuff), which crashes the script because the rollout is not yet there. The 2nd time the rollout is there and it works.

I have tried many things, but can not get this to work. Please help :( ?
Regards

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
br0t's picture

Thanks ALOT :D! That solved

Thanks ALOT :D! That solved my problem! I didn't even know rollouts could be global...

Never get low & slow & out of ideas

Budi G's picture

Hey br0t, to use a script

Hey br0t, to use a script from mertens3d you just need to put global rollout command,like :
global dynamite

result like :

global dynamite
 
rollout dynamite "Untitled" width:231 height:65
(
  -- put anything button, function or  etc
)
createDialog dynamite

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.