Public Member Functions

IEnumAuxAssetsCallback Class Reference

Search for all occurrences

Detailed Description

An extension of AssetEnumCallback that exposes an interface for providing more detailed information about an asset.

An extension of AssetEnumCallback that allows an application component to declare more information about an asset, and to provide a callback method for retargeting that asset. A client wishing to expose more asset information should follow the following code example:

class PointCacheAssetAccessor : public IAssetAccessor   {
public:

    PointCacheAssetAccessor(PointCacheBase* aPointCache);

    // path accessor functions
    virtual MaxSDK::AssetManagement::AssetUser GetAsset() const ;

    virtual bool SetPath(const MaxSDK::AssetManagement::AssetUser& aNewAsset) ;

    // asset client information
    virtual int GetAssetType() const ;

protected:
    PointCacheBase* mPointCache;
};

PointCacheAssetAccessor::PointCacheAssetAccessor(PointCacheBase* aPointCache) : 
    mPointCache(aPointCache)
{

}

MaxSDK::AssetManagement::AssetUser PointCacheAssetAccessor::GetAsset() const    {
    return mPointCache->pblock->GetAssetUser(pb_cache_file);
;
}


bool PointCacheAssetAccessor::SetAsset(const MaxSDK::AssetManagement::AssetUser& aNewAsset) {
    mPointCache->pblock->SetValue(pb_cache_file, 0, aNewAsset);
}

int PointCacheAssetAccessor::GetAssetType() const   {
    return IAssetAccessor::kAnimationAsset;
}

void PointCacheBase::EnumAuxFiles(AssetEnumCallback& nameEnum, DWORD flags) 
{
    if ((flags&FILE_ENUM_CHECK_AWORK1)&&TestAFlag(A_WORK1)) return; // LAM - 4/11/03

    if(flags & FILE_ENUM_ACCESSOR_INTERFACE)    {
        PointCacheAssetAccessor accessor(this);
        if(accessor.GetAsset().GetId()!=MaxSDK::AssetManagement::kInvalidId)    {
            IEnumAuxAssetsCallback* callback = static_cast<IEnumAuxAssetsCallback*>(&nameEnum);
            callback->DeclareAsset(accessor);
        }
    }
    else    {
        // do normal enum business
    }
}

If the FILE_ENUM_ACCESSOR_INTERFACE is passed to the EnumAuxFiles, then it is safe to cast the AssetEnumCallback object to the IEnumAuxAssetsCallback interface. From there, an asset can declare it's own asset interface, as shown in the above example. This example is taken from the maxsdk\samples\modifiers\pointcache sample plugin project.

#include <IAssetAccessor.h>

Inheritance diagram for IEnumAuxAssetsCallback:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void  DeclareAsset (IAssetAccessor &anAccessor)=0
  Allows a client to implement and return an asset accessor object.
virtual void  DeclareGroup (IAssetAccessor &anAccessor)=0
  Allows a client to declare a new asset sub-group.
virtual void  EndGroup ()=0
  Used to end the declaration of a sub-group of assets.

Member Function Documentation

virtual void DeclareAsset ( IAssetAccessor anAccessor ) [pure virtual]

Allows a client to implement and return an asset accessor object.

An application component wishing to declare an asset should implement the IAssetAccessor interface and return an instance of that implementation via this method. It is important to note that a link to this interface is not kept by the IEnumAuxAssetsCallback object receiving the interface. The interface need only be valid for the length of the DeclareAsset method call. This allows a component to pass in a stack object that will be destroyed at the end of the scope containing this method call. See class description for a code sample.

Parameters:
[in] anAccessor An asset accessor object.
virtual void DeclareGroup ( IAssetAccessor anAccessor ) [pure virtual]

Allows a client to declare a new asset sub-group.

Allows a client to declare a new asset subgroup. An example of a sub-group would be an xref file that has its own assets. This method declares that we are now enumerating a sub-group of assets, meaning that declared assets will be added to this group. It is possible to nest groups further by making repeated calls to this function. To end the declaration of a group, call EndGroup().

Precondition:
The asset accessor should not return NULL for a newly declared group. It is the onus of the asset client to check that IAssetAccessor::GetPath returns a non-null value. If null is returned, neither DeclareGroup nor EndGroup should be called.
Parameters:
[in] anAccessor An asset accessor describing the asset which holds a a sub-group of assets.
virtual void EndGroup ( ) [pure virtual]

Used to end the declaration of a sub-group of assets.

Called when a client is done declaring a sub-group of assets. See DeclareGroup(IAssetAccessor&) for details.


IEnumAuxAssetsCallback IEnumAuxAssetsCallback IEnumAuxAssetsCallback IEnumAuxAssetsCallback IEnumAuxAssetsCallback IEnumAuxAssetsCallback IEnumAuxAssetsCallback IEnumAuxAssetsCallback IEnumAuxAssetsCallback IEnumAuxAssetsCallback
IEnumAuxAssetsCallback IEnumAuxAssetsCallback IEnumAuxAssetsCallback IEnumAuxAssetsCallback IEnumAuxAssetsCallback IEnumAuxAssetsCallback IEnumAuxAssetsCallback IEnumAuxAssetsCallback IEnumAuxAssetsCallback IEnumAuxAssetsCallback