Update script with callback: #selectionSetChanged
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:
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 :( ?