Saving and Loading Assets
There are two methods of saving the asset data to a Max scene file:
- Using parameter blocks.
- Using the
AssetUser
object.
In both cases when saving a 3ds Max scene, the asset is saved by the asset manager to a separate stream in the 3ds Max file. This provides the capability for external programs to access the asset data in order to identify the assets used by the scene, and potentially modify the asset data.
Using Parameter Blocks
If an asset location is stored as a parameter block item of type TYPE_FILENAME
that is tagged with p_assetTypeID
then the asset is persisted by the parameter block automatically, and plug-ins don't need to do anything special in their save and load methods.
Using the AssetUser Object Directly
If the AssetUser
information is not stored in parameter block (not the preferred method) the plug-in will need to ask the AssetUser
object to persist itself to the 3ds Max file. It is important that plug-ins continue to support loading previous versions of their data. Thus, they should continue reading from the 3ds Max scene file the file names that represent assets and convert them into AssetUser
instances via one of the IAssetManager::GetAsset()
methods. Plug-ins should not save the file asset name, but instead save the AssetUser
object into the 3ds Max file by calling the AssetUser::Save()
method.