AssetUser Class Reference

#include <AssetUser.h>

Inheritance diagram for AssetUser:
Inheritance graph
[legend]

List of all members.

Public Types

enum   { asset_type }
enum   {
  kGetAssetId, kGetFileName, kGetType, kCanGetFullFilePath,
  kGetFullFilePath
}

Public Member Functions

CoreExport  AssetUser ()
  Create an empty AssetUser pointing to kInvalidId AssetId.
CoreExport  AssetUser (const AssetId &assetId)
  Create an AssetUser pointing to assetId.
CoreExport  AssetUser (const AssetUser &assetU)
  Create an AssetUser pointing to the same asset as assetU.
CoreExport AssetUser operator= (const AssetUser &assetU)
  This function will remove the reference to the Asset on which this asset User points and add a reference to the asset corresponding to the AssetUser passed.
CoreExport const AssetId GetId () const
  Gets the AssetId of the asset to which this AssetUser points.
CoreExport MSTR  GetIdAsString () const
  Gets the AssetId of the asset to which this AssetUser points.
CoreExport AssetType  GetType () const
  Gets the type of the asset to which this AssetUser points.
CoreExport const MSTR GetFileName () const
  Gets the current file name of the asset to which this AssetUser points.
CoreExport MSTR  GetFullFilePath () const
  gets an absolute UNC path of the asset file
CoreExport bool  GetFullFilePath (MaxSDK::Util::Path &filePath) const
  resolves the physical location of the asset to which this AssetUser points.
CoreExport bool  GetFullFilePath (MSTR &filePath) const
  resolves the physical location of the asset to which this AssetUser points.
CoreExport void  SetUsedInFileSave ()
  Flags the asset as having been saved to a max scene file.
CoreExport void  Reset ()
  Resets the current asset id.
CoreExport IOResult  Save (ISave *isave) const
  Called for saving data.
CoreExport  ~AssetUser ()
BaseInterface GetInterface (Interface_ID id)
BaseInterface GetInterfaceAt (int i) const
MCHAR *  GetIObjectName ()
int  NumInterfaces () const
void  AcquireIObject ()
void  ReleaseIObject ()
void  DeleteIObject ()
LifetimeType  LifetimeControl ()
FPInterfaceDesc GetDescByID (Interface_ID id)
Interface_ID  GetID ()
FPInterfaceDesc GetDesc ()
BEGIN_FUNCTION_MAP  FN_0 (kGetAssetId, TYPE_TSTR_BV, GetIdAsString)
  FN_0 (kGetFileName, TYPE_TSTR_BV, GetFileName)
  FN_0 (kGetType, TYPE_ENUM, GetType)
  FN_1 (kCanGetFullFilePath, TYPE_bool, GetFullFilePath, TYPE_TSTR_BR)
  FN_0 (kGetFullFilePath, TYPE_TSTR_BV, GetFullFilePath)

Static Public Member Functions

static CoreExport UINT64  GetNumCreated ()
  Gets the total number of AssetUsers created during this 3dsmax session.
static CoreExport UINT64  GetNumAlive ()
  Gets the current number of AssetUser instances.

Protected Member Functions

CoreExport const MSTR GetResolvedAssetPath () const
  Gets the absolute path to the most recently resolved location of the asset that this AssetUser points to.
CoreExport bool  SetResolvedAssetPath (const MSTR &resolvedPath)
  Sets the absolute path to the most recently resolved location of the asset that this AssetUser points to.
CoreExport DWORD  GetTimePathWasResolved () const
CoreExport void  SetTimePathWasResolved (DWORD newTime)

Friends

class  ::FileResolutionMgrImp

Member Enumeration Documentation

anonymous enum

Constructor & Destructor Documentation

CoreExport AssetUser ( )

Create an empty AssetUser pointing to kInvalidId AssetId.

CoreExport AssetUser ( const AssetId assetId )

Create an AssetUser pointing to assetId.

The constructor will automatically add a reference to the asset.

Parameters:
assetId on which the AssetUser will point.
CoreExport AssetUser ( const AssetUser assetU )

Create an AssetUser pointing to the same asset as assetU.

Parameters:
AssetUser we want to copy.
CoreExport ~AssetUser ( )

Member Function Documentation

CoreExport AssetUser& operator= ( const AssetUser assetU )

This function will remove the reference to the Asset on which this asset User points and add a reference to the asset corresponding to the AssetUser passed.

CoreExport const AssetId& GetId ( ) const

Gets the AssetId of the asset to which this AssetUser points.

Returns:
The GUID identifying the asset.
CoreExport MSTR GetIdAsString ( ) const

Gets the AssetId of the asset to which this AssetUser points.

Returns:
A string representation of the GUID identifying the asset.
CoreExport AssetType GetType ( ) const

Gets the type of the asset to which this AssetUser points.

Returns:
The type of the asset.
CoreExport const MSTR& GetFileName ( ) const

Gets the current file name of the asset to which this AssetUser points.

Returns:
The current file name of this asset.
CoreExport MSTR GetFullFilePath ( ) const

gets an absolute UNC path of the asset file

Returns:
a MSTR with an absolute path to where the asset is located if successful; otherwise returns an empty MSTR if it fails to find the asset file
CoreExport bool GetFullFilePath ( MaxSDK::Util::Path filePath ) const

resolves the physical location of the asset to which this AssetUser points.

gets an absolute UNC path of an asset file

Parameters:
[out] filePath : is set to an absolute UNC path if the asset file is found. If the asset file is not found it is left unchanged.
Returns:
true if the asset file is located successful; otherwise returns false
CoreExport bool GetFullFilePath ( MSTR filePath ) const

resolves the physical location of the asset to which this AssetUser points.

gets an absolute UNC path of an asset file

Parameters:
[out] filePath : is set to an absolute UNC path if the asset file is found. If the asset file is not found it is left unchanged.
Returns:
true if the asset file is located successful; otherwise returns false
CoreExport void SetUsedInFileSave ( )

Flags the asset as having been saved to a max scene file.

This method is called if the AsssetId of the asset is stored to the max scene file (typically as a string) rather than the Save method being called on this AssetUser. This tells the Asset Manager that the metadata for the asset must be saved to the scene file (asset metadata is saved only for those assets actually written to the scene file. Note: If you save the AssetId instead of the AssetUser, on scene load you must pass the AssetId read through IAssetManager::RemapLoadedAssetID before getting an AssetUser using the AssetId

CoreExport void Reset ( )

Resets the current asset id.

Remove the reference to the asset held by this AssetUser and sets the internal value to kInvalidId.

CoreExport IOResult Save ( ISave isave ) const

Called for saving data.

Called to allow the asset to save its data.

Parameters:
isave - The ISave interface.
Returns:
One of the following values: IO_OK, IO_ERROR.
static CoreExport UINT64 GetNumCreated ( ) [static]

Gets the total number of AssetUsers created during this 3dsmax session.

Returns:
The number of AssetUsers created.
static CoreExport UINT64 GetNumAlive ( ) [static]

Gets the current number of AssetUser instances.

Returns:
The current number of AssetUsers.
BaseInterface* GetInterface ( Interface_ID  id ) [virtual]
Remarks:
Returns a pointer to the interface whose ID is specified.
Parameters:
Interface_ID id

The ID of the interface to return.
Default Implementation:
{ return NULL; }

Reimplemented from FPMixinInterface.

BaseInterface* GetInterfaceAt ( int  i ) const [virtual]
Remarks:
This method returns a pointer to the BaseInterface of the I-th interface.
Parameters:
int i

The index of the interface in the table.
Default Implementation:
{ return interfaces[i]; }

Reimplemented from BaseInterfaceServer.

MCHAR* GetIObjectName ( ) [inline, virtual]
Remarks:
Returns the object/class name.
Default Implementation:
{ return _M(""); }

Reimplemented from IObject.

{ return _M("AssetUser");}
int NumInterfaces ( ) const [virtual]
Remarks:
This method returns the number of interfaces.
Default Implementation:
{ return interfaces.Count(); }

Reimplemented from BaseInterfaceServer.

void AcquireIObject ( ) [virtual]
Remarks:
This method is called when MAXScript makes a reference to this object. This is part of the IObject reference management and can be implemented by dynamically allocated IObjects for ref-count based lifetime control.
Default Implementation:
{ }

Reimplemented from IObject.

void ReleaseIObject ( ) [virtual]
Remarks:
This method is called when MAXScript deletes a reference to this object. This is part of the IObject reference management and can be implemented by dynamically allocated IObjects for ref-count based lifetime control.
Default Implementation:
{ }

Reimplemented from IObject.

void DeleteIObject ( ) [virtual]
Remarks:
This method is the virtual destructor for the IObject.
Default Implementation:
{ }

Reimplemented from IObject.

LifetimeType LifetimeControl ( ) [inline, virtual]
Remarks:
This method allows inquiries into the actual lifetime policy of a client and provide a server-controlled delete notify callback.
Returns:
One of the following LifetimeTypes:

noRelease

Do not call release, use interface as long as you like.

immediateRelease

The interface is only good for one calls. The release is implied so a call to release is not required.

wantsRelease

The clients are controlling the lifetime, so the interface needs a Release() when the client has finished. This is the default.

serverControlled

The server controls the lifetime and will use the InterfaceNotifyCallback to inform the code when it is gone.
Default Implementation:
{ return noRelease; }

Reimplemented from FPMixinInterface.

{ return wantsRelease; }
FPInterfaceDesc* GetDescByID ( Interface_ID  id ) [virtual]
Remarks:
This method is used to directly implement FPInterface::GetDesc() in your public virtual base mixin class, like this;

FPInterfaceDesc* GetDesc() { return GetDescByID(THIS_INTERFACE_ID); }

Then implement a GetDescByID() in the implementing class to avoid link export issues.
Parameters:
Interface_ID id

The unique interface ID by which to get the FPInterfaceDesc.
Default Implementation:
{ return &nullInterface; }

Reimplemented from FPMixinInterface.

Interface_ID GetID ( ) [inline, virtual]
Remarks:
This method overrides GetID() in those interfaces that do not publish metadata but instead have a unique Interface_ID for quick internal identification in implementation code that might be shared by a bunch of mixin interfaces.
Returns:
The Interface_ID.
Default Implementation:
{ return GetDesc()->ID; }

Reimplemented from FPMixinInterface.

{ return IID_IASSET_USER; }
FPInterfaceDesc* GetDesc ( ) [inline, virtual]
Remarks:
Returns a pointer to the class which contains the interface metadata.

Implements FPInterface.

{ return GetDescByID(IID_IASSET_USER); }
BEGIN_FUNCTION_MAP FN_0 ( kGetAssetId  ,
TYPE_TSTR_BV  ,
GetIdAsString   
)
FN_0 ( kGetFileName  ,
TYPE_TSTR_BV  ,
GetFileName   
)
FN_0 ( kGetType  ,
TYPE_ENUM  ,
GetType   
)
FN_1 ( kCanGetFullFilePath  ,
TYPE_bool  ,
GetFullFilePath  ,
TYPE_TSTR_BR   
)
FN_0 ( kGetFullFilePath  ,
TYPE_TSTR_BV  ,
GetFullFilePath   
)
CoreExport const MSTR& GetResolvedAssetPath ( ) const [protected]

Gets the absolute path to the most recently resolved location of the asset that this AssetUser points to.

This function returns an empty string if the asset's location has not yet been resolved by the file resolution manager.

Returns:
the absolute path to the most recently resolved location of the asset
CoreExport bool SetResolvedAssetPath ( const MSTR resolvedPath ) [protected]

Sets the absolute path to the most recently resolved location of the asset that this AssetUser points to.

This function only accepts an absolute path or an empty string. This function is usually invoked by the file resolution manager after it attempts to resolve an asset's location. If the file resolution manager fails to resolve the physical location of an asset file, 'resolvedPath' is an empty string (i.e. resolvedPath equals "")

param[in] resolvedPath the most recent resolved path of the asset file

Returns:
true if the new resolved path is set to parameter resolvedPath
CoreExport DWORD GetTimePathWasResolved ( ) const [protected]
CoreExport void SetTimePathWasResolved ( DWORD  newTime ) [protected]

Friends And Related Function Documentation

friend class ::FileResolutionMgrImp [friend]

AssetUser AssetUser AssetUser AssetUser AssetUser AssetUser AssetUser AssetUser AssetUser AssetUser
AssetUser AssetUser AssetUser AssetUser AssetUser AssetUser AssetUser AssetUser AssetUser AssetUser