// MatCapToggle - toggles between two matcaps // Directions: // Put this in the ZStartup\Macros\Misc folder. Load/Init ZBrush or do Macro:Reload All Macros. // Select a material and click the MatCapToggle button in Macro:Macros:Misc. // Select a second material and click the button again. // Assign a hotkey (Ctrl+Alt click the button and press the hotkey). // Now pressing the hotkey will toggle between the two materials. Reassign by clicking the button. // (You can save the hotkey for future sessions via Preferences:Hotkeys:Store.) // by 0x00019913, adapted from BrushToggle by marcus_civis [If,[MemGetSize,MatCapToggleData],, [If,[FileExists,"MatCapToggleData.zvr"], [MemCreateFromFile,MatCapToggleData,"MatCapToggleData.zvr"] [MVarSet,MatCapToggleData,2,0] , [MVarDef,MatCapToggleData,3,0] [MVarSet,MatCapToggleData,0,1000] [MVarSet,MatCapToggleData,1,1000] // BrushToggle had these initialized to 134, but it's entirely possible // for something to have that ID, so setting this way higher ] ] [RoutineDef,StoreMatCap, [VarDef,message,""] [If,[MVarGet,MatCapToggleData,2]==0, [MVarSet,MatCapToggleData,0,[IGet,Material:ItemInfo]] [MVarSet,MatCapToggleData,2,1] [MemSaveToFile,MatCapToggleData,"MatCapToggleData.zvr",1] [VarSet,message,[StrMerge,"Primary material set to ",[IGetTitle,Material:CurrentMaterial]]] , [MVarSet,MatCapToggleData,1,[IGet,Material:ItemInfo]] [MVarSet,MatCapToggleData,2,0] [MemSaveToFile,MatCapToggleData,"MatCapToggleData.zvr",1] [VarSet,message,[StrMerge,"Secondary material set to ",[IGetTitle,Material:CurrentMaterial]]] ] [Note,message] ] [IButton,???,"Toggle material", [IConfig,4.0] // set lower if necessary, but should be fine for most ZBrush copies [If,([IGet,Preferences:Utilities:ViewWindowID]==[IGetID,0]), // if button was pressed, store material [RoutineCall,StoreMatCap] , // else, hotkey was pressed [If,[IGet,Material:ItemInfo]==[MVarGet,MatCapToggleData,0], [ISet,Material:ItemInfo,[MVarGet,MatCapToggleData,1]] , [ISet,Material:ItemInfo,[MVarGet,MatCapToggleData,0]] ] ] ]