IObject:AssetUser

An instance of this class contains information on the asset filename, its type, and the 3ds Max scene file that depends on it (this is used for resolving external references). Access to, and life time management of assets is handled by the Asset Manager.

In releases prior to 3ds Max 2010, a plug-in that referenced an external file (an asset) would hold the asset’s filename as a string or as a Path object, and would store the filename to the 3ds Max scene file as a string or an IParameterBlock2 TYPE_FILENAME parameter. To allow 3ds Max to identify the assets used by a plug-in, the plug-in would implement an IAssetAccessor-derived class. The information provided from this class was primarily used by the Asset Tracker.

Loading and saving the Asset to the 3ds Max scene file is now done through the AssetUser and the AssetManager.

Constructors:

Instances of the AssetUser class are returned by methods exposed by the AssetManager interface:

AUIO = AssetManager.GetAssetByIndex1
--> <IObject:AssetUser>
AUIO2= AssetManager.GetAsset "Simple_Stone_Mtl_Marble_bump.jpg" #bitmap
--> <IObject:AssetUser>

MAXScript Filename strings can be automatically coerced to AssetUser instances:

--Create a new bitmap texture map with a valid file name:
bmt = bitmaptexture filename:"Simple_Stone_Mtl_Marble_bump.jpg"
--> Bitmaptexture:Bitmap
bmt.filename --get the bitmap's file name
--> "Simple_Stone_Mtl_Marble_bump.jpg"
AUIO3 = bmt.filename as AssetUser --get the file name as AssetUser IObject
--> <IObject:AssetUser>
AUIO3.getFileName()
-->"Simple_Stone_Mtl_Marble_bump.jpg"
AUIO3.getType()
--> #Bitmap

IObject:AssetUser Interfaces

Interface: AssetUser 

Methods:

<string><AssetUser>.GetAssetId()   

Returns the AssetID of the Asset.

<enum><AssetUser>.GetType() 

GetType enums: {#Other|#Bitmap|#XRef|#Photometric|#Animation|#VideoPost|#BatchRender|#ExternalLink|#RenderOutput|#PreRenderScript|#PostRenderScript|#Script|#Sound|#Container} 

Returns the Type of the Asset.

<string><AssetUser>.GetFileName() 

Returns the File Name of the Asset.

<boolean><AssetUser>.CanGetFullFilePath <&string>fileName 

fileName is Out parameter         

Returns true if the full file path can be acquired using the .GetFullFilePath() method.

<string><AssetUser>.GetFullFilePath() 

Returns the full file path of the Asset.

<void><AssetUser>.Reset() 

Removes the underlying reference to the asset, allowing it to be garbage-collected if it is no longer referenced by anything else. It is recommended to call this method on an AssetUser when you are done with it. Available in 3ds Max 2018 and higher.

EXAMPLE:

AUIO = AssetManager.GetAssetByIndex 2 --get the AsserUser with index 2
--> <IObject:AssetUser>
AUIO.GetFileName() --get the file name - it is not full file name
--> "Simple_Stone_Mtl_Marble_bump.jpg"
AUIO.CanGetFullFilePath (AUIO.GetFileName()) --can we get the full name?
--> true
AUIO.GetFullFilePath() --then let's get it!
--> "C:\Program Files\Autodesk\3ds Max 2010\Maps\adskMtl\Simple_Stone_Mtl_Marble_bump.jpg"