1. #1
    Senior Member Follow User Gallery
    Join Date
    Oct 2015
    Posts
    210

    Default 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.

  2. #2
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    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: DrawSettings.txt

    HTH,

  3. #3
    Senior Member Follow User Gallery
    Join Date
    Oct 2015
    Posts
    210

    Default

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

  4. #4
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    Ha! You're welcome, Susan.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •