AssetManagerInterface Class Reference

#include <assetmanagerinterface.h>

Detailed Description

Helper class to control the Asset Manager.

Public Types

using Filter = Delegate< Bool(const AssetDescription &desc)>
 
using AssetDragTuple = Tuple< Url, AssetDescription, String >
 
using AssetDragArray = BaseArray< AssetDragTuple >
 
using AssetDragSubtypeArray = BaseArray< Id >
 
using AssetDragArrayTuple = Tuple< AssetDragArray, AssetDragSubtypeArray >
 

Static Public Member Functions

static MAXON_METHOD void SetActiveManager (MASTERFILTER masterFilter, const GraphModelPresenterRef &presenter=GetZeroRef< GraphModelPresenterRef >(), const nodes::NodesGraphModelRef &model=GetZeroRef< nodes::NodesGraphModelRef >())
 
static MAXON_METHOD Result< BoolOpenPopup (ASSETPOPUPOPTIONS flags, MASTERFILTER masterFilter, const String &filterString, const AssetDescription &smartFilter=GetZeroRef< AssetDescription >(), const GraphModelPresenterRef &presenter=GetZeroRef< GraphModelPresenterRef >(), const nodes::NodesGraphModelRef &model=GetZeroRef< nodes::NodesGraphModelRef >(), const String &title=String(), const HashSet< Id > &inSelection=HashSet< Id >(), Delegate< void(const DragAndDropDataAssetArray &)> &&outSelection={})
 
static MAXON_METHOD Result< BoolCheckDownloadAssetWithModalProgressDialog (const AssetDescription &asset, const AssetRepositoryRef &lookupRepository)
 
static MAXON_METHOD Result< BoolCheckDownloadAssetsWithModalProgressDialog (const BaseArray< AssetDescription > &assets, const AssetRepositoryRef &lookupRepository)
 
static MAXON_METHOD Tuple< Bool, Id, Url, AssetDescription, StringGetAssetFilenameFromDragData (const void *dragData, Bool updateUsage, Bool showDownloadDialog, const Filter &filter=GetZeroRef< Filter >())
 
static MAXON_METHOD Result< AssetDragArrayTupleGetAssetFilenameFromMultiDragData (const void *dragData, Bool updateUsage, Bool showDownloadDialog, const Filter &filter=GetZeroRef< Filter >())
 
static MAXON_METHOD Result< void > RevealAsset (const Block< AssetDescription > &assets)
 
static MAXON_METHOD Result< BoolLoadAssets (const AssetRepositoryRef &searchRepository, const HashMap< Id, String > &selectionAndFilterString, const GraphModelPresenterRef &presenter=GetZeroRef< GraphModelPresenterRef >(), const nodes::NodesGraphModelRef &graphModelRef=GetZeroRef< nodes::NodesGraphModelRef >())
 
static MAXON_METHOD Result< AssetManagerSubDialogRef > GetAssetManagerSubDialogRef ()
 

Private Member Functions

 MAXON_INTERFACE_NONVIRTUAL (AssetManagerInterface, MAXON_REFERENCE_NONE, "net.maxon.mvp.assetmanager.interface")
 

Member Typedef Documentation

◆ Filter

using Filter = Delegate<Bool(const AssetDescription& desc)>

◆ AssetDragTuple

using AssetDragTuple = Tuple<Url, AssetDescription, String>

◆ AssetDragArray

◆ AssetDragSubtypeArray

◆ AssetDragArrayTuple

Member Function Documentation

◆ MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( AssetManagerInterface  ,
MAXON_REFERENCE_NONE  ,
"net.maxon.mvp.assetmanager.interface"   
)
private

◆ SetActiveManager()

static MAXON_METHOD void SetActiveManager ( MASTERFILTER  masterFilter,
const GraphModelPresenterRef &  presenter = GetZeroRef< GraphModelPresenterRef >(),
const nodes::NodesGraphModelRef &  model = GetZeroRef< nodes::NodesGraphModelRef >() 
)
static

SetActiveManager sets the active asset manager mode.

Parameters
[in]masterFiltersee MASTERFILTER.
[in]presenterOptional parameter to pass a NodeGraph presenter.
[in]modelOptional parameter to pass a NodeGraph.

◆ OpenPopup()

static MAXON_METHOD Result<Bool> OpenPopup ( ASSETPOPUPOPTIONS  flags,
MASTERFILTER  masterFilter,
const String filterString,
const AssetDescription &  smartFilter = GetZeroRef< AssetDescription >(),
const GraphModelPresenterRef &  presenter = GetZeroRef< GraphModelPresenterRef >(),
const nodes::NodesGraphModelRef &  model = GetZeroRef< nodes::NodesGraphModelRef >(),
const String title = String(),
const HashSet< Id > &  inSelection = HashSetId >(),
Delegate< void(const DragAndDropDataAssetArray &)> &&  outSelection = {} 
)
static

OpenPopup opens an asset selection popup.

Parameters
[in]flagssee ASSETPOPUPOPTIONS.
[in]masterFiltersee MASTERFILTER.
[in]filterStringsee FilterString.
[in]smartFilterSmartFilter to select.
[in]presenterOptional parameter to pass a NodeGraph presenter.
[in]modelOptional parameter to pass a NodeGraph.
[in]titleOptional Window Title.
[out]inSelectionReturns the selected elements.
[out]outSelectionDelegate.
Returns
True on success. False if the user cancelled.

◆ CheckDownloadAssetWithModalProgressDialog()

static MAXON_METHOD Result<Bool> CheckDownloadAssetWithModalProgressDialog ( const AssetDescription &  asset,
const AssetRepositoryRef &  lookupRepository 
)
static

CheckDownloadAssetWithModalProgressDialog checks if an asset is already cached and if not it will download the asset with a modal progress dialog which can be canceled. Canceling the dialog will continue the download but returns false. Dependencies will be added to the download queue as well.

Parameters
[in]assetAsset to inspect/download.
[in]lookupRepositoryRepository to check dependencies for.
Returns
True if done. False if cancelled.

◆ CheckDownloadAssetsWithModalProgressDialog()

static MAXON_METHOD Result<Bool> CheckDownloadAssetsWithModalProgressDialog ( const BaseArray< AssetDescription > &  assets,
const AssetRepositoryRef &  lookupRepository 
)
static

◆ GetAssetFilenameFromDragData()

static MAXON_METHOD Tuple<Bool, Id, Url, AssetDescription, String> GetAssetFilenameFromDragData ( const void *  dragData,
Bool  updateUsage,
Bool  showDownloadDialog,
const Filter filter = GetZeroRef< Filter >() 
)
static

GetAssetFilenameFromDragData extracts the filename/url from the legacy d&d message. If filter is null, this will only return assets of type AssetTypes::File, otherwise only assets which pass the given filter.

Parameters
[in]dragDataDragData containing the asset filename.
Returns
Bool: false if cancelled by user, Id: Asset ID, Url: asset url, AssetDescription: asset description, String: filter string from asset browser

◆ GetAssetFilenameFromMultiDragData()

static MAXON_METHOD Result<AssetDragArrayTuple> GetAssetFilenameFromMultiDragData ( const void *  dragData,
Bool  updateUsage,
Bool  showDownloadDialog,
const Filter filter = GetZeroRef< Filter >() 
)
static

◆ RevealAsset()

static MAXON_METHOD Result<void> RevealAsset ( const Block< AssetDescription > &  assets)
static

RevealAsset opens the asset browser to show the given assets in the browser.

Parameters
[in]assetsAssets to show.
Returns
OK on success.

◆ LoadAssets()

static MAXON_METHOD Result<Bool> LoadAssets ( const AssetRepositoryRef &  searchRepository,
const HashMap< Id, String > &  selectionAndFilterString,
const GraphModelPresenterRef &  presenter = GetZeroRef< GraphModelPresenterRef >(),
const nodes::NodesGraphModelRef &  graphModelRef = GetZeroRef< nodes::NodesGraphModelRef >() 
)
static

LoadAssets executes the load asset command from the asset browser (e.g. double click or open).

Parameters
[in]searchRepositorySearch repository.
[in]selectionAndFilterStringHashMap which contains the search terms to switch modes in the newly created node/object.
[in]presenterOptional presenter to use when creating nodes.
[in]graphModelRefOptional parameter to pass the node graph where to insert nodes.
Returns
Bool on success. True if loaded. False indicates another error state.

◆ GetAssetManagerSubDialogRef()

static MAXON_METHOD Result<AssetManagerSubDialogRef> GetAssetManagerSubDialogRef ( )
static