ZBrushCentral

Custom sized/named UI buttons

I have already toggled the setting in preferences to make the interface buttons smaller but certain buttons take up way more space than the text describing them e.g. initialize/mirror buttons which I have along the top in my customized UI amongst many others.

Is there a script or way so that the buttons in the UI you customize only take up the space their description needs or even better can you customize what the button says and it’s actual size/width for example ‘Initialize’ could be just a simple capital ‘I’ on a tiny button at the top?

You can do this by creating your own plugin buttons. You can name them how you want, specify size and even have an image if you wish. Basically a button you create presses an interface button, so you leave the interface buttons in their palettes and use your buttons in the custon UI.

Here’s how it’s done:


[VarDef,buttonPath,""]

[ISubPalette,"ZPlugin:My Buttons"]

[IButton,"ZPlugin:My Buttons:i","Initialize ZBrush",
	[VarSet,buttonPath,"Preferences:Init ZBrush"]
	[If,[IExists,buttonPath],
		[IPress,buttonPath]
	]
,,15 /*width*/,, /*image*/, /*height*/]
//end button

The ISubPalette line creates a new menu in the ZPlugin palette. You can leave this as it is.

Each button starts with its name, which for plugins must include the palette and menu. In this example the full name of the button is “ZPlugin:My Buttons:i” but only the “i” will show on the button. The “i” is all you need to change for any new buttons you want to create.

The VarSet,buttonPath line sets a variable to the button path for the interface item you want to press. You can find the button path for any interface item by holding the cursor over it and pressing Ctrl. The button path is given at the bottom of the pop-up.

Once you’ve given your new button a unique name and set the buttonPath all you need to do is set the size. You can leave the values blank but I’ve specified 15 for the width. Any value >1 can be used and is the width or height in pixels. Values of <=1 are treated as proportional to palette dimensions, so a value of 1 instead of 15 would give a button the full width of the palette.

I’ve attached the code in a text file. Save this to your ZStartup/ZPlugs folder and then load it through the ZScript>Load button. Once you’ve done that the buttons will be available every time you start ZBrush and you can make them part of you UI.

HTH,

1 Like

I’m not too good at scripting so wouldn’t have a clue how to do that thanks :+1:

Marcus, this is great, 10x for this tip ! :slight_smile: I have just one quistion, how to include the image in the script?I’ve tried including an absolut path pointing to a .psd image but nothing happend when I’ve loaded the script inside zbrush.

CodeFather,

Absolute or relative paths should work fine. You need to put the image path in quotes (" ") and also make sure that the button size is large enough to show the image - in fact you can omit the button size if you wish and it will match the image.

The attached zip gives an example. A grayscale image like this will take on the interface button color but you can use RGB color if you wish.

How would you go about changing the width of a toggle button? I would like to size down the Tool:Polypaint:Colorize button since it’s almost thrice the width of its text. I tried your script but it only presses the button but doesn’t unpress it when clicked again.
Thanks in advance!

http://docs.pixologic.com/user-guide/customizing-zbrush/interface-layout/custom-interface/

I’m sorry but I can’t see how that is of any help.

To the best of my knowledge the ones in the main UI can’t be modified as you wish beyond what is explained in the documentation. If you create custom buttons for a custom UI, you have lots more control. HTH

i was recently trying to get this to work, to try and have a custom button on my UI for the “solo” command.
primarily, because i use solo a lot- but i don’t like the “dynamic” feature and i’m always clicking that, instead of just “solo”.

can’t get it to work, however. is it because of the fact that the solo mutton now has 2 commands on it?
when i load this script- i just get a blank palette.
what’s more, if i for experimentation’s sake, just change the button path in the code- the button does show up, but does nothing and when i hold control over it- it shows the button path for “my buttons”, rather than what i would have thought, “Transform:Solo”
any ideas? here’s that code and thanks for any input!

[VarDef,buttonPath,""]

[ISubPalette,“ZPlugin:My Buttons”]

[IButton,"ZPlugin:My Buttons:S”,”Solo Mode”,
[VarSet,buttonPath,”Transform:Solo”]
[If,[IExists,buttonPath],
[IPress,buttonPath]
]
,15 /width/, /image/, /height/]
//end button

The code you posted has some smart quotes or something which ZBrush doesn’t seem to like. Also, you need to set up the button to toggle the Solo button on or off depending on its state.

Try this code (copy into Notepad or a plain text editor):

[ISubPalette,“ZPlugin:My Buttons”]

[IButton,“ZPlugin:My Buttons:S”,“Solo Mode”,
[If,[IsEnabled,Transform:Solo],
[If,[IGet,Transform:Solo]==1,
[ISet,Transform:Solo,0]
,
[ISet,Transform:Solo,1]
]
]
,15 /width/, /image/, /height/]
//end button

dude… i dunno what to say.
except of course it worked perfectly and you’re just a helluva guy for helping me out!

now… if i were to be REAL picky- what would it take to make the button the same size and shape as the button in the transform menu and is it possible to be grey when off/orange when on like a bunch of the other UI buttons?
if something like that is a complete hassle, it’s certainly no big deal. the orange state is great for letting me know when i’m in solo mode, but not a deal breaker. the little button you just made for me certainly gets the job done and without that pesky “dynamic” bit.
thanks a TON, sir!

actually- it’s not that big of deal at all.
i saw where i could affect the button size, so made the change to a big fat 80x40 button, which is very pen friendly. i just put it in the UI underneath where i have the stock solo button. that way, i still get to see if it’s on or off and should i want it- the dynamic feature is still there.
also, you were quite correct about the smart quotes bit. my textedit had them on in preferences, as a default.
thanks again for everything!!!

You’ve probably got the best solution. Although there is an [ISwitch] which has on/off states and is lit orange when on, you can’t change its height or assign an icon. Also, as a zscript is not active unless you’re using it, the ZBrush Solo button could be off when your zscript button is on and the other way around. This would mean you’d have to press a couple of times to be sure they were in synch.

i can say that so far- i couldn’t be happier.
i got used to the new button in a hurry and still can tell when solo is on.
honestly, this is one of those happy accidents i think… the fact that i have a a new button that’s really easy to click with the pen almost without looking at it, has sped things up for me exponentially.
i go back and forth between full visibility and solo like, a LOT. so this was huge for me!
so, thanks again!!!

You’re welcome! :slight_smile:

using this script can you specify the path to a ui.cfg file that loads when you click the button automatically
so that you can refresh your ui with out having look through folders to find the ui.cfg file. I tried adding the path at the end of the varSet Line but it didn’t work hopefully someone can help me with this.

[VarDef,buttonPath,""]

[ISubPalette,“ZPlugin:My Buttons”]

[IButton,“ZPlugin:My Buttons:i”,“Initialize ZBrush”,
[VarSet,buttonPath,“Preferences:Config:Load Ui:F:\Program Files\ZBrush 4R7_P3\ui.cfg”]
[If,[IExists,buttonPath],
[IPress,buttonPath]
]
,15 /width/, /image/, /height/]
//end button

You’re nearly there. You need to use the FileNameSetNext command to specify the file you want to use, then simply use IPress with the load button:

[VarDef,filePath,""]

[ISubPalette,“ZPlugin:My Buttons”]

[IButton,“ZPlugin:My Buttons:i”,“Initialize ZBrush”,
[VarSet,filePath,“F:\Program Files\ZBrush 4R7_P3\ui.cfg”]
[If,[FileExists,filePath],
[FileNameSetNext, filePath]
[IPress,Preferences:Config:Load Ui]
]
,15 /width/, /image/, /height/]
//end button