Notifications
Clear all
[Closed] Event Callback Mechanism
Feb 20, 2022 2:50 am
Hey gays!
I need to do some event before saving the file
I try this:
callbacks.removeScripts id:#testCallback
CallBacks.AddScript #filePreSave "event()" id:#testCallback
It works, but not as well as I would like.
I need it to work when I save the file myself
and don’t need to work when autosave (autoback)
is there a way to fix this?
4 Replies
Feb 20, 2022 2:50 am
try using
#filePreSaveProcess: #(integer, string) Sent before the save process has started. Calling callbacks.notificationParam() returns a 2 element array: Element 1 is 1 if doing a normal file save, 2 if doing an Edit>Hold 3 if doing an Autobackup Element 2 is the scene file name being saved.
Feb 20, 2022 2:50 am
something like this ?
(
fn PreSaveHandler param = if param[1] == 1 do
(
savefileName = param[2];
-- do what ever here
)
callbacks.removeScripts id:#testCallback
CallBacks.AddScript #filePreSaveProcess "PreSaveHandler(callbacks.notificationParam())" id:#testCallback
)