[Closed] Scripted plug-in: how to define valid inputs?
I wrote a scripted plugin, wrote the needed code on its on execute handler, but i find no way of determining valid objects for it.
I was hoping there was some event handler similar do isVisible or isEnabled, like those macroscripts have, but found it nowhere.
How should I implement it?
I don’t follow at all. What execute handler are you talking about as there isn’t one for scripted plugins. Are you talking about a Macro Script?
Oh, my bad! It is a POSTCREATE handle, actually.
I’m talking about a “plugin modifier Blablabla (”
I´m heavily missing a way of preventing it of showing in the modifiers list for “invalid” objects of, at least, prevent it from being applied to these objects.
Macroscripts have a on isEnabled handler, but I found no documentation or examples of similar thing to scripted plugins.
eek,
I did find this function, and I even know what other things I would like to test as well (for example, (classof obj == Tape)).
The problem is in a level above it. I don’t find no handler (the usual method for implementing such things?) where I can use it.
Thanks for spending your time on my question, anyway!
Fernando.
Yep, no such filter for plugins. You can only completely hide your plugin with “invisible:true” (thats not the same but may help).
I managed to make use of the “on attachedTo objnode do” handler (os something like that) to “removemodifier objnode this”. It works. I could use the on create handler (the plugin is created every time the modifiers list are opened) to make it invisible, but the invisible property is not published.
What I have now is not perfect but does the trick: the modifier leaves a message in the status bar and deletes itself.
Thanks for all that answered!
I dont think you can show only valid modifiers for an object type. The way I did this awhile back was by using the on post create callback and checking the type of object – if it met they right class i kept it, if not i deleted it.
I think theres an ‘on added to’, too.