1. #1

    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 Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    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[/CODE]

    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

    Default

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

  4. #4
    New Member Follow 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 Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    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

  6. #6
    New Member Follow User Gallery
    Join Date
    Aug 2010
    Posts
    7

    Default

    Quote Originally Posted by marcus_civis
    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[/CODE]

    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,
    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!

  7. #7

  8. #8
    New Member Follow User Gallery
    Join Date
    Aug 2010
    Posts
    7

    Default

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

  9. #9
    Senior Member Follow User Gallery
    Join Date
    Aug 2011
    Location
    Mebane, NC
    Posts
    4,194

    Default

    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

  10. #10
    Senior Member Follow User Gallery
    Join Date
    Sep 2009
    Location
    Upstate NY
    Posts
    172

    Default

    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

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

    Default

    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

  12. #12
    Senior Member Follow User Gallery
    Join Date
    Sep 2009
    Location
    Upstate NY
    Posts
    172

    Default

    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!

  13. #13
    Senior Member Follow User Gallery
    Join Date
    Sep 2009
    Location
    Upstate NY
    Posts
    172

    Default

    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!!!

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

    Default

    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.

  15. #15
    Senior Member Follow User Gallery
    Join Date
    Sep 2009
    Location
    Upstate NY
    Posts
    172

    Default

    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!!!

Page 1 of 2 12 LastLast

Posting Permissions

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