1. #1
    New Member User Gallery
    Join Date
    Jul 2008
    Posts
    9

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

  2. #2
    Moderator User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    7,680

    Default

    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:
    Code:
    [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,
    Attached Files Attached Files

  3. #3
    New Member User Gallery
    Join Date
    Jul 2008
    Posts
    9

    Default

    I'm not too good at scripting so wouldn't have a clue how to do that thanks

  4. #4
    New Member User Gallery
    Join Date
    Sep 2004
    Posts
    6

    Default

    Quote Originally Posted by marcus_civis
    ...You can name them how you want, specify size and even have an image if you wish...
    Marcus, this is great, 10x for this tip ! 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.

  5. #5
    Moderator User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    7,680

    Default

    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.
    Attached Files Attached Files

Posting Permissions

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