ZBrushCentral

Making a macro that repeats X number of times

Hi everybody,
I have made a few macros.
Now I need to make one that will apply changes to all my subtools - similar to the subtool master action.

How can I make a macro that includes the number of subtools?
For instance if I have 14 subtools I need to make a macro that repeats 14 times and then stops.

Thanks

Just answered you in the other forum. :slight_smile:

Which forum? I’d like to see how this works as well.

You can see the thread HERE

It makes sense to have the answer here too, so here it is:

First of all record a macro of the action you want to apply but just do it with one subtool. Make sure you select the subtool before starting recording the macro and don’t select any other subtool before ending the recording. Save the macro to your macros folder, select a new subtool and test it, to see that the macro does what you want.

Next you’ll need to edit the macro file in a text editor. You’ll find it in the ZStartup/Macros folder (or a subfolder of that). Open it up and then edit it according to this example. The Gray code is the start and end of the macro; leave that as it is. The bit you need to alter is between the [IConfig,3.2] and the last bracket ‘]’. Wrap the orange code below around the other code, so that the stuff you recorded all goes in the loop where the turquoise comment is.

 
//ZBRUSH MACRO - Recorded in ZBrush version 3.0
[IButton,???,"Press to run this macro. Macros can be aborted by pressing the ‘esc’ key.",
   [IShowActions,0]
   [IConfig,3.2]
   [Loop,1024,
	
	   //insert the code you want to run for a subtool here
			
        
     [If,[IsEnabled,Tool:SubTool:SelectDown],
	   [IPress, Tool:SubTool:SelectDown]
       ,//else no select down so end of subtools & exit
	   [LoopExit]
	]//end if
    ]//end loop
]//end of macro button

When you’re done editing, save the file back to its original location and restart ZBrush. The macro should then work on any number of subtools, working its way down from the selected subtool. To go thru all subtools, select the top subtool before running the macro.

HTH,

Thanks for the information. I had made a try of it already and it’s a great one.