//MaterialList, A ZBrush ZScript by Pixolator
//Title of this list can be entered in the next line. Examples... "Metals" or "By ?????"
[VarDef,ListTitle,"UNTITLED"]
//Authors' contact info can be entered in the next line Examples... "www.mysite.com" or "me@email_address.com"
[VarDef,AutorAddress,"www.ZBrushCentral.com"]
[if, [IExists,ZScript:ReplayDelay],,[FileNameSetNext,error.err][IPress,ZScript:Load][Exit]]
[PenMove,-11,-11]
[Image,MaterialListPanel.psd,1]
[VarDef,itemsPerRow,5]
[VarDef,matFile(100),"UnNamed"][VarDef,matImage(100),"UnNamed"][VarDef,matData(100),"UnNamed"]
[VarDef,red(100),0][VarDef,green(100),0][VarDef,blue(100),0]
[VarSet,i,0]
[VarDef,ThumbnailSize,80]
[VarDef,matDataRed,128][VarDef,matDataGreen,128][VarDef,matDataBlue,128]
[VarDef,matDataIsActive,0]
//------------------------------------------------------------------------------------------
//..................................................................Initialize Material List
//------------------------------------------------------------------------------------------
[VarSet,matData(i),"ML001.dat"][VarSet,matImage(i),"ML001.psd"][VarSet,matFile(i),"ML001.zmt"][VarSet,red(i),243][VarSet,green(i),212][VarSet,blue(i),188][VarInc,i]
[VarSet,matData(i),"ML002.dat"][VarSet,matImage(i),"ML002.psd"][VarSet,matFile(i),"ML002.zmt"][VarSet,red(i),204][VarSet,green(i),138][VarSet,blue(i),121][VarInc,i]
[VarSet,matData(i),"ML003.dat"][VarSet,matImage(i),"ML003.psd"][VarSet,matFile(i),"ML003.zmt"][VarSet,red(i),195][VarSet,green(i),165][VarSet,blue(i),141][VarInc,i]
[VarSet,matData(i),"ML004.dat"][VarSet,matImage(i),"ML004.psd"][VarSet,matFile(i),"ML004.zmt"][VarSet,red(i),207][VarSet,green(i),185][VarSet,blue(i),174][VarInc,i]
[VarSet,matData(i),"ML005.dat"][VarSet,matImage(i),"ML005.psd"][VarSet,matFile(i),"ML005.zmt"][VarSet,red(i),236][VarSet,green(i),190][VarSet,blue(i),143][VarInc,i]
[VarSet,matData(i),"ML006.dat"][VarSet,matImage(i),"ML006.psd"][VarSet,matFile(i),"ML006.zmt"][VarSet,red(i),039][VarSet,green(i),118][VarSet,blue(i),110][VarInc,i]
[VarSet,matData(i),"ML007.dat"][VarSet,matImage(i),"ML007.psd"][VarSet,matFile(i),"ML007.zmt"][VarSet,red(i),120][VarSet,green(i),061][VarSet,blue(i),037][VarInc,i]
[VarSet,matData(i),"ML008.dat"][VarSet,matImage(i),"ML008.psd"][VarSet,matFile(i),"ML008.zmt"][VarSet,red(i),243][VarSet,green(i),119][VarSet,blue(i),015][VarInc,i]
[VarSet,matData(i),"ML009.dat"][VarSet,matImage(i),"ML009.psd"][VarSet,matFile(i),"ML009.zmt"][VarSet,red(i),240][VarSet,green(i),182][VarSet,blue(i),130][VarInc,i]
[VarSet,matData(i),"ML010.dat"][VarSet,matImage(i),"ML010.psd"][VarSet,matFile(i),"ML010.zmt"][VarSet,red(i),240][VarSet,green(i),182][VarSet,blue(i),130][VarInc,i]
[VarSet,matData(i),"ML011.dat"][VarSet,matImage(i),"ML011.psd"][VarSet,matFile(i),"ML011.zmt"][VarSet,red(i),231][VarSet,green(i),221][VarSet,blue(i),201][VarInc,i]
[VarSet,matData(i),"ML012.dat"][VarSet,matImage(i),"ML012.psd"][VarSet,matFile(i),"ML012.zmt"][VarSet,red(i),127][VarSet,green(i),158][VarSet,blue(i),204][VarInc,i]
[VarSet,matData(i),"ML013.dat"][VarSet,matImage(i),"ML013.psd"][VarSet,matFile(i),"ML013.zmt"][VarSet,red(i),167][VarSet,green(i),167][VarSet,blue(i),167][VarInc,i]
[VarSet,matData(i),"ML014.dat"][VarSet,matImage(i),"ML014.psd"][VarSet,matFile(i),"ML014.zmt"][VarSet,red(i),255][VarSet,green(i),163][VarSet,blue(i),000][VarInc,i]
[VarSet,matData(i),"ML015.dat"][VarSet,matImage(i),"ML015.psd"][VarSet,matFile(i),"ML015.zmt"][VarSet,red(i),205][VarSet,green(i),187][VarSet,blue(i),154][VarInc,i]
[VarSet,matData(i),"ML016.dat"][VarSet,matImage(i),"ML016.psd"][VarSet,matFile(i),"ML016.zmt"][VarSet,red(i),230][VarSet,green(i),212][VarSet,blue(i),201][VarInc,i]
[VarSet,matData(i),"ML017.dat"][VarSet,matImage(i),"ML017.psd"][VarSet,matFile(i),"ML017.zmt"][VarSet,red(i),255][VarSet,green(i),173][VarSet,blue(i),000][VarInc,i]
[VarSet,matData(i),"ML018.dat"][VarSet,matImage(i),"ML018.psd"][VarSet,matFile(i),"ML018.zmt"][VarSet,red(i),255][VarSet,green(i),255][VarSet,blue(i),255][VarInc,i]
[VarSet,matData(i),"ML019.dat"][VarSet,matImage(i),"ML019.psd"][VarSet,matFile(i),"ML019.zmt"][VarSet,red(i),180][VarSet,green(i),180][VarSet,blue(i),180][VarInc,i]
[VarSet,matData(i),"ML020.dat"][VarSet,matImage(i),"ML020.psd"][VarSet,matFile(i),"ML020.zmt"][VarSet,red(i),166][VarSet,green(i),123][VarSet,blue(i),070][VarInc,i]
[VarSet,matData(i),"ML021.dat"][VarSet,matImage(i),"ML021.psd"][VarSet,matFile(i),"ML021.zmt"][VarSet,red(i),226][VarSet,green(i),170][VarSet,blue(i),104][VarInc,i]
[VarSet,matData(i),"ML022.dat"][VarSet,matImage(i),"ML022.psd"][VarSet,matFile(i),"ML022.zmt"][VarSet,red(i),245][VarSet,green(i),181][VarSet,blue(i),045][VarInc,i]
[VarSet,matData(i),"ML023.dat"][VarSet,matImage(i),"ML023.psd"][VarSet,matFile(i),"ML023.zmt"][VarSet,red(i),235][VarSet,green(i),121][VarSet,blue(i),045][VarInc,i]
[VarSet,matData(i),"ML024.dat"][VarSet,matImage(i),"ML024.psd"][VarSet,matFile(i),"ML024.zmt"][VarSet,red(i),102][VarSet,green(i),127][VarSet,blue(i),058][VarInc,i]
[VarSet,matData(i),"ML025.dat"][VarSet,matImage(i),"ML025.psd"][VarSet,matFile(i),"ML025.zmt"][VarSet,red(i),255][VarSet,green(i),255][VarSet,blue(i),255][VarInc,i]
[VarSet,matData(i),"ML026.dat"][VarSet,matImage(i),"ML026.psd"][VarSet,matFile(i),"ML026.zmt"][VarSet,red(i),231][VarSet,green(i),217][VarSet,blue(i),195][VarInc,i]
[VarSet,matData(i),"ML027.dat"][VarSet,matImage(i),"ML027.psd"][VarSet,matFile(i),"ML027.zmt"][VarSet,red(i),168][VarSet,green(i),205][VarSet,blue(i),092][VarInc,i]
[VarSet,matData(i),"ML028.dat"][VarSet,matImage(i),"ML028.psd"][VarSet,matFile(i),"ML028.zmt"][VarSet,red(i),250][VarSet,green(i),226][VarSet,blue(i),092][VarInc,i]
[VarSet,matData(i),"ML029.dat"][VarSet,matImage(i),"ML029.psd"][VarSet,matFile(i),"ML029.zmt"][VarSet,red(i),038][VarSet,green(i),089][VarSet,blue(i),164][VarInc,i]
[VarSet,matData(i),"ML030.dat"][VarSet,matImage(i),"ML030.psd"][VarSet,matFile(i),"ML030.zmt"][VarSet,red(i),255][VarSet,green(i),255][VarSet,blue(i),255][VarInc,i]
[VarSet,matData(i),"ML031.dat"][VarSet,matImage(i),"ML031.psd"][VarSet,matFile(i),"ML031.zmt"][VarSet,red(i),110][VarSet,green(i),110][VarSet,blue(i),110][VarInc,i]
[VarSet,matData(i),"ML032.dat"][VarSet,matImage(i),"ML032.psd"][VarSet,matFile(i),"ML032.zmt"][VarSet,red(i),247][VarSet,green(i),187][VarSet,blue(i),134][VarInc,i]
[VarSet,matData(i),"ML033.dat"][VarSet,matImage(i),"ML033.psd"][VarSet,matFile(i),"ML033.zmt"][VarSet,red(i),227][VarSet,green(i),206][VarSet,blue(i),188][VarInc,i]
[VarSet,matData(i),"ML034.dat"][VarSet,matImage(i),"ML034.psd"][VarSet,matFile(i),"ML034.zmt"][VarSet,red(i),138][VarSet,green(i),072][VarSet,blue(i),013][VarInc,i]
[VarSet,matData(i),"ML035.dat"][VarSet,matImage(i),"ML035.psd"][VarSet,matFile(i),"ML035.zmt"][VarSet,red(i),170][VarSet,green(i),170][VarSet,blue(i),170][VarInc,i]
[VarSet,matData(i),"ML036.dat"][VarSet,matImage(i),"ML036.psd"][VarSet,matFile(i),"ML036.zmt"][VarSet,red(i),216][VarSet,green(i),208][VarSet,blue(i),200][VarInc,i]
[VarSet,matData(i),"ML037.dat"][VarSet,matImage(i),"ML037.psd"][VarSet,matFile(i),"ML037.zmt"][VarSet,red(i),255][VarSet,green(i),128][VarSet,blue(i),000][VarInc,i]
[VarSet,matData(i),"ML038.dat"][VarSet,matImage(i),"ML038.psd"][VarSet,matFile(i),"ML038.zmt"][VarSet,red(i),255][VarSet,green(i),100][VarSet,blue(i),000][VarInc,i]
[VarSet,matData(i),"ML039.dat"][VarSet,matImage(i),"ML039.psd"][VarSet,matFile(i),"ML039.zmt"][VarSet,red(i),180][VarSet,green(i),105][VarSet,blue(i),070][VarInc,i]
[VarSet,matData(i),"ML040.dat"][VarSet,matImage(i),"ML040.psd"][VarSet,matFile(i),"ML040.zmt"][VarSet,red(i),247][VarSet,green(i),159][VarSet,blue(i),027][VarInc,i]
[VarSet,matData(i),"ML041.dat"][VarSet,matImage(i),"ML041.psd"][VarSet,matFile(i),"ML041.zmt"][VarSet,red(i),230][VarSet,green(i),226][VarSet,blue(i),207][VarInc,i]
[VarSet,matData(i),"ML042.dat"][VarSet,matImage(i),"ML042.psd"][VarSet,matFile(i),"ML042.zmt"][VarSet,red(i),129][VarSet,green(i),111][VarSet,blue(i),084][VarInc,i]
[VarSet,matData(i),"ML043.dat"][VarSet,matImage(i),"ML043.psd"][VarSet,matFile(i),"ML043.zmt"][VarSet,red(i),225][VarSet,green(i),226][VarSet,blue(i),217][VarInc,i]
[VarSet,matData(i),"ML044.dat"][VarSet,matImage(i),"ML044.psd"][VarSet,matFile(i),"ML044.zmt"][VarSet,red(i),255][VarSet,green(i),255][VarSet,blue(i),255][VarInc,i]
[VarSet,matData(i),"ML045.dat"][VarSet,matImage(i),"ML045.psd"][VarSet,matFile(i),"ML045.zmt"][VarSet,red(i),255][VarSet,green(i),255][VarSet,blue(i),255][VarInc,i]
[VarSet,matData(i),"ML046.dat"][VarSet,matImage(i),"ML046.psd"][VarSet,matFile(i),"ML046.zmt"][VarSet,red(i),240][VarSet,green(i),130][VarSet,blue(i),000][VarInc,i]
[VarSet,matData(i),"ML047.dat"][VarSet,matImage(i),"ML047.psd"][VarSet,matFile(i),"ML047.zmt"][VarSet,red(i),234][VarSet,green(i),121][VarSet,blue(i),007][VarInc,i]
[VarSet,matData(i),"ML048.dat"][VarSet,matImage(i),"ML048.psd"][VarSet,matFile(i),"ML048.zmt"][VarSet,red(i),226][VarSet,green(i),213][VarSet,blue(i),200][VarInc,i]
[VarSet,matData(i),"ML049.dat"][VarSet,matImage(i),"ML049.psd"][VarSet,matFile(i),"ML049.zmt"][VarSet,red(i),145][VarSet,green(i),098][VarSet,blue(i),205][VarInc,i]
[VarSet,matData(i),"ML050.dat"][VarSet,matImage(i),"ML050.psd"][VarSet,matFile(i),"ML050.zmt"][VarSet,red(i),169][VarSet,green(i),115][VarSet,blue(i),016][VarInc,i]
[VarSet,matData(i),"ML051.dat"][VarSet,matImage(i),"ML051.psd"][VarSet,matFile(i),"ML051.zmt"][VarSet,red(i),217][VarSet,green(i),155][VarSet,blue(i),046][VarInc,i]
[VarSet,matData(i),"ML052.dat"][VarSet,matImage(i),"ML052.psd"][VarSet,matFile(i),"ML052.zmt"][VarSet,red(i),217][VarSet,green(i),155][VarSet,blue(i),046][VarInc,i]
[VarSet,matData(i),"ML053.dat"][VarSet,matImage(i),"ML053.psd"][VarSet,matFile(i),"ML053.zmt"][VarSet,red(i),217][VarSet,green(i),155][VarSet,blue(i),046][VarInc,i]
[VarSet,matData(i),"ML054.dat"][VarSet,matImage(i),"ML054.psd"][VarSet,matFile(i),"ML054.zmt"][VarSet,red(i),197][VarSet,green(i),126][VarSet,blue(i),033][VarInc,i]
[VarSet,matData(i),"ML055.dat"][VarSet,matImage(i),"ML055.psd"][VarSet,matFile(i),"ML055.zmt"][VarSet,red(i),213][VarSet,green(i),107][VarSet,blue(i),044][VarInc,i]
[VarSet,matData(i),"ML056.dat"][VarSet,matImage(i),"ML056.psd"][VarSet,matFile(i),"ML056.zmt"][VarSet,red(i),186][VarSet,green(i),206][VarSet,blue(i),241][VarInc,i]
[VarSet,matData(i),"ML057.dat"][VarSet,matImage(i),"ML057.psd"][VarSet,matFile(i),"ML057.zmt"][VarSet,red(i),255][VarSet,green(i),255][VarSet,blue(i),255][VarInc,i]
[VarSet,matData(i),"ML058.dat"][VarSet,matImage(i),"ML058.psd"][VarSet,matFile(i),"ML058.zmt"][VarSet,red(i),197][VarSet,green(i),193][VarSet,blue(i),167][VarInc,i]
[VarSet,matData(i),"ML059.dat"][VarSet,matImage(i),"ML059.psd"][VarSet,matFile(i),"ML059.zmt"][VarSet,red(i),104][VarSet,green(i),076][VarSet,blue(i),064][VarInc,i]
[VarSet,matData(i),"ML060.dat"][VarSet,matImage(i),"ML060.psd"][VarSet,matFile(i),"ML060.zmt"][VarSet,red(i),222][VarSet,green(i),097][VarSet,blue(i),036][VarInc,i]
[VarSet,matData(i),"ML061.dat"][VarSet,matImage(i),"ML061.psd"][VarSet,matFile(i),"ML061.zmt"][VarSet,red(i),248][VarSet,green(i),248][VarSet,blue(i),248][VarInc,i]
[VarSet,matData(i),"ML062.dat"][VarSet,matImage(i),"ML062.psd"][VarSet,matFile(i),"ML062.zmt"][VarSet,red(i),180][VarSet,green(i),200][VarSet,blue(i),217][VarInc,i]
[VarSet,matData(i),"ML063.dat"][VarSet,matImage(i),"ML063.psd"][VarSet,matFile(i),"ML063.zmt"][VarSet,red(i),214][VarSet,green(i),194][VarSet,blue(i),178][VarInc,i]
[VarSet,matData(i),"ML064.dat"][VarSet,matImage(i),"ML064.psd"][VarSet,matFile(i),"ML064.zmt"][VarSet,red(i),151][VarSet,green(i),101][VarSet,blue(i),059][VarInc,i]
[VarSet,matData(i),"ML065.dat"][VarSet,matImage(i),"ML065.psd"][VarSet,matFile(i),"ML065.zmt"][VarSet,red(i),242][VarSet,green(i),242][VarSet,blue(i),235][VarInc,i]
[VarSet,matData(i),"ML066.dat"][VarSet,matImage(i),"ML066.psd"][VarSet,matFile(i),"ML066.zmt"][VarSet,red(i),217][VarSet,green(i),217][VarSet,blue(i),217][VarInc,i]
[VarSet,matData(i),"ML067.dat"][VarSet,matImage(i),"ML067.psd"][VarSet,matFile(i),"ML067.zmt"][VarSet,red(i),217][VarSet,green(i),217][VarSet,blue(i),217][VarInc,i]
[VarSet,matData(i),"ML068.dat"][VarSet,matImage(i),"ML068.psd"][VarSet,matFile(i),"ML068.zmt"][VarSet,red(i),215][VarSet,green(i),145][VarSet,blue(i),004][VarInc,i]
[VarSet,matData(i),"ML069.dat"][VarSet,matImage(i),"ML069.psd"][VarSet,matFile(i),"ML069.zmt"][VarSet,red(i),163][VarSet,green(i),086][VarSet,blue(i),000][VarInc,i]
[VarSet,matData(i),"ML070.dat"][VarSet,matImage(i),"ML070.psd"][VarSet,matFile(i),"ML070.zmt"][VarSet,red(i),098][VarSet,green(i),087][VarSet,blue(i),070][VarInc,i]
[VarSet,matData(i),"ML071.dat"][VarSet,matImage(i),"ML071.psd"][VarSet,matFile(i),"ML071.zmt"][VarSet,red(i),106][VarSet,green(i),044][VarSet,blue(i),017][VarInc,i]
[VarSet,matData(i),"ML072.dat"][VarSet,matImage(i),"ML072.psd"][VarSet,matFile(i),"ML072.zmt"][VarSet,red(i),233][VarSet,green(i),126][VarSet,blue(i),019][VarInc,i]
[VarSet,matData(i),"ML073.dat"][VarSet,matImage(i),"ML073.psd"][VarSet,matFile(i),"ML073.zmt"][VarSet,red(i),255][VarSet,green(i),255][VarSet,blue(i),255][VarInc,i]
[VarSet,matData(i),"ML074.dat"][VarSet,matImage(i),"ML074.psd"][VarSet,matFile(i),"ML074.zmt"][VarSet,red(i),116][VarSet,green(i),046][VarSet,blue(i),007][VarInc,i]
[VarSet,matData(i),"ML075.dat"][VarSet,matImage(i),"ML075.psd"][VarSet,matFile(i),"ML075.zmt"][VarSet,red(i),169][VarSet,green(i),064][VarSet,blue(i),011][VarInc,i]
[VarSet,matData(i),"ML076.dat"][VarSet,matImage(i),"ML076.psd"][VarSet,matFile(i),"ML076.zmt"][VarSet,red(i),114][VarSet,green(i),117][VarSet,blue(i),096][VarInc,i]
[VarSet,matData(i),"ML077.dat"][VarSet,matImage(i),"ML077.psd"][VarSet,matFile(i),"ML077.zmt"][VarSet,red(i),204][VarSet,green(i),188][VarSet,blue(i),209][VarInc,i]
[VarSet,matData(i),"ML078.dat"][VarSet,matImage(i),"ML078.psd"][VarSet,matFile(i),"ML078.zmt"][VarSet,red(i),162][VarSet,green(i),179][VarSet,blue(i),225][VarInc,i]
[VarSet,matData(i),"ML079.dat"][VarSet,matImage(i),"ML079.psd"][VarSet,matFile(i),"ML079.zmt"][VarSet,red(i),026][VarSet,green(i),026][VarSet,blue(i),026][VarInc,i]
[VarSet,matData(i),"ML080.dat"][VarSet,matImage(i),"ML080.psd"][VarSet,matFile(i),"ML080.zmt"][VarSet,red(i),219][VarSet,green(i),214][VarSet,blue(i),207][VarInc,i]
[VarSet,matData(i),"ML081.dat"][VarSet,matImage(i),"ML081.psd"][VarSet,matFile(i),"ML081.zmt"][VarSet,red(i),255][VarSet,green(i),000][VarSet,blue(i),000][VarInc,i]
[VarSet,matData(i),"ML082.dat"][VarSet,matImage(i),"ML082.psd"][VarSet,matFile(i),"ML082.zmt"][VarSet,red(i),038][VarSet,green(i),041][VarSet,blue(i),248][VarInc,i]
[VarSet,matData(i),"ML083.dat"][VarSet,matImage(i),"ML083.psd"][VarSet,matFile(i),"ML083.zmt"][VarSet,red(i),174][VarSet,green(i),073][VarSet,blue(i),011][VarInc,i]
[VarSet,matData(i),"ML084.dat"][VarSet,matImage(i),"ML084.psd"][VarSet,matFile(i),"ML084.zmt"][VarSet,red(i),073][VarSet,green(i),070][VarSet,blue(i),028][VarInc,i]
[VarSet,matData(i),"ML085.dat"][VarSet,matImage(i),"ML085.psd"][VarSet,matFile(i),"ML085.zmt"][VarSet,red(i),012][VarSet,green(i),077][VarSet,blue(i),068][VarInc,i]
[VarSet,matData(i),"ML086.dat"][VarSet,matImage(i),"ML086.psd"][VarSet,matFile(i),"ML086.zmt"][VarSet,red(i),007][VarSet,green(i),060][VarSet,blue(i),122][VarInc,i]
[VarSet,matData(i),"ML087.dat"][VarSet,matImage(i),"ML087.psd"][VarSet,matFile(i),"ML087.zmt"][VarSet,red(i),083][VarSet,green(i),047][VarSet,blue(i),012][VarInc,i]
[VarSet,matData(i),"ML088.dat"][VarSet,matImage(i),"ML088.psd"][VarSet,matFile(i),"ML088.zmt"][VarSet,red(i),154][VarSet,green(i),055][VarSet,blue(i),057][VarInc,i]
[VarSet,matData(i),"ML089.dat"][VarSet,matImage(i),"ML089.psd"][VarSet,matFile(i),"ML089.zmt"][VarSet,red(i),225][VarSet,green(i),170][VarSet,blue(i),005][VarInc,i]
[VarSet,matData(i),"ML090.dat"][VarSet,matImage(i),"ML090.psd"][VarSet,matFile(i),"ML090.zmt"][VarSet,red(i),118][VarSet,green(i),121][VarSet,blue(i),229][VarInc,i]
[VarSet,matData(i),"ML091.dat"][VarSet,matImage(i),"ML091.psd"][VarSet,matFile(i),"ML091.zmt"][VarSet,red(i),079][VarSet,green(i),022][VarSet,blue(i),076][VarInc,i]
[VarSet,matData(i),"ML092.dat"][VarSet,matImage(i),"ML092.psd"][VarSet,matFile(i),"ML092.zmt"][VarSet,red(i),180][VarSet,green(i),180][VarSet,blue(i),180][VarInc,i]
[VarSet,matData(i),"ML093.dat"][VarSet,matImage(i),"ML093.psd"][VarSet,matFile(i),"ML093.zmt"][VarSet,red(i),097][VarSet,green(i),019][VarSet,blue(i),004][VarInc,i]
[VarSet,matData(i),"ML094.dat"][VarSet,matImage(i),"ML094.psd"][VarSet,matFile(i),"ML094.zmt"][VarSet,red(i),076][VarSet,green(i),021][VarSet,blue(i),136][VarInc,i]
[VarSet,matData(i),"ML095.dat"][VarSet,matImage(i),"ML095.psd"][VarSet,matFile(i),"ML095.zmt"][VarSet,red(i),143][VarSet,green(i),177][VarSet,blue(i),188][VarInc,i]
[VarSet,matData(i),"ML096.dat"][VarSet,matImage(i),"ML096.psd"][VarSet,matFile(i),"ML096.zmt"][VarSet,red(i),151][VarSet,green(i),082][VarSet,blue(i),000][VarInc,i]
[VarSet,matData(i),"ML097.dat"][VarSet,matImage(i),"ML097.psd"][VarSet,matFile(i),"ML097.zmt"][VarSet,red(i),211][VarSet,green(i),111][VarSet,blue(i),014][VarInc,i]
[VarSet,matData(i),"ML098.dat"][VarSet,matImage(i),"ML098.psd"][VarSet,matFile(i),"ML098.zmt"][VarSet,red(i),118][VarSet,green(i),028][VarSet,blue(i),028][VarInc,i]
[VarSet,matData(i),"ML099.dat"][VarSet,matImage(i),"ML099.psd"][VarSet,matFile(i),"ML099.zmt"][VarSet,red(i),163][VarSet,green(i),079][VarSet,blue(i),039][VarInc,i]
[VarSet,matData(i),"ML100.dat"][VarSet,matImage(i),"ML100.psd"][VarSet,matFile(i),"ML100.zmt"][VarSet,red(i),156][VarSet,green(i),120][VarSet,blue(i),085][VarInc,i]
 //------------------------------------------------------------------------------------------
//..................................................................End of Material List
//------------------------------------------------------------------------------------------
[VarSet,MaterialsCount,i]
[VarSet,CurrentIndex,Max(Min((MaterialsCount-itemsPerRow),ZScript:ReplayDelay),0) ]
//------------------------------------------------------------------------------------------
//..................................................................Draw Selection Buttons
//------------------------------------------------------------------------------------------
[VarSet,i,8]
[VarSet,popup,"Press to select this material."]
[PenMoveLeft][PenMove,i,4    ][IButton,matFile(CurrentIndex  ),popup,[RoutineCall,LoadMat, CurrentIndex  ],,48] 
[PenMoveLeft][PenMove,i+ThumbnailSize    ,0 ][IButton,matFile(CurrentIndex+1),popup,[RoutineCall,LoadMat, CurrentIndex+1],,48] 
[PenMoveLeft][PenMove,i+(ThumbnailSize*2),0][IButton,matFile(CurrentIndex+2),popup,[RoutineCall,LoadMat, CurrentIndex+2],,48] 
[PenMoveLeft][PenMove,i+(ThumbnailSize*3),0][IButton,matFile(CurrentIndex+3),popup,[RoutineCall,LoadMat, CurrentIndex+3],,48] 
[PenMoveLeft][PenMove,i+(ThumbnailSize*4),0][IButton,matFile(CurrentIndex+4),popup,[RoutineCall,LoadMat, CurrentIndex+4],,48]
//------------------------------------------------------------------------------------------
//..................................................................?
//------------------------------------------------------------------------------------------
[PenMoveLeft][PenMove,520,3]
[IButton,"?","MaterialList Help",[RoutineCall,ShowAndTell]]
//------------------------------------------------------------------------------------------
//..................................................................Draw Materials Icons
//------------------------------------------------------------------------------------------
[VarSet,i,-8]
[PenMoveLeft][PenMove,i,14   ][Image,matImage(CurrentIndex  ),1] 
[PenMoveLeft][PenMove,i+ThumbnailSize,0 ][Image,matImage(CurrentIndex+1),1] 
[PenMoveLeft][PenMove,i+(ThumbnailSize*2),0][Image,matImage(CurrentIndex+2),1] 
[PenMoveLeft][PenMove,i+(ThumbnailSize*3),0][Image,matImage(CurrentIndex+3),1] 
[PenMoveLeft][PenMove,i+(ThumbnailSize*4),0][Image,matImage(CurrentIndex+4),1]
//------------------------------------------------------------------------------------------
//..................................................................SAVE
//------------------------------------------------------------------------------------------
[PenMoveLeft][PenMove,402,40]
[IButton,"SAVE","Click to add the currently selected material to this list.",
	[VarSet,result,0]
	[RoutineCall,LocateEntry,6,
	"\Cffa000SAVE MATERIAL?\Cffffff\nClick to choose target or click outside of these buttons to cancel this operation.",
	"\Cffa000Overwrite this material?\n\n\CffffffClick this button to overwrite.\nClick outside of this button to cancel.",
	result]
	[If,result>=0,
		[RoutineCall,CreateMaterialThumbnail,result]
		[RoutineCall,SaveMaterialData,result,1]
		[RoutineCall,Refresh,CurrentIndex]
 	]
,,68]
//------------------------------------------------------------------------------------------
//..................................................................DELETE
//------------------------------------------------------------------------------------------
[PenMoveLeft][PenMove,471]
[IButton,"DELETE","Click to select and delete a material from this list.",
	[VarSet,result,0]
	[RoutineCall,LocateEntry,7,
	"\Cffa000DELETE MATERIAL?\Cffffff\nChoose material to DELETE or click outside of these buttons to cancel this operation.",
	"\Cffa000Delete this material?\n\n\CffffffClick this button to delete.\nClick outside of this button to cancel.",
	result]
	[If,result>=0,
		[RoutineCall,DeleteMaterials,result,1]
		[RoutineCall,Refresh,CurrentIndex]
 	]
,,68]
//------------------------------------------------------------------------------------------
//..................................................................CATALOG
//------------------------------------------------------------------------------------------
[PenMoveLeft][PenMove,402,20]
[IButton,"CATALOG","Creates a thumbnail page of all materials available within this MaterialList library.",
	[If,[IGetStatus,Tool:SaveAs]==0,[Note,"This function requires the document to be resized and therefore it can't be used in this ZBrush Demo version.",0][Exit]]
	[if,[IReset],
		[VarSet,iconsPerRow,Int(sqrt(MaterialsCount)+.9999)]
		[VarSet,iconsPerClmn,Int((MaterialsCount+(iconsPerRow-1))/iconsPerRow)]
  		[IUnpress,Document:Modifiers:Pro]
		[ISet,Document:Modifiers:Width,iconsPerRow*ThumbnailSize]
		[ISet,Document:Modifiers:Height,iconsPerClmn*ThumbnailSize]
		[IPress,Document:Modifiers:Resize]
 		[VarSet,i,0]
		[VarSet,v,ThumbnailSize*.5]
		[IPress,Tool:Plane3D][IPress,Draw:MRGB][IPRess,Draw:ZADD][IPress,Texture:Txtr00]
		[ISet,Zoom:Zoom,.5]
		[ISet,Material:ItemInfo,0]
 		[Loop,iconsPerClmn,
			[VarSet,h,ThumbnailSize*.5 ]
			[Loop,iconsPerRow,
				[If,i>=MaterialsCount,[LoopExit]]
				[RoutineCall,GetMaterialData,i]
				[if,matDataIsActive,
					[FileNameSetNext,matImage(i)]
					[IPress,Texture:Inventory:Import]
					[CanvasClick,-2000,-2000,-1998,-1998]
					[TransformSet,h,v,-15500,ThumbnailSize*.5   ,ThumbnailSize*.5   ,ThumbnailSize*.5  ,0,0,0]
 					[IPress,Texture:Inventory:Remove]
				]
   				[VarAdd,h,ThumbnailSize]
				[IPress,Layer:Modifiers:Bake]
				[VarInc,i]
 			]
			[VarAdd,v,ThumbnailSize]
		]
		[ISet,Zoom:Zoom,1]
  		[Note,"You may now export this image by clicking here.",Document:Export]
	]
,,137-18]
//------------------------------------------------------------------------------------------
//..................................................................X
//------------------------------------------------------------------------------------------
[IButton,"X","Click to DELETE ALL MATERIALS from this list. You will be asked to confirm this action.",
 
  	[IPress,Preferences:utilities:viewwindowid]
	[VarSet,winId,Preferences:utilities:viewwindowid]
 	[Note,"\Cffa000DELETE ALL MATERIALS?\Cffffff\nClick this button to DELETE ALL MATERIALS\nor click outside of this button to cancel operation.",[Val,winId-4],,128*65536,1,500]
	[IPress,Preferences:utilities:viewwindowid]
	[if,(Preferences:utilities:viewwindowid)==(winId-4),
		[RoutineCall,DeleteMaterials,0,100]	
		[Note,"Operation Completed."]
		[RoutineCall,Refresh,CurrentIndex]
		,//else
		[Note,Canceled,0]
 	] 
]
//------------------------------------------------------------------------------------------
//..................................................................First
//------------------------------------------------------------------------------------------
[PenMoveLeft][PenMove,-10,29+16-20-4]
[SectionBegin, "       ",,"First",[RoutineCall,Refresh,0],,CurrentIndex==0][SectionEnd]
//------------------------------------------------------------------------------------------
//..................................................................F.Backward
//------------------------------------------------------------------------------------------
[PenMoveLeft][PenMove,56,0]
[SectionBegin, "       ",,"F.Backward",[RoutineCall,Refresh,Max(CurrentIndex-itemsPerRow,0)],,CurrentIndex==0][SectionEnd]
//------------------------------------------------------------------------------------------
//..................................................................Backward
//------------------------------------------------------------------------------------------
[PenMoveLeft][PenMove,122 ,0]
[SectionBegin, "       ",,"Backward",[RoutineCall,Refresh,Max(CurrentIndex-1,0)],,CurrentIndex==0][SectionEnd]
//------------------------------------------------------------------------------------------
//..................................................................Forward
//------------------------------------------------------------------------------------------
[PenMoveLeft][PenMove,188 ,0]
[SectionBegin, "       ",,"Forward",[RoutineCall,Refresh,Min(CurrentIndex+1,MaterialsCount-itemsPerRow)],,CurrentIndex>=(MaterialsCount-itemsPerRow)][SectionEnd]
//------------------------------------------------------------------------------------------
//..................................................................F.Forward
//------------------------------------------------------------------------------------------
[PenMoveLeft][PenMove,254 ,0]
[SectionBegin, "       ",,"F.Forward",[RoutineCall,Refresh,Min(CurrentIndex+itemsPerRow,MaterialsCount-itemsPerRow)],,CurrentIndex>=(MaterialsCount-itemsPerRow)][SectionEnd]
//------------------------------------------------------------------------------------------
//..................................................................Last
//------------------------------------------------------------------------------------------
[PenMoveLeft][PenMove,320 ,0]
[SectionBegin, "        ",,"Last",[RoutineCall,Refresh,MaterialsCount-itemsPerRow],,CurrentIndex>=(MaterialsCount-itemsPerRow)][SectionEnd]
//------------------------------------------------------------------------------------------
//..................................................................Title
//------------------------------------------------------------------------------------------
[PenMoveLeft][PenMove,402,-78]
[PenSetColor,60,60,60]
[PaintTextRect,135,22,ListTitle]
//------------------------------------------------------------------------------------------
//..................................................................CreateMaterialThumbnail
//------------------------------------------------------------------------------------------
[RoutineDef,CreateMaterialThumbnail,
	[IUnpress,Transform:EditObject][IPress,Transform:DrawPointer]
	[VarSet,storeDocUndo,Preferences:DocUndo]
	[IPress,Tool:ItemInfo][VarSet,storeToolIndex,Tool:ItemInfo]
	[IPress,Alpha:ItemInfo][VarSet,storeAlphaIndex,Alpha:ItemInfo]
	[IPress,Material:ItemInfo][VarSet,storeMaterialIndex,Material:ItemInfo]
	[IPress,Texture:ItemInfo][VarSet,storeTxtureIndex,Texture:ItemInfo]
	[IPress,Tool:SimpleBrush]
	[If,Preferences:DocUndo<5,[Iset,Preferences:DocUndo,5]]
	[IPress,Color:R][IPress,Color:G][IPress,Color:B]
	[VarSet,matDataRed,Color:R]
	[VarSet,matDataGreen,Color:G]
	[VarSet,matDataBlue,Color:B]
	[IPress,Tool:Plane3D]
	[ISet,Color:R,matDataRed*.25][ISet,Color:G,matDataGreen*.25][ISet,Color:B,matDataBlue*.25]
	[IPress,Draw:MRGB][IPRess,Draw:ZADD][IPress,Texture:Txtr00]
	[ISet,Color:R,0][ISet,Color:G,0][ISet,Color:B,0]
	[ISet,Texture:Inventory:Width,8][ISet,Texture:Inventory:Height,8]
	[IPress,Texture:Inventory:New]
 	[ISet,Material:ItemInfo,0]
 	[CanvasClick,-2000,-2000,-1950,-1950]
  	[TransformSet,ThumbnailSize,ThumbnailSize,-15000,ThumbnailSize ,ThumbnailSize  ,ThumbnailSize ,0,0,0]
	[IPress,Texture:Inventory:Remove]
 	[IPress,Tool:Sphere3D]
	[ISet,Color:R,matDataRed][ISet,Color:G,matDataGreen][ISet,Color:B,matDataBlue]
 	[IPress,Draw:MRGB][IPRess,Draw:ZADD][IPress,Texture:Txtr00]
	[ISet,Material:ItemInfo,storeMaterialIndex]
	[CanvasClick,-2000,-2000,-1950,-1950]
	[TransformSet,ThumbnailSize,ThumbnailSize,-15500,ThumbnailSize-8  ,ThumbnailSize-8  ,ThumbnailSize-8 ,0,0,0]
	[If,[IExists,Tool:MRGBZGrabberCopy1],[IPress,Tool:MRGBZGrabberCopy1],[IPress,Tool:MRGBZGrabber]]
  	[IPress,Draw:RGB][IPRess,Draw:ZADD][IUnpress,Tool:Modifiers:AutoCrop][IPress,Tool:Modifiers:ShadedRGB]
	[CanvasClick,0,0, (ThumbnailSize*2), (ThumbnailSize*2)  ]
	[IPress,Document:Undo][IPress,Document:Undo]
	[ISet,Texture:Inventory:Width,ThumbnailSize]
	[ISet,Texture:Inventory:Height,ThumbnailSize]
	[IPress,Texture:Inventory:Clone]
	[FileNameSetNext,matImage(selectedIndex)]
	[IPress,texture:export]
	[IPress,Texture:Inventory:Remove]
	[ISet,Texture:ItemInfo,10000]
	[IPress,Texture:Inventory:Remove]
	[ISet,Preferences:DocUndo,storeDocUndo]
 	[ISet,Tool:ItemInfo,storeToolIndex]
	[ISet,Alpha:ItemInfo,storeAlphaIndex]
	[ISet,Texture:ItemInfo,storeTxtureIndex]
	[FileNameSetNext,matFile(selectedIndex)]
	[IPress,Material:Save]
,selectedIndex]
//------------------------------------------------------------------------------------------
//..................................................................SaveMaterialData
//------------------------------------------------------------------------------------------
[RoutineDef,SaveMaterialData,
	[IPress,Color:R][IPress,Color:G][IPress,Color:B]
	[CanvasClick,Color:R+10000,Color:G+10000,Color:B+10000,isActive]
 	[FileNameSetNext,matData(selectedIndex)]
 	[IPress,Stroke:ExportLast]
,selectedIndex,isActive]
//------------------------------------------------------------------------------------------
//..................................................................GetMaterialData
//------------------------------------------------------------------------------------------
[RoutineDef,GetMaterialData,
	[VarSet,strokeData,[StrokeLoad,ML000.dat]] 
	[IKeyPress,13,[VarSet,strokeData,[StrokeLoad,matData(selectedIndex)]]]
	[VarSet,matDataRed  ,[StrokeGetInfo,strokeData,1,0]-10000]
	[VarSet,matDataGreen,[StrokeGetInfo,strokeData,2,0]-10000]
	[VarSet,matDataBlue ,[StrokeGetInfo,strokeData,1,1]-10000]
	[VarSet,matDataIsActive,[StrokeGetInfo,strokeData,2,1]]
,selectedIndex]
//------------------------------------------------------------------------------------------
//..................................................................LoadMat
//------------------------------------------------------------------------------------------
[RoutineDef,LoadMat,
	[RoutineCall,GetMaterialData,selectedIndex]
	[if,matDataIsActive,
		[If,(Color:R!=matDataRed)||(Color:G!=matDataGreen)||(Color:B!=matDataBlue),
			[if,matDataRed>0,[IColorSet,0,matDataGreen,matDataBlue],[IColorSet,1,matDataGreen,matDataBlue]]
			[ISet,Color:R,matDataRed]
		]
		[FileNameSetNext,matFile(selectedIndex)]
		[IPress,Material:Load]
	]
,selectedIndex]
//------------------------------------------------------------------------------------------
//..................................................................Refresh
//------------------------------------------------------------------------------------------
[RoutineDef,Refresh,
	[ISet,ZScript:ReplayDelay,newIndex]
	[FileNameSetNext,MaterialList.txt]
	[IPress,ZScript:Load]
,newIndex]
//------------------------------------------------------------------------------------------
//..................................................................DeleteMaterials
//------------------------------------------------------------------------------------------
[RoutineDef,DeleteMaterials,
	[IPress,Texture:ItemInfo][VarSet,storeTextureIndex,Texture:ItemInfo]
  	[IPress,Material:ItemInfo][VarSet,storeMaterialIndex,Material:ItemInfo]
	[FileNameSetNext,ML000.psd]
	[IPress,Texture:Inventory:Import]
 	[ISet,Material:ItemInfo,0]
	[VarSet,i,startIndex]
 	[CanvasClick,10000,10000,10000,0]
	[Loop,count,
		[Note,[Var,i],,.05]
		[FileNameSetNext,matFile(i)]
		[IPress,Material:Save]
   		[FileNameSetNext,matData(i)]
		[IPress,Stroke:ExportLast]
  		[FileNameSetNext,matImage(i)]
		[IPress,Texture:Inventory:Export]
		[VarInc,i]
	]
 	[ISet,Texture:ItemInfo,10000]
	[IPress,Texture:Inventory:Remove]
	[ISet,Material:ItemInfo,storeMaterialIndex]
 	[ISet,Texture:ItemInfo,storeTextureIndex]
,startIndex,count]
//------------------------------------------------------------------------------------------
//..................................................................LocateEntry
//------------------------------------------------------------------------------------------
[RoutineDef,LocateEntry,
	[VarSet,result,-1]
 	[IPress,Preferences:utilities:viewwindowid]
	[VarSet,winId,Preferences:utilities:viewwindowid]
	[VarSub,winId,winIDOffset]
	[Note,,winId,-1][Note,,[Val,winId+1],-1][Note,,[Val,winId+2],-1][Note,,[Val,winId+3],-1][Note,,[Val,winId+4],-1]
	[Note,[Var,actionText1] ]
 	[IPress,Preferences:utilities:viewwindowid]
	[VarSet,index,Preferences:utilities:viewwindowid-winId ]
	[If,(index>=0)&&(index<itemsPerRow),
 		[RoutineCall,GetMaterialData,(index+CurrentIndex)]
		[If,matDataIsActive,
			[Note,[Var,actionText2],[Val,winId+index]]
			[IPress,Preferences:utilities:viewwindowid]
			[if,(Preferences:utilities:viewwindowid)==(winId+index),
 				[VarSet,result,CurrentIndex+index]
				,//else
				[Note,Canceled,0]
 			]
 			,//else
 			[VarSet,result,CurrentIndex+index]
  		]
		,//else
		[Note,Canceled,0]
 	]
 ,winIDOffset,actionText1,actionText2,result]
//------------------------------------------------------------------------------------------
//..................................................................ShowAndTell
//------------------------------------------------------------------------------------------
[RoutineDef,ShowAndTell,
[IPress,10245]
[Note,"\Cffa000Material\CffffffList\n\n",,-1]
[Note,ListTitle,,-1][Note,"\n",,-1]
[Note,AutorAddress,,,,,270]
[Note,"To use any of the materials supplied with this \Cffa000Material\CffffffList\Cc0c0c0 you need to..."]
[Note,"...select an existing material...",10245]
[Note,,"ZScript:First",-1][Note,,"ZScript:F.Backward",-1][Note,,"ZScript:Backward",-1]
[Note,,"ZScript:Last",-1][Note,,"ZScript:F.Forward",-1][Note,,"ZScript:Forward",-1]
[Note,"...locate new material by using these controls...",,,,,500]
[Note,,-1,-1][Note,,-2,-1][Note,,-3,-1][Note,,-4,-1][Note,,-5,-1]
[Note,"...when material is found, click on one of these button...",,,,,550]
[Note,"...and the newly selected material will replace the existing material.",10245]
[Note,,-1,-1][Note,,-2,-1][Note,,-3,-1][Note,,-4,-1][Note,,-5,-1]
[Note,"\Cffa000Note:\Cc0c0c0When selecting any of these materials, the drawing color will be modified to be the same colors seen in these thumbnails."]

[Note,"This button allow you to add new materials to this \Cffa000Material\CffffffList",ZScript:Save] 
[Note,"This button allow you to delete materials from this \Cffa000Material\CffffffList",ZScript:Delete] 

[Note,"This button allow you to create a thumbnail catalog of all materials available within this \Cffa000Material\CffffffList.",ZScript:Catalog]
[Note,"This button allow you to DELETE ALL MATERIALS within this \Cffa000Material\CffffffList.",ZScript:X]
[Note, "More information is available at \n      \Cffa000www.ZBrushCentral.com\Cc0c0c0",,-1]
[Note, "\n\n \Cffa000         T H E   E N D",,,,,300]
]
