[IButton,???,"Clear The Matcap assignment of all Subtools", [VarDef,subtoolName,""] // Define a new variable to store the current subtool name [VarDef,subtool(1024),0] // Define a Variable list to store the subtool active index [VarSet,totalSubtools,[SubToolGetCount]] // create a variable to define the number of loop based on the subtools count [VarSet,activeSubtool,[SubToolGetActiveIndex]] // create a variable with the current subtool Index // Select the first subtool in the list [If, activeSubtool==0, [SubToolSelect,1] ] // Loop to fill every subtool with the Flat Color matcap until it runs out of subtools [Loop, totalSubtools, [SubToolSelect,[Val,n]] [IFreeze, [IPress,Material:Flat Color] [IPress,Draw:M] [IPress,Color:FillObject] [IUnPress,Draw:M] [IPress,Material:SkinShade4] ] ,n] ]
^This will CLEAR all assigned Matcaps from every subtool^
As before you can copy paste this script into sublime text and save as a text file in your macros directory ex: "C:\Program Files\Pixologic\ZBrush 2018\ZStartup\Macros"
[IButton,???,"Fill all Subtools with current Matcap", [VarDef,subtoolName,""] // Define a new variable to store the current subtool name [VarDef,subtool(1024),0] // Define a Variable list to store the subtool active index [VarSet,totalSubtools,[SubToolGetCount]] // create a variable to define the number of loop based on the subtools count [VarSet,activeSubtool,[SubToolGetActiveIndex]] // create a variable with the current subtool Index // Select the first subtool of the Ztool [If, activeSubtool==0, [SubToolSelect,1] ] // Loop to fill every subtool with the current matcap until it runs out of subtools [Loop, totalSubtools, [SubToolSelect,[Val,n]] [IPress,Draw:M] [IPress,Color:FillObject] [IPress,Tool:SubTool:SelectDown] ,n] ]
What does it do? Often when moving a Ztool from one pc to another the matcap assignments will get mixed up.
So this script:
1 - Stores all of the Subtools into a list
2 - Selects the first Subtool in that list
3 - Script 1 Works through each item (subtool) in the list and fills each one with the special "flat color matcap"..
Script 2 does something similar but instead of clearing the matcap it assigns whichever matcap is currently selected.
4 - The script stops when it runs down the list.
If you install them correctly you should now have two buttons in your macro menu named whatever you saved them as:
Open one in Sublime it should look like this:
So the loop is set up - if you change the highlighted commands out with something else it will play that action out on all subtools. Maybe you'd like to apply a polish or surface noise on all subtools. Maybe a random rotation. Experiment Good luck :)
Special thanks to https://puppet-master.net for sharing the above script examples I edited to help me understand using the loop on subtools. His code and comments are very helpful. I hope he uploads more examples!