ZBrushCentral

HELP - how to get prompted for a tool in the middle of a macro

so i’ve been trying to make one button macros that automate tasks that require a lot of button pushes. i successfully created a macro to automate the appending of a zsphere subtool to retopologize.

now, i want to make a macro that starts with a zsphere and then uses RIGGING>SELECT MESH to begin the retopo process… problem is that SELECT MESH requires the user to select a tool… but when i don’t specify a very specific tool in the script, i never get a requester for me to specify (or maybe i do… something seems to pop up for a split second but disappears as zb continues to the end of the macro).

anyone know how i can accomplish what i want?

thanks much.

jin

//ZBRUSH MACRO - Recorded in ZBrush version 4.6
[IButton,???,“Press to run this macro. Macros can be aborted by pressing the ëescÃ* key.”,
[IShowActions,0]
[IConfig,4.6]
[IPress,Tool:SimpleBrush]
[IPress,Tool:ZSphere]

//just drawing the zsphere to canvas
[CanvasStroke,(ZObjStrokeV02n168=H2ADV1A4H2AEV1A6H2BEV1BBH2C2V1BFH2C7V1C5H2CBV1CAH2CFV1CEH2D4V1D3H2D7V1D7H2DBV1DBH2E0V1DFH2E3V1E3H2E6V1E7H2EAV1EBH2EEV1EFH2F1V1F2H2F4V1F5H2F6V1F8H2F8V1FAH2FAV1FCH2FBV1FDH2FCV1FEH2FDV1FFH2FEV201H2FFV201H300V203H301V204H301V205H303V206H304V207H304V208H305V20AH306V20AH307V20CH307V20EH309V20FH30AV211H30AV213H30BV213H30CV215H30DV217H30DV218H30DV219H30EV21BH30EV21CH30EV21FH30EV221H30EV223H30EV226H30DV229H30AV22BH309V22EH307V231H306V233H304V236H302V238H301V23AH2FFV23CH2FDV23EH2FCV240H2FBV242H2F9V243H2F8V245H2F8V246H2F6V247H2F5V249H2F4V24BH2F3V24CH2F3V24DH2F2V24EH2F2V24FH2F1V250H2F1V251H2F0V252H2EFV252H2EFV253H2EFV254H2EFV255YH2ADV255K1XH2ADV256H2ADV257H2ADv257FFH2ADV259H2ADV25AH2ADv25AFFH2ADV25DH2ADv25DFFH2ADV25FH2ADV261H2ADV262H2ADV264H2ADV266H2ADV268H2ADv269FFH2ADV26DH2ADV26FH2ADV270H2ADV273
H2ADV274H2ADV276H2ADV279H2ADV27AH2ADv27BFFH2ADV27DH2ADV27FH2ADv27FFFH2ADV281H2ADV282H2ADV282H2ADV283H2ADV284H2ADV285H2ADV285H2ADV286H2ADV287H2ADV288H2ADV289H2ADV28AH2ADV28BH2ADV28CH2ADV28DH2ADv28DFFH2ADV28FH2ADV291H2ADV293H2ADV294H2ADV296H2ADV297H2ADV299H2ADV29AH2ADV29CH2ADV29DH2ADV29FH2ADV2A0H2ADV2A1H2ADv2A2FFH2ADV2A6H2ADV2A7H2ADV2A8H2ADV2A9H2ADV2ABH2ADV2ACH2ADV2ADH2ADV2AFH2ADV2AFH2ADV2B0H2ADV2B2H2ADV2B3H2ADV2B4H2ADV2B5H2ADV2B6H2ADV2B7H2ADV2B8H2ADV2B9H2ADV2BAH2ADV2BBH2ADv2BBFFH2ADV2BEH2ADV2C0H2ADV2C1H2ADV2C2H2ADV2C4H2ADV2C5H2ADV2C6H2ADV2C7H2ADV2C8H2ADV2C9H2ADV2C9)]

[IPress,Transform: Edit]
[IPress,Tool:Rigging:Select Mesh]

//if i leave below uncommented on, it loads that mesh and terminates correctly but i want a general purpose button that i can use to begin this retopo process on ANY mesh… not just THIS mesh.
//[IPress,PopUp:PolyMesh3D]

[ISet,Tool:Deformation:Size,-100]
[IPress,Tool:Topology:Edit Topology]
]

Not sure about this, but I know you could replace a bunch of the code to draw out the zsphere. Click at x,y to x,y. Then keystroke “t” for edit mode :wink:
Probably easiest to have your ztool selected first…

The problem is that when you press the ‘Select Mesh’ button the pop-up from which you can select the mesh only remains visible while the cursor is over it. If you try doing this using a macro (or zscript) the cursor is often not over the pop-up and so it disappears almost immediately. I remember trying to find a way to keep the pop-up visible but without success.

The solution is to get the name of the mesh before you start the zsphere rigging setup process. So basically, you would select the tool you want to rig before pressing your macro button.

I’ll try and post some code later today.

Here you are:

//ZBRUSH MACRO - Recorded in ZBrush version 4.6
[IButton,???,“Set up ZSphere Edit Topology for the selected tool”,
[IShowActions,0]
[IConfig,4.6]
[If,[IExists,Tool:Geometry:SDiv],//if this is a polymesh
[ISet,Tool:Geometry:SDiv,1]//set subdiv to lowest level
//get name of tool
[VarSet,currentSubTool,[IGetTitle,Tool:Current Tool,0]]
//set up rig
[IPress,Tool:ZSphere]
[IPress,Tool:Rigging:Select Mesh]
[IPress,[StrMerge,“PopUp:”,[Var,currentSubTool]]]
[IPress,Tool:Topology:Edit Topology]
]//end if
]//end macro

oh holy crap,

thank you so much marcus! that’s perfect!

jin