[Closed] Detect callbacks
Hi guys,
Does callbacks.show() show all callbacks in the scene, including “when”, “registerTimeCallback”, and “registerRedrawViewsCallback”?
I have a feeling a callback is on the loose, but I don’t want to destroy all callbacks brute force style, I’d rather be a bit better informed on what callbacks are running…
Any thoughts?
-Johan
I need to check, but does Zeboxx’s cblogger script handle these callbacks?
Yes, it can create and destroy them. However, it’s only to capture events – not to expose existing callbacks. Unfortunately, I don’t think any of the others have proper methods to show which callbacks (change handlers, etc.) exist.
That said…
general event callbacks
callbacks.show()
-- sample output
systemPostReset:
id:#vfb_rollouts, "VFB_methods_struct.Reset()"
systemPreNew:
id:#cbNewSysReset, "px_preNewFile()"
change handlers
apropos ":changeHandler"
-- sample output
myChangeHandler (ChangeHandler): <ChangeHandler:0x0000e1e8>
Unfortunately, this doesn’t help you remove it (the ID is not reported), but it may help you find its source, which may lead to finding a way to remove it.
node event system (callback itself)
apropos ":nodeeventcallback"
-- sample output
fixScale (NodeEventCallback): NodeEventCallback
You can remove the node event callback by setting the variable name to undefined, then running a garbage collection.
[b]node event system/b
time change callback
viewport redraw callback
-- run before you load your scene/script/etc. (I have it in startup)
standardFunctions = stringStream ""
apropos "*:maxscriptfunction" to:standardFunctions
standardFunctions = filterString (standardFunctions as string) "
"
-- load your scene/script/etc. here
-- function foobar = ( print "foo, bar!" )
-- run after you load your scene / script file / etc.
currentFunctions = stringStream ""
apropos "*:maxscriptfunction" to:currentFunctions
currentFunctions = filterString (currentFunctions as string) "
"
for func in currentFunctions where (findItem standardFunctions func == 0) do (
format "%
" func
)
-- sample output
foobar (MAXScriptFunction): foobar()
For time and viewport redraw callbacks, you can use the function name to unregister them. You’ll have to do some guessing as to whether a function is a callback or not, though. With any luck, coders you work with / whose products you use, use some sane naming methods for this.
==========
Haven’t poked much at this, there might be some other tricks left in max’s arsenal to help here.