--Missing-Bitmap delete 1.0 final
--date:9/18/2005
--Written By Zhang Yang
--notes:a auto pre-process of render to delete any missing file.


--Init Var
--shareMapLib=#()
--sharedMapCount=0

--debug=createFile "c:/temp/debug.log"

--main function
fn changeMaps item = (		
	if classof(item)==bitmaptexture then
		(	
		local fileStr=item.filename
		--format "change this:% on this:%\n"  fileStr item.value to:debug
		if (getfiles fileStr).count==0 do 
			(sharedMapCount+=1
			item=notexture()
			)
		)
	else 
		(
		--get all the properties in the material or texturemap
		subNum=item.numsubs
		--format "\ntotal % subAnim Track\n" SubNum to:debug
		if subNum>=1 do for i=1 to subNum do ChangeMaps item[i] 
		)
	)
	
for proMat in currentMaterialLibrary do
	(
		changeMaps proMat
		
	)
--format "Finish!Total:% missing bitmaps have been deleted." sharedMapCount to:debug
--flush debug
gc()

