Open 3D Engine AzToolsFramework API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzToolsFramework::AssetBrowser::Utils Namespace Reference

A set of useful utilities that work with Asset Browser Entries. More...

Functions

AZStd::string ToString (const AZStd::vector< const AssetBrowserEntry * > &entries)
 
bool FromString (AZStd::string_view inputString, AZStd::vector< const AssetBrowserEntry * > &entries)
 
void ToMimeData (QMimeData *mimeData, const AZStd::vector< const AssetBrowserEntry * > &entries)
 
bool FromMimeData (const QMimeData *mimeData, AZStd::vector< const AssetBrowserEntry * > &entries)
 
AZStd::string WriteEntryToString (const AssetBrowserEntry *entry)
 
const AssetBrowserEntryFindFromString (AZStd::string_view data)
 
const AssetBrowserEntryFolderForEntry (const AssetBrowserEntry *entry)
 This function returns the folder in which given asset is located or the entry itself if it's already a folder.
 

Detailed Description

A set of useful utilities that work with Asset Browser Entries.

Function Documentation

◆ FindFromString()

const AssetBrowserEntry * AzToolsFramework::AssetBrowser::Utils::FindFromString ( AZStd::string_view  data)

This function takes a string written by the WriteEntryToString function above, and reads it back, searches for the associated element in the Asset Browser Entry tree, and resolves it if it can. Note that what is being returned is a pointer to the actual entry in the actual Asset Browser tree, it is not deserializing or creating a new one.

◆ FromMimeData()

bool AzToolsFramework::AssetBrowser::Utils::FromMimeData ( const QMimeData *  mimeData,
AZStd::vector< const AssetBrowserEntry * > &  entries 
)

Given a QMimeData object, parses any AssetBrowserEntry* objects encoded in it and writes them to the given vector. Note that this is a lookup/find operation, not a deserialize operation, so the pointers you recieve are to the actual AssetBrowserEntries in your actual Asset Browser tree local to this application. Returns true if any entries were encoded in the mimeData (regardless of whether they were added to the vector or not, since it de-duplicates).

◆ FromString()

bool AzToolsFramework::AssetBrowser::Utils::FromString ( AZStd::string_view  inputString,
AZStd::vector< const AssetBrowserEntry * > &  entries 
)

The opposite of ToString - given a string that may contain encoded entries, resolve them to the real entries. Note that the entries returned are pointers to the actual real entries in the real asset browser view, and should not be cached for longer than this call. Returns true if the inputString contained any AssetBrowserEntry encodings. Note that this call de-duplicates, but will still return true if it found any valid entries in the data, regardless of whether it added any NEW ones or not due to de-duplication.

◆ ToMimeData()

void AzToolsFramework::AssetBrowser::Utils::ToMimeData ( QMimeData *  mimeData,
const AZStd::vector< const AssetBrowserEntry * > &  entries 
)

Stores a given vector of AssetBrowserEntry*, writes it to the given QMimeData object in a way that can be read back even across applications (ie, no pointers are serialized, only identifiers that can be looked up).

◆ ToString()

AZStd::string AzToolsFramework::AssetBrowser::Utils::ToString ( const AZStd::vector< const AssetBrowserEntry * > &  entries)

Write a vector of entries to a string that you can read back using FromString. Becuase entries are constantly changing as new assets are added and old are removed it is important to snapshot entries to a string, and then read them back from the string at a later time in any async operation, rather than hanging on to the pointers for any longer than one callstack.

◆ WriteEntryToString()

AZStd::string AzToolsFramework::AssetBrowser::Utils::WriteEntryToString ( const AssetBrowserEntry entry)

Write a single AssetBrowserEntry to a string in a stable and machine-readable way that can be read back later. Supports only products and sources currently.