ZBrushCentral

Is there a limit to how many ISwitches a script for a plug in can contain

Hi, I have been using this code from Marcus, to create preset buttons for my interface. So far I have used it for plugins that contain up to eight switches. The other day I tried to use the same code for a plug in that had 40 switches, and the script would not load.

Is there a limit to how long a script for a plugin can be? or how many of these switches I can use?

Thanks

CODE FROM MARCUS

You need to create an ISwitch for each Draw setting. The ISwitch will light up when turned on, and you add code so that they turn off the other switches when pressed.

Here’s the code:
[ISubPalette,“Zplugin: Draw Settings”]//create a new sub-palette in the Zplugin menu

[ISwitch,“Zplugin:Draw Settings:32”,0,“Set the Draw Size to 32”,
[ISet,Draw:Draw Size,32]//set draw size
//turn off other switches
[IUnPress,“Zplugin:Draw Settings:64”]
[IUnPress,“Zplugin:Draw Settings:128”]
,.33]//.33 is width of switch - a third of a palette width

[ISwitch,“Zplugin:Draw Settings:64”,0,“Set the Draw Size to 64”,
[ISet,Draw:Draw Size,64]//set draw size
//turn off other switches
[IUnPress,“Zplugin:Draw Settings:32”]
[IUnPress,“Zplugin:Draw Settings:128”]
,.34]

[ISwitch,“Zplugin:Draw Settings:128”,0,“Set the Draw Size to 128”,
[ISet,Draw:Draw Size,128]//set draw size
//turn off other switches
[IUnPress,“Zplugin:Draw Settings:64”]
[IUnPress,“Zplugin:Draw Settings:32”]
,.33]

//Must enable all switches here
[IEnable,“Zplugin:Draw Settings:32”]
[IEnable,“Zplugin:Draw Settings:64”]
[IEnable,“Zplugin:Draw Settings:128”]

Hi Susan,

I don’t think 40 switches should be a problem but to be honest I’ve never tried that many. If you want to send me your script I’ll take a look to see what might be going wrong.

Closing ] missing?

Thanks Guys,

These scripts with a lot of switches, get very long, as each switch needs a line to turn of the other 39.
So yeah they can be tedious to find small errors. (Thanks for the offer Marcus)
I have noticed that sometimes ZB will point out the error in a script as it loads it.
But with the longer script I tried, I would load the script as usual, but then ZB would not convert it and give me the ZB script to put in the plug in folder, so I was not sure if it was to long or if there was a mistake.

i have one of my plugin ( matiere 3d) which got 82 switches and no issue.
there is a routine that handle the the plugin startup ( when your script has shutdown, because you have used another plugin/script or macro).
then it stores all switches states and reapply all the settings for each of them, or every every switches gonna be resetted to their initialization statement.
the only restriction i know of, is the one with global variable declaration, if you got more then 256 globale variable at the script startup, zbrush will start to complain when it gonna load your script.
You are limited to 256 globales variables at the init/startup of a plugin, it’s the only limitation I know of.

Thanks, Celess