1. #1
    Member Follow User Gallery
    Join Date
    Sep 2008
    Location
    New York City
    Posts
    63

    Default what are the Zscript commands for Pick Color and changing the Live Boolean modes?

    A long time ago, I set a hotkey to the c key. By default, that let's you pick whatever color is under the cursor. Anyone know the command so I can restore that feature?

    Also, I'd like to be able to make a script or macro that changes the live boolean mode of the selected subtool from additive to subtract or intersect. Recording a macro doesn't record that action so I can't find what the command is. Anyone know?

    thanks!

    Ryan

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

    Default

    As the 'C' hotkey for picking color has no direct button you can't assign a hotkey to the function. There used to be a way to script the same behaviour but this doesn't work in 4R8. It's possible to get some of the same thing with the code below but it only works for colors in the document, not the UI. My example is for a macro but you can easily adapt it as a plugin button. You need to assign a hotkey for it to work.


    [IButton,???,"Pick a color from the document",
    [VarSet,col,[PixolPick,0,[MouseHPos],[MouseVPos]]]
    [ISet,Color:Main Color,col/65536]
    ]



    Changing the Live Boolean mode for a subtool is a little tricky - there's no direct way so you need to simulate a "click" on the relevant icon. This routine will set it for the selected subtool:

    [RoutineDef,SetBoolean,
    [VarSet,activST,[SubToolGetActiveIndex]]
    [ISet,Tool:Sub Tool:SubTool ScrollBar,0,([SubToolGetCount]-(activST+1))]
    [VarSet,stPath,"Tool:Sub Tool 0"]
    [VarSet,bWidth,[IWidth,#stPath]]
    [VarSet,bHeight,7]
    [Loop,1,
    [If,(md&1 == 1),//make sure START is on
    [If,([IModGet,"Tool:Sub Tool 0"]&1 != 1),
    [IClick,#stPath,bWidth-117,bHeight]
    ]
    [LoopExit]
    ,//else turn off if necessary
    [If,([IModGet,"Tool:Sub Tool 0"]&1 == 1),
    [IClick,#stPath,bWidth-117,bHeight]
    ]
    ]
    [If,(md&2 == 2),//make sure Addition is on
    [If,([IModGet,"Tool:Sub Tool 0"]&2 != 2),
    [IClick,#stPath,bWidth-96,bHeight]
    ]
    [LoopExit]
    ]
    [If,(md&4 == 4),//make sure Subtraction is on

    [If,([IModGet,"Tool:Sub Tool 0"]&4 != 4),
    [IClick,#stPath,bWidth-75,bHeight]
    ]
    [LoopExit]
    ]
    [If,(md&8 == 8),//make sure Intersection is on
    [If,([IModGet,"Tool:Sub Tool 0"]&8 != 8),
    [IClick,#stPath,bWidth-54,bHeight]
    ]
    [LoopExit]
    ]
    ]//end loop
    ,md]//Boolean mode: 1 = START, 2 = Addition, 4 = Subtraction, 8 = Intersection



    To call the routine above just put the mode you want as the parameter, so that for subtraction you'd write:

    [RoutineCall,SetBoolean,4]

    HTH,

  3. #3
    Member Follow User Gallery
    Join Date
    Sep 2008
    Location
    New York City
    Posts
    63

    Default

    thanks for your help, Marcus! I got the Color Picker turned into a macro that I assigned to a hotkey and it works great now.

    However, with my sadly limited macroing and non-existant scripting skills, I don't know what to do with the live boolean commands you kindly shared. is there a way to make a separate macro for each boolean mode?

    best wishes

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

    Default

    It's quicker and neater to make a little plugin, which is what I've done. Unzip and put the SetBoolean.zsc file into the ZBrush 4R8\ZStartup\ZPlugs64 folder and restart ZBrush. There will then be a new sub-palette called "Set Boolean Mode" in the Zplugin palette. I've included the zscript txt file in the zip if you are interested in seeing how it's done.


    SetBoolean.zip

  5. #5
    Member Follow User Gallery
    Join Date
    Sep 2008
    Location
    New York City
    Posts
    63

    Default

    Awesome, thanks! I'm slowly getting the hang of zscripting with this help

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

    Default

    You're welcome, Ryan. ZScript is not too difficult once you get the hang of it, and can be rewarding. I presume you already know about the ZScripting section in the Online Docs. And if you have any questions I'll do my best to answer them.

Posting Permissions

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