1. #1
    Senior Member Follow User Gallery
    Join Date
    Oct 2005
    Location
    USA
    Age
    35
    Posts
    1,066

    Default How to zscript "alt" button press for an alternate script to run on a single IButton?

    Basically I want to be able to script two commands running off of the same button.

    Like how the ZRemesher can run two different zremesh algorithms off of the ZRemsher button depending on if the user holds down "alt" or not when it's pressed.

    Is this possible? Or something that is hard coded into the ZRemesher button in Zbrush? I couldn't find anything online or in the command reference.

    Thanks,

    E

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

    Default

    Hi Eric,

    Try this code:

    [VarDef,keyOnMouseDown,[IGet,preferences:utilities:viewkeyboardstatus]]

    [Sleep,0.001,
    [If,SleepResult==4,//waits for keypress
    [VarSet,keyOnMouseDown, [IGet,preferences:utilities:viewkeyboardstatus] ]
    ]
    [SleepAgain],4,sleepResult
    ]

    [IButton,"Press Me","Hold Alt for alternative result",
    [If,((keyOnMouseDown)&1024)==1024,
    [Note,"You pressed the Alt key"]//commands for Alt keypress on click button
    ,//else
    [Note,"You didn't press the Alt key"]//commands for straight mousedown on button
    ]//end if
    ]

  3. #3
    Senior Member Follow User Gallery
    Join Date
    Oct 2005
    Location
    USA
    Age
    35
    Posts
    1,066

    Default

    G damnit Marcus you brilliant bastard!

    Love you so much!

    THANK YOU!!!

  4. #4
    Senior Member Follow User Gallery
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    349

    Question

    Hi,

    I just discovered that pressing Alt when pressing the ZRemesher button in a custom UI toggles the Tool column at the right side, instead of activating the alternative ZRemesher algorithm.

    Maybe this is a macOS-only issue, but I'm looking for a workaround, because I really like the ZRemesher button in my custom UI. Could the above-mentioned script be the solution? If so, how should I turn it into a custom UI button that loads every time I start ZBrush?

    Many thanks in advance for your help.
    visualization • illustration • 3D design — metinseven.nl

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

    Default

    Hi,

    You have to have a new button on your UI, but this will work. It's a macro which presses the ZRemesher button while holding Alt. Save to ZBrushOSX 2018/ZStartup/Macros/Misc folder and press Macro>Reload All Macros. There should then be a new button in the Macro palette called "ALT-ZRemesh". You can move the button to your custom UI.

    ALT-ZRemesh.txt

  6. #6
    Senior Member Follow User Gallery
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    349

    Thumbs up

    Many thanks, Marcus, much appreciated!
    visualization • illustration • 3D design — metinseven.nl

  7. #7
    New Member Follow User Gallery
    Join Date
    Nov 2018
    Posts
    9

    Default

    Hi! I suggest you could use CTRL instead of ALT to trigger secondary command because it is easier to catch. YOu could try this codes.
    [IButton, TestButton, "",
    [VarSet, CTRLisPressed, 0]
    [VarSet, slBrushInfo, [IgetInfo, "Brush:Current Brush"]]
    [VarSet, slFind, [StrFind,"Base Type: Mask", #slBrushInfo]]
    [If, #slFind > -1 ,
    [VarSet, CTRLisPressed, 1]
    ,]

    [If, #CTRLisPressed , // CTRL is pressed.
    [NOte, "CTRL is pressed down"] // SAMPLE CODE
    // PUT THE CODES HERE
    ,// CTRL is not pressed.
    [NOte, "CTRL is not pressed down"] // SAMPLE CODE
    // PUT THE CODES HERE
    ]


    ]

  8. #8
    New Member Follow User Gallery
    Join Date
    Nov 2018
    Posts
    9

    Default

    Hi! I suggest you could use CTRL instead of ALT to trigger secondary command because it is easier to catch. YOu could try this codes.
    [IButton, TestButton, "",
    [VarSet, CTRLisPressed, 0]
    [VarSet, slBrushInfo, [IgetInfo, "Brush:Current Brush"]]
    [VarSet, slFind, [StrFind,"Base Type: Mask", #slBrushInfo]]
    [If, #slFind > -1 ,
    [VarSet, CTRLisPressed, 1]
    ,]

    [If, #CTRLisPressed , // CTRL is pressed.
    [NOte, "CTRL is pressed down"] // SAMPLE CODE
    // PUT THE CODES HERE
    ,// CTRL is not pressed.
    [NOte, "CTRL is not pressed down"] // SAMPLE CODE
    // PUT THE CODES HERE
    ]


    ]

Posting Permissions

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