ZBrushCentral

Is it possible to make my brush size preset macro buttons change color when pressed ?

Hi, I am new to writing scripts and am wondering if this might be achievable:

I have made a set of individual macros that each set my brush size to a specific value.
I have these on a custom pallet, and if possible would like the brush size button to change color when pressed,
and to revert back to its original color when another one of these brush size presets is pressed.

Is this possible to achieve in 4R8? Thanks.

Hi Susan,

It’s not possible to do what you want with macros but you can if you create a simple plugin. It’s not difficult. 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”]

You add this code to NotePad and save as a TXT file. Then load the file into ZBrush using the Load button in the ZScript palette. If there are no mistakes in the code, you’ll see the buttons appear in the Zplugin palette. ZBrush will also create a ZSC file which you can put in the ZStartup/ZPlugs64 so that the plugin loads each time you start ZBrush.

There are a couple of things to bear in mind with this. Firstly, plugins can’t monitor the ZBrush interface, so if you set the Draw Size slider to 64 the relevant plugin switch won’t light up. Also, sometimes you will need to press a button twice to turn it on. This is to do with how plugins are loaded. There is a way around it but I’ve deliberately kept this code simple.

Here’s the code in a text file:

HTH,

Yummy!
I don’t know who to love more you or Zbrush.
Thank you!

Ha! :slight_smile: You’re welcome, Susan.