Voltray Engine Docs
Loading...
Searching...
No Matches
Editor::Assets::AssetManager Class Reference

Handles asset data management, file operations, and state. More...

#include <AssetManager.h>

Public Member Functions

void Initialize ()
 Initialize the asset manager.
 
std::vector< AssetItemGetDirectoryContents (const std::filesystem::path &directory, bool isGlobal, const AssetBrowserState &state)
 Get directory contents as asset items.
 
bool ShouldShowFile (const std::filesystem::path &path, const AssetBrowserState &state)
 Check if a file should be displayed based on filters.
 
void SortAssets (std::vector< AssetItem > &items, const std::string &sortBy, bool ascending)
 Sort asset items based on criteria.
 
std::string GetMimeType (const std::string &extension)
 Get MIME type for a file.
 
std::string GetFileCategory (const std::string &extension)
 Get file category for UI purposes.
 
bool CreateFolder (const std::filesystem::path &parentPath, const std::string &folderName)
 Create a new folder at the specified location.
 
bool CreateScript (const std::filesystem::path &parentPath, const std::string &scriptName, const std::string &scriptType)
 Create a new script file.
 
bool DeleteAsset (const std::filesystem::path &assetPath)
 Delete an asset.
 
bool RenameAsset (const std::filesystem::path &oldPath, const std::string &newName)
 Rename an asset.
 
bool CanDragAsset (const AssetItem &item)
 Check if an asset can be dragged.
 
std::string GetDragData (const AssetItem &item)
 Get drag data for an asset.
 

Detailed Description

Handles asset data management, file operations, and state.

Member Function Documentation

◆ CanDragAsset()

bool Editor::Assets::AssetManager::CanDragAsset ( const AssetItem item)

Check if an asset can be dragged.

Parameters
itemAsset item to check
Returns
True if draggable

◆ CreateFolder()

bool Editor::Assets::AssetManager::CreateFolder ( const std::filesystem::path &  parentPath,
const std::string &  folderName 
)

Create a new folder at the specified location.

Parameters
parentPathParent directory
folderNameName of the new folder
Returns
True if successful

◆ CreateScript()

bool Editor::Assets::AssetManager::CreateScript ( const std::filesystem::path &  parentPath,
const std::string &  scriptName,
const std::string &  scriptType 
)

Create a new script file.

Parameters
parentPathParent directory
scriptNameName of the script
scriptTypeType of script (C#, JavaScript, etc.)
Returns
True if successful

◆ DeleteAsset()

bool Editor::Assets::AssetManager::DeleteAsset ( const std::filesystem::path &  assetPath)

Delete an asset.

Parameters
assetPathPath to the asset
Returns
True if successful

◆ GetDirectoryContents()

std::vector< AssetItem > Editor::Assets::AssetManager::GetDirectoryContents ( const std::filesystem::path &  directory,
bool  isGlobal,
const AssetBrowserState state 
)

Get directory contents as asset items.

Parameters
directoryDirectory to scan
isGlobalWhether these are global assets
stateBrowser state for filtering/sorting
Returns
Vector of asset items

◆ GetDragData()

std::string Editor::Assets::AssetManager::GetDragData ( const AssetItem item)

Get drag data for an asset.

Parameters
itemAsset item
Returns
Drag data string

◆ GetFileCategory()

std::string Editor::Assets::AssetManager::GetFileCategory ( const std::string &  extension)

Get file category for UI purposes.

Parameters
extensionFile extension
Returns
Category string (3D, Image, Audio, etc.)

◆ GetMimeType()

std::string Editor::Assets::AssetManager::GetMimeType ( const std::string &  extension)

Get MIME type for a file.

Parameters
extensionFile extension
Returns
MIME type string

◆ Initialize()

void Editor::Assets::AssetManager::Initialize ( )

Initialize the asset manager.

◆ RenameAsset()

bool Editor::Assets::AssetManager::RenameAsset ( const std::filesystem::path &  oldPath,
const std::string &  newName 
)

Rename an asset.

Parameters
oldPathCurrent path
newNameNew name
Returns
True if successful

◆ ShouldShowFile()

bool Editor::Assets::AssetManager::ShouldShowFile ( const std::filesystem::path &  path,
const AssetBrowserState state 
)

Check if a file should be displayed based on filters.

Parameters
pathFile path to check
stateBrowser state with filters
Returns
True if file should be shown

◆ SortAssets()

void Editor::Assets::AssetManager::SortAssets ( std::vector< AssetItem > &  items,
const std::string &  sortBy,
bool  ascending 
)

Sort asset items based on criteria.

Parameters
itemsItems to sort
sortBySort criteria
ascendingSort direction

The documentation for this class was generated from the following files: