ScriptSpot

Forum topic · General Scripting

registerTimeCallback

By Matyrix · 2011-09-18

Description

Hello!

I want to create events on the time slider changes. The registerTimeCallback can define functions based on the time slider "tick"ing, but i can't unRegister them.

The maxscript help says:


fn time_p = print currentTime
registerTimeCallback time_p

but if i write this...:


unRegisterTimeCallback time_p

... nothing change. The function keeps working when i move the time slider.

Anybody knows how can i turn OFF the functions in these cases?

Comments (3)

Nope

Malkalypse · 2012-06-21

Changing a function or setting it to undefined once a registerTimeCallback has been set will not change the behavior of the callback.

From the doc: Note that it is the function value that is being registered, not the function name or global variable. This means that redefining the same-named function after registering it does not change the callback. You either need to unregister, re-define the function and then register it again, or make the registered function an intermediary which calls another function

barigazy · 2012-06-21

In max2012 this works


fn time_p = print currentTime
registerTimeCallback time_p
------------------------------
unregisterTimeCallback time_p


I don't know which max version have problem with
unregisterTimeCallback fn.

holycause · 2011-09-26

like this?


time_p = undefined