View Full Version : Scripted modifier plugin
01-13-2009, 03:38 PM
i'm very much into plugins lately. I've written a modifier-plugin which loads images into the environment-background. These are images of skies and they're used for our lighting. This works nicely. But i'd like to restrict the use of this modifier to only lights, in particular lights with targets.
So if i select a box and add a modifier, i don't want to see my sky-modifier in the list. Is it somehow possible to do this?
This is the header of my plugin
plugin modifier skyTool
As far as I know, scripted plugin modifiers do not provide a filtering mechanism for the modifier list to detect whether the modifier is applicable or not. C++ plugins do.
One possible solution would be to implement a dummy base modifier plugin with the desired filtering in C++ and then extend that, but obviously it requires knowledge of the SDK.
01-13-2009, 08:49 PM
Thanks bobo for the kind reply.
I think i won't stretch myself over to the sdk for now.
01-13-2009, 09:36 PM
what you could do - at least partially - is detect what object it's being applied to and change the user interface based on that / put up a warning dialog, etc. that way at least it's clear to your artists that it should only be used on the appropriate object types
01-13-2009, 09:52 PM
plugin simpleMod test name:"test" classID:#(0xc8a0855, 0x44472ea6) version:1 invisible:true (
rollout roll_test "test" (
label lbl_stat ""
parameters main rollout:roll_test (
on attachedToNode obj do ( if (classOf obj.baseObject != GeoSphere) then ( messageBox "Boink!" ) )
The 'partially' comes from the fact that if you copy this modifier and then paste it to some other object, the attachedToNode is not triggered.
Another option - which doesn't fix the 'partially' above - is to set invisible:true for your scripted plugin, and only allow it to be added via e.g. toolbar, menu item or - most likely candidate - right-click quad menu macro item. You can control whether or not the quad menu item is visible/enabled quite easily based on the current selection, and only have the item available if the selection is the desired light type. Then just let the macro handle adding the modifier (addModifier $ yourMod).
01-14-2009, 08:15 AM
that last suggestion looks very good. I can do toolbars and menus! It's a modifier which isn't going to be used very often, so i'll just pop it in our regular scriptmenu.
Is this by the way how the cameracorrection modifier works? It doesn't show up in the list of modifiers, but it is visible in the modifier-menu.
01-14-2009, 01:05 PM
yep, that's exacty how that modifier works :)
macro: UI\MacroScripts\Lights and Cameras-CameraCorrection_Quad.mcr
01-14-2009, 01:05 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.