Explain following MaxScript:
macroscript AssetValidatorAndBundler category:"All3D" tooltip:"All3D Asset Validator & Bundler" buttonText:"AssetValidator"
(
	setVRaySilentMode();

	local isValid = true;
	local _assetID = "";
	local _placementType = "";
	local _purpose = "";
	local _materialType = "";
	local needHigh = false;
	local needHighPBR = false;
	local needLow = false;
	local hpMaxFilename = "";
	local lpMaxFilename = "";
	local hpPBRMaxFilename = "";
	local vrayTexDir = "";
	local pbrTexDir = "";
	local highPbrTexDir = "";
	local outputDir = "";
	local bundleType = "";
	local jsonDll = @"C:\All3D\Newtonsoft.Json.dll";
-- 	local assetValidataionModule = @"C:\All3D\AssetValidationModule.mse";
	local shouldAbort = false;

	fn PickOutputDir =
	(
		local dir = getSavePath caption:"Pick Output folder" initialDir:@"C:\";

		if (dir != undefined AND dir != "") then
		(
			outputDir = dir;
			return true;
		)
		else
		(
			shouldAbort = queryBox "Do you want to abort the bundling process?" title:"Abort Bundling" beep:true;

			if (shouldAbort) then
			(
				return false;
			)
			else
			(
				PickOutputDir();
			)
		)
	)

	fn PickMaxFile =
	(
		fileType = undefined;

		case bundleType of
		(
			"High": ( fileType = "High")
			"HighPBR": ( fileType = "High")
			"Low": 	( fileType = "Low")
			Default: ( fileType = "High")
		)

		local filename = getOpenFileName caption:("Pick " + fileType + " Poly Max File") types:"Max(*.max)|*.max|";

		if (filename != undefined AND filename != "") then
		(
			case bundleType of
			(
				"High": ( hpMaxFilename = filename; )
				"Low": ( lpMaxFilename = filename; )
				"HighPBR": (hpPBRMaxFilename = filename)
			)

			return true;
		)
		else
		(
			shouldAbort = queryBox "Do you want to abort the bundling process?" title:"Abort Bundling" beep:true;

			if (shouldAbort) then
			(
				return false;
			)
			else
			(
				PickMaxFile();
			)
		)
	)

	fn PickTexDir =
	(
		local customCaption = "";
		local initDir = "";

		case bundleType of
		(
			"High":
			(
				customCaption = "Pick Vray Textures folder";
				initDir = getFilenamePath hpMaxFilename;
			)
			"Low":
			(
				customCaption = "Pick PBR Textures folder for Low Poly Mesh";
				initDir = getFilenamePath lpMaxFilename;
			)
			"HighPBR":
			(
				customCaption = "Pick PBR Textures folder for High Poly Mesh";
				initDir = getFilenamePath hpPBRMaxFilename;
			)
		)

		local dir = getSavePath caption:customCaption initialDir:initDir;

		if (dir != undefined AND dir != "") then
		(
			case bundleType of
			(
				"High": ( vrayTexDir = dir; )
				"Low": ( pbrTexDir = dir; )
				"HighPBR": ( highPbrTexDir = dir; )
			)

			return true;
		)
		else
		(
			shouldAbort = queryBox "Do you want to abort the bundling process?" title:"Abort Bundling" beep:true;

			if (shouldAbort) then
			(
				return false;
			)
			else
			(
				PickTexDir();
			)
		)
	)

	fn CheckAndBundle =
	(
		if (PickMaxFile()) then
		(
			PickTexDir();
		)
	)

	fn RaiseFlags =
	(
		if (_purpose == "rendering" OR _purpose == "both") then
		(
			if (_materialType == "Vray") then
			(
				needHigh = true;
			)
			else
			(
				needHighPBR = true;
			)

			if (_purpose == "both") then
			(
				needLow = true;
			)
		)

		else if (_purpose == "realtime") then
		(
			needLow = true;
		)
	)

	fn StartWizard assetID =
	(
		if (needHigh) then
		(
			bundleType = "High";
			CheckAndBundle();
		)

		if (shouldAbort) then ( return 0; )

		if (needHighPBR) then
		(
			bundleType = "HighPBR";
			CheckAndBundle();
		)

		if (shouldAbort) then ( return 0; )

		if (needLow) then
		(
			bundleType = "Low";
			CheckAndBundle();
		)

		if (shouldAbort) then ( return 0; )

		PickOutputDir();

		if (shouldAbort) then ( return 0; )

		::_validator_.assetID = _assetID;
		::_validator_.placementType = _placementType;
		::_validator_.hpMaxFilename = hpMaxFilename;
		::_validator_.lpMaxFilename = lpMaxFilename;
		::_validator_.hpPBRMaxFilename = hpPBRMaxFilename;
		::_validator_.vrayTexDir = (vrayTexDir + "\\");
		::_validator_.pbrTexDir = (pbrTexDir + "\\");
		::_validator_.highPbrTexDir = (highPbrTexDir + "\\");
		::_validator_.outputDir = outputDir + "\\ValidationResults\\";
		::_validator_.jsonDll = jsonDll;
		::_validator_.Init();


		if (needHigh) then
		(
			::_validator_.currBundleType = "High";
			isValid = ::_validator_.Validate();
			::_assetExporter_.g_modellingType = "high_res";
		)

		if (needHighPBR) then
		(
			::_validator_.currBundleType = "HighPBR";
			isValid = ::_validator_.Validate()
			::_assetExporter_.g_modellingType = "high_pbr";

		)

		if (needLow) then
		(
			::_validator_.currBundleType = "Low";
			isValid = ::_validator_.Validate() AND isValid
			::_assetExporter_.g_modellingType = "ar";
		)

		::_validator_.ExportReport();

		if (isValid) do 
		(
			::_assetExporter_.assetID = _assetID;
			::_assetExporter_.assetDir = (outputDir + "\\ValidationResults\\" + _assetID + "\\") ;
			::_assetExporter_.outputDir = (outputDir + "\\ExportedAssets\\");
			::_assetExporter_.useDraco = true;
			::_assetExporter_.glbExportMethod = "babylon";
		)
		return 1
	)
	
	fn ConfigureLabel lbl val font size clr =
	(
		local bkgCol = (colorman.getcolor #background * 255) as color;
		lbl.textAlign = (dotNetClass "System.Drawing.ContentAlignment").MiddleLeft;
		lbl.text = val;
		lbl.foreColor = (dotNetClass "System.Drawing.Color").fromArgb clr.r clr.g clr.b;
		lbl.backColor = (dotNetClass "System.Drawing.Color").fromArgb bkgCol.r bkgCol.g bkgCol.b;
		lbl.font = dotnetobject "System.Drawing.Font" font size;
	)

	rollout AssetValidationSummary "Asset Validation Summary" width:350
	(
		label dummyLbl_0 "";
		dotNetControl summaryLbl "Windows.Forms.Label" height:50 align:#left;
		dotNetControl validationResultLbl "Windows.Forms.Label" height:30 align:#left;
		label dummyLbl_2 "";
		label warningLbl "Please review the following details before clicking Bundle!" align:#left;
		label dummyLbl_3 "";
		dotNetControl summaryDetails "Windows.Forms.TextBox" height:150;
		label dummyLbl_4 "";
		button bundleButton "Bundle" across:2 height:30;
		button exportGLBButton "Export GLB" height:30;
		label dummyLbl_5 "";
		
		on AssetValidationSummary open do
		(
			ConfigureLabel summaryLbl "Summary " "Verdana" 26 (Color 255 255 255);
			
			if(isValid)then
			(
				validationOuput = "VALIDATION PASSED!\n"
				print(validationOuput)
				ConfigureLabel validationResultLbl "Passed!" "Verdana" 20 (Color 0 255 0);
			)
			else
			(
				validationOuput = "VALIDATION FAILED!\n"
				print(validationOuput)
				ConfigureLabel validationResultLbl "Failed!" "Verdana" 20 (Color 255 0 0);
				bundleButton.visible = false;
				exportGLBButton.visible = false;
			)
			
			summaryDetails.acceptsTab = true;
			summaryDetails.acceptsTab = true;
			summaryDetails.multiline = true;
			summaryDetails.readOnly = true;
			summaryDetails.scrollBars = (dotNetClass "Windows.Forms.ScrollBars").Both;
			local logFile = outputDir + "\\ValidationResults\\" + _assetID + "_Log.txt";
			local _data = (dotnetClass "System.IO.File").ReadAllText logFile;
			print(_data)
			summaryDetails.text = _data;
		)
		
		on exportGLBButton pressed do
		(
			exportGLBButton.enabled = false;
			bundleButton.enabled = false;
			::_assetExporter_.ExportAsset();
			messageBox "Done!" title:"Success!" beep:true; 
			bundleButton.enabled = true;
		)
		
		on bundleButton pressed do
		(
			cmd = "C:\All3D\7za.exe a -tzip \"" + outputDir + "\\ValidationResults\\" + _assetID + ".zip\" \"" + outputDir + "\\ValidationResults\\" + _assetID + "\\*\"";
			DOSCommand cmd;
			cmd = "rmdir /Q /S \"" + outputDir + "\\ValidationResults\\" + _assetID +  "\\\"";
			DOSCommand cmd;
			DestroyDialog AssetValidationSummary;
			messageBox "Done!" title:"Success!" beep:true; 

		)
	)

	rollout assetInfoDialog "All3D Asset Validator & Bundler" width:300
	(
		label dummyLbl0 "" height:20;
		label assetIDLbl "All3D Asset ID:" align:#left;
		editText assetIDVal "" height:26;
		label dummyLbl1 "" height:20;
		radioButtons placementType "Placement Type:" labels:#("Floor", "Wall", "Ceiling") columns:3 align:#left;
		label dummyLbl2 "" height:20;
		radioButtons purposeType "The asset is meant to be used for" labels:#("Photorealistic Rendering  ( High Poly )","Real-time / AR ( Low Poly )","Both") offsets:#([0,5],[0,10],[0,15]) columns:1 align:#left;
		label dummyLbl3 "" height:20;
		radioButtons materialType "Material Type:" labels:#("Vray","PBR") offsets:#([0,5],[0,10]) columns:1 align:#left;
		label dummyLbl4 "" height:20;
		button okButton "Proceed";

		on purposeType changed num do
		(
			if num == 1 then
			(
				materialType.caption = "Material Type:";
				materialType.state = 1;
				materialType.enabled = true;
			)
			else if num == 2 then
			(
				materialType.state = 2;
				materialType.caption = "Material Type:";
				materialType.enabled = false;
			)
			else
			(
				materialType.caption = "High Poly Material Type:";
				materialType.state = 1;
				materialType.enabled = true;
			)
		)

		on okButton pressed do
		(
			_assetID = assetIDVal.text;

			case placementType.state of
			(
				1: ( _placementType = "Floor"; )
				2: ( _placementType = "Wall"; )
				3: ( _placementType = "Ceiling"; )
				Default: ( _placementType = "Floor"; )
			)

			case purposeType.state of
			(
				1: ( _purpose = "rendering"; )
				2: ( _purpose = "realtime"; )
				3: ( _purpose = "both"; )
				Default: ( _purpose = "rendering"; )
			)

			case materialType.state of
			(
				1: ( _materialType = "Vray"; )
				2: ( _materialType = "PBR"; )
			)

			if (_assetID != "" AND (_assetID as Integer) != undefined) then
			(
				destroyDialog assetInfoDialog;
				RaiseFlags();
				abortProcess = StartWizard _assetID;
				if (abortProcess != 0) do 
				(
					CreateDialog AssetValidationSummary;
				)
			)
			else
			(
				_assetID = undefined;
				messageBox "Please enter a valid Asset ID" title:"Asset ID Invalid!" beep:true;
			)
		)
	)
	
	

	if (assetInfoDialog.isDisplayed) then ( destroyDialog assetInfoDialog; )
	createDialog assetInfoDialog;
)