Notifications
Clear all

[Closed] Modifier plugin events

Hi,
I’m writing a modifier plugin and I’m having a problem with the available events.

the attachedToNode works as a Create event – fine

detachedFromNode – can’t see it called, ever.
deleted – same thing

None of them is called when I delete the modifier or entire object.

Basically I’m looking for events for when the modifier/object is deleted and modifier enabled/disabled in the modifier tree.

4 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

i know at least three ways how to detect some changes of a modifier. But in your case the “when” construct will work:


 try (deleteChangeHandler c) catch()
 resetmaxfile #noprompt
 fn getModifierState m = if iskindof m Modifier do
 (
 	format "modifier:%
	name:%
	enabled:%
	applied:%
" m m.name m.enabled ((refs.dependentnodes m).count > 0) 
 )	
 b = box()
 m = Unwrap_UVW()
 c = when parameters m change handleAt:#redrawViews m do getModifierState m
 addmodifier b m	
 setCommandPanelTaskMode mode:#modify
 modpanel.setcurrentobject m
 

evaluate this code and play with modifier enable/disable and remove/undo/redo…

ps. optinal handleAt:#redrawViews parameter is used to minimize the number of parameter change event signals. (see MXS help Change Handlers and When Constructs for details)

 PEN

I don’t think those get called until the undo stack is cleared.

Hmm,
so any idea how to react to deleting the modifier from the stack? (and disabling)

Thanks,
I’m also experimenting with callbacks right now.