Making a brush toggle

It can be useful to be able switch between two brushes using a hotkey. ZBC user f​:slight_smile:celess has posted an excellent plugin that allows you to set two brushes herehttp://www.zbrushcentral.com/showthread.php?207452-zCycler-Brush-Cycle.

But what if you’d like several pairs of brushes, each with their own hotkey? It’s very easy to do by creating a macro. Here’s the code:

[IButton,???,“Toggle Brush”,

[VarSet,brush_1,“Brush:Standard”]//change to brushes you want

[VarSet,curBrush,[IGetTitle,Brush:Current Brush,1]]


This switches between the Standard and the Clay brush. To use it, all you need to do is paste the code into NotePad or TextEdit and save the file to the ZBrush 4R8/ZStartup/Macros/Misc folder. Use a file name like “BrushToggle1.txt”. Press the Reload All Macros button in the Macro palette and your new button called “BrushToggle1” will appear in the Macro>Macros>Misc sub-palette. Give the button a hotkey and it’s ready to use.

To make a second toggle all you need is to duplicate the code into a new txt file. Change these two lines to the brushes you want, such as:

[VarSet,brush_1,“Brush:TrimDynamic”]//change to brushes you want

Be careful to add the names exactly as they are in ZBrush. Now save the file as before but be sure to give it a different name, such as “BrushToggle2.txt”.

You can repeat this as often as you like, just so long as you save each file with a different name.

Download text file here:

Let me know if you’ve any questions.

mine isn’t that excellent, i will not had created it, if i had knew about your own macro :slight_smile:
But I gonna think it differently, when i get more time for that.
Mmy objective is to keep the flow with a single action to toggle the brushes or the hotkey, or clicking on the “fancy” Icon from your custom UI.
Having different sets of brushes is interesting, but I want to keep this single button to make everything to work.

Why not different behaviors when we combine Ctrl+click or alt+click on this icon/macro.
ctrl+click would add a third brush in the list, fourth etc…
Maybe store different list based on a switch or slider item to store different sets.
I am restrained because f the name of my plugin itself, which mean i want only cycling feature there, without to copy
what Joseph 's cleanup master plugin is doing already.
someone suggest me to make an note interface to copy functionalities of a plugin that has never seen the light of the day: “ztrol”.
But it collapses with my previous purpose as it get off the scope of the cycling theme.

I will see what happen next, i still busy with my commercial toolsets ;p

Dear Marco, amazon Macro!

How would you modify this to cycle between 3 brushes instead of 2? I have tried to edit it without success.


Hi aleventura,

For three brushes you just need to make sure they are selected correctly by adding in a nested [If] statement. (I have also changed the code slightly as I realised I had not allowed for having brushes with similar names, such as “Clay” and “ClayTubes”.)

//ZBRUSH MACRO for ZBrush 4R8 - save this file to the ZStartup/Macros/Misc folder

[IButton,???,“Toggle 3 Brushes”,

[VarSet,brush_1,“Brush:Standard”]//change to brushes you want

[VarSet,curBrush,[IGetTitle,Brush:Current Brush,1]]


,//else select first brush



The way this works is by checking the name of the brush. The [StrFind] bit tests to see if the current brush name is the same as the stored brush name. The code I’ve added also checks the other way around. This is because my first macro code would return “true” if it checked for “Clay” when “ClayTubes” was selected, and the toggle wouldn’t work because it would think the Clay brush was selected.

The [If] statements then make sure the correct brush is selected at the right time. They simply mean “If brush 1 is selected, then select brush 2. Else if brush 2 is selected, then select brush 3. Else if brush 3 or any other brush is selected, select brush 1.”

Download text file:

It works !! Great, I wanted that for so long, now I can use many toggles, finally ^^

Just an idea : the next evolution of this could be to use custom icons to activate the macros (instead of text) so it could replace the actual brushes icons, if you see what I mean. More toggles and less icons on the UI :slight_smile:

I really appreciate it

So, Marcus, if we want to add more brushes I’m guessing that those brushes will have to be active in the interface for them to work with this Macro, right??? Like SmoothPeaks would have to part of my start up to be included???

Thanks for this by the way!!! :slight_smile:

Yes, the brushes will need to be loaded. The best way is to put the brush files in the ZBrush 4R8\ZStartup\BrushPresets folder. They will then be loaded automatically whenever ZBrush starts.