Notifications
Clear all

[Closed] Function and output string or get info from the rollout

Hi,

Im struggling a bit with a script, the whole code worked fine yesterday but today its giving error when trying to access the rollout through a function. If we take this snippet of code for example I want to take the count of the missing names array and output it as string in the label in the rollout.
– MAXScript Rollout Handler Exception:
– Unknown property: “lbl_missing” in undefined

I dont know why but it works when I use createdialogue but when using rollouts its working from time to time.

   (
	try(closerolloutfloater ::TextureRenamer)catch()	
	TextureRenamer = newrolloutfloater "Asset" 200 200 

	fn searchMissingAssets = (
	n_assets = AssetManager.GetNumAssets()
	assets = #()
	missingNames = #()
	missingNamescount = "0"
	for i = 1 to n_assets do (
		
		asset = AssetManager.GetAssetByIndex i
		asset_name = asset.GetFileName()
		state = (atsops.GetFileSystemStatus asset_name) as string
		
		if (state == "#(#missing)") then (
			append assets asset
			local AType = asset.getType() 
			local AFile = asset.getfilename() 
			format "Type:% File:%\n" AType AFile 
			
			local lFile = filenameFromPath AFile
			append missingNames lFile
		)
	)
	cmdModel.lbl_missing.text = missingNames.count as string
	)

	rollout cmdModel "Diagnostics"(
	label lbl_missing "0" 
	
	on cmdModel open do
    (
	searchMissingAssets()
	)
	)
	
	addrollout cmdModel TextureRenamer

)
1 Reply

cmdModel not define
global it