Game Development Community

getSetModificationSignal - what is it?

by Nathan Bowhay - ESAL · in Torque 3D Professional · 06/10/2011 (12:37 pm) · 2 replies

I am in the process of upgrading from 1.1 beta 3 to 1.1 and came across this:
getSetModificationSignal().trigger( SetCleared, this, NULL );

and was wondering what exactly it is for. My main question is does it register any sort of callback to script?

I added my own callback in SimSet::clear after the simset is cleared so I could do something in script. Do I not need this anymore?

Any info on this system would be awesome!

#1
06/10/2011 (1:37 pm)
Quote:was wondering what exactly it is for

It allows C++ code to monitor a SimSet for changes. GuiTreeViewCtrl uses it to know when it has to rebuild a branch in the tree.

Quote:My main question is does it register any sort of callback to script?

No, but there are actually the onObjectAdded and onObjectRemoved callbacks that give you the same thing for script code.

Quote:I added my own callback in SimSet::clear after the simset is cleared so I could do something in script. Do I not need this anymore?

You could use the onObjectRemoved callback for that and detect when the set is empty, but a dedicated clear callback definitely performs better.
#2
06/10/2011 (1:50 pm)
Awesome explanation. As always, thanks Rene!