[Closed] how to make my modifier used on special nodes
Hi, I want to make my modifier to be used on some special nodes. I have written a function to check this.
fn CanBeAddedWithMyMod node = ()
But I do not how to use it inside my modifier’s script. It seems Max does not support modifier to check the node to know whether it matches requirements.
How can I solve this?
It seems I can make it via hooking modifier event like preModifierAdded and postModifierAdded. But is it clumsy? I would like to know whether there is any nice solution.
And, I find it is dangerous to delete nodes inside those event callbacks. How can I savely delete nodes after I receiving event?
Thanks!
well, as per the previous thread – http://forums.cgsociety.org/showthread.php?t=726734 – you can’t prevent a modifier from being added.
The only thing you can do is delete it after it has been added. As you’ve already pointed out, it’s dangerous to do so within the modifier plugin’s own event stack, but you should be able to safely delete it in the #postModifierAdded callback event. If you find that causes crashes, use an asynchronous timer (timer control in a rollout OR .NET timer, see help file) to delete the modifier after all the 3ds Max events are done with the system.