Tigger actions on deletetion? (from within a plugin?)


#1

Im kinda lost on the concept… but I got some clues from posts like these, and the documentation on events, callbacks and script clauses

I’m guessing there’s no straightforward way to trigger an action on a delete event? :confused:

x = modpanel.setcurrentobject $.modifiers[myCustomModifier]
when deleted  do (print "bye bye")

or when this deleted do… so and so…

speaking of which… whats the point of the on deleted do, if you cant even use it without clearing your undo stack?


#2

Not sure what you are trying to achieve exactly,
but within your custom modifier to trigger an on delete type action use on detachfromnode instead

on detachedFromNode this do
(	
		print "bye bye"
)

#3

thank you for your reply,

but in the help (and after testing it myself)

detachedFromNode seems to only trigger when i delete the actual object. (im not trying to delete the object itself)

what i want to achieve is - when I remove mycustom plugin from the modifier stack, i.e. deleting it from the stack, id like to trigger an action.

Called whenever the scripted plug-in object is finally deleted…

from the help ^

am I misunderstanding what this means? (I’ve seen other posts, and even in the help) it does say it wont happen immediately, because of clearing the undo stack and such… but then, why have this at all then?
and what IS the norm for having an event that triggers when you delete “this” modifier / plugin?


#4

Unfortunately this is correct,
the on delete will be called when the object is deleted from the undo stack and doesn’t happen immediatly as per the help document.

in the case you are describing i would try a modifier event callback
#postModifierDeleted and #preModifierDeleted

or if that doesn’t work there are modifier panel callbacks
#modPanelObjPostChange or #modPanelSelChanged

http://help.autodesk.com/view/3DSMAX/2017/ENU/?guid=__files_GUID_C1F6495F_5831_4FC8_A00C_667C5F2EAE36_htm