[VarDef,gStartupFolder,"ZBRUSH_ZDATA/Materials/Startup/"]
[VarDef,gMatcapFolder,"ZBRUSH_ZDATA/Materials/MatCap/"]
[VarDef,gUserFolder,"ZBRUSH_ZSTARTUP/Materials/"]
[VarDef,gLightboxFolder,"ZBRUSH_ZMATERIALS/"]
[IButton,"Reset mat","Reset the current material",
[VarSet,lCurrentMat,[StrMerge,[IGetTitle,Material:Current Material],".zmt"]]
[VarSet,loadOK,0]
[Loop,1,
[VarSet,mat,[StrMerge,gStartupFolder,lCurrentMat]]
[If,[FileExists,mat],[VarSet,loadOK,1][LoopExit]]
[VarSet,mat,[StrMerge,gMatcapFolder,lCurrentMat]]
[If,[FileExists,mat],[VarSet,loadOK,1][LoopExit]]
[VarSet,mat,[StrMerge,gUserFolder,lCurrentMat]]
[If,[FileExists,mat],[VarSet,loadOK,1][LoopExit]]
[VarSet,mat,[StrMerge,gLightboxFolder,lCurrentMat]]
[If,[FileExists,mat],[VarSet,loadOK,1][LoopExit]]
]
[If,loadOK,
[Note,"Material not found. Please load file from disk"]
]
,,1]