[Closed] select via maxscript without triggering selectionSetChanged Callback
global rolloutselectiontest
b = box ()
rollout rolloutselectiontest "rolloutselectiontest"
(
fn selectTheBox=
(
select b
)
on rolloutselectiontest close do
(
callbacks.RemoveScripts #selectionSetChanged id:#selectTheBoxCall
)
)
createDialog rolloutselectiontest 200 100
callbacks.addScript #selectionSetChanged "rolloutselectiontest.selectTheBox()" id:#selectTheBoxCall
WARNING THIS WILL CRASH MAX WHEN YOU CHANGE SELECTION!!
I know why this wont work its an infinite loop, but im wondering is there any sort of workaround to select an object(set) while using a selectionSetChanged Callback.
Is there any way to select an object via maxscript without triggering that selectionSetChanged Callback, and still have the callback working after changing the defined selection?
See what I’m doing is a little more complicated, but to simplify it I gave this as an example of what I am facing now.
I really just want to filter out any objects from the selection set that arent in a specific array and that array is made within the selectionSetChanged Callback Function. Impossible?
Ok nevermind I just ended up trying something I didnt think would work and it worked,
remove the callback within the callbacks funtion and recreated it in the function after selecting the new selection and it works.
global rolloutselectiontest
b = box ()
rollout rolloutselectiontest "rolloutselectiontest"
(
fn selectTheBox=
(
callbacks.RemoveScripts #selectionSetChanged id:#selectTheBoxCall
select b
callbacks.addScript #selectionSetChanged "rolloutselectiontest.selectTheBox()" id:#selectTheBoxCall
)
on rolloutselectiontest close do
(
callbacks.RemoveScripts #selectionSetChanged id:#selectTheBoxCall
)
)
createDialog rolloutselectiontest 200 100
callbacks.addScript #selectionSetChanged "rolloutselectiontest.selectTheBox()" id:#selectTheBoxCall
for whoever might be looking for this.
Might be a better way but this works.