Voltray Engine Docs
Loading...
Searching...
No Matches
AssetManager.h
Go to the documentation of this file.
1#pragma once
2#include "AssetItem.h"
3#include <vector>
4#include <functional>
5
11namespace Editor
12{
13 namespace Assets
14 {
20 {
21 public:
25 void Initialize();
26
34 std::vector<AssetItem> GetDirectoryContents(
35 const std::filesystem::path &directory,
36 bool isGlobal,
37 const AssetBrowserState &state);
38
45 bool ShouldShowFile(const std::filesystem::path &path, const AssetBrowserState &state);
46
53 void SortAssets(std::vector<AssetItem> &items, const std::string &sortBy, bool ascending);
54
60 std::string GetMimeType(const std::string &extension);
61
67 std::string GetFileCategory(const std::string &extension);
68
75 bool CreateFolder(const std::filesystem::path &parentPath, const std::string &folderName);
76
84 bool CreateScript(const std::filesystem::path &parentPath, const std::string &scriptName, const std::string &scriptType);
85
91 bool DeleteAsset(const std::filesystem::path &assetPath);
92
99 bool RenameAsset(const std::filesystem::path &oldPath, const std::string &newName);
100
106 bool CanDragAsset(const AssetItem &item);
107
113 std::string GetDragData(const AssetItem &item);
114
115 private:
122 bool MatchesFilter(const std::string &name, const std::string &filter);
123 };
124 }
125}
Core data structures for asset items.
A panel component responsible for managing and displaying asset resources.
Handles asset data management, file operations, and state.
Definition AssetManager.h:20
bool RenameAsset(const std::filesystem::path &oldPath, const std::string &newName)
Rename an asset.
Definition AssetManager.cpp:336
bool ShouldShowFile(const std::filesystem::path &path, const AssetBrowserState &state)
Check if a file should be displayed based on filters.
Definition AssetManager.cpp:109
void Initialize()
Initialize the asset manager.
Definition AssetManager.cpp:11
std::string GetFileCategory(const std::string &extension)
Get file category for UI purposes.
Definition AssetManager.cpp:219
std::vector< AssetItem > GetDirectoryContents(const std::filesystem::path &directory, bool isGlobal, const AssetBrowserState &state)
Get directory contents as asset items.
Definition AssetManager.cpp:16
void SortAssets(std::vector< AssetItem > &items, const std::string &sortBy, bool ascending)
Sort asset items based on criteria.
Definition AssetManager.cpp:133
std::string GetMimeType(const std::string &extension)
Get MIME type for a file.
Definition AssetManager.cpp:174
std::string GetDragData(const AssetItem &item)
Get drag data for an asset.
Definition AssetManager.cpp:360
bool CreateFolder(const std::filesystem::path &parentPath, const std::string &folderName)
Create a new folder at the specified location.
Definition AssetManager.cpp:243
bool DeleteAsset(const std::filesystem::path &assetPath)
Delete an asset.
Definition AssetManager.cpp:317
bool CanDragAsset(const AssetItem &item)
Check if an asset can be dragged.
Definition AssetManager.cpp:350
bool CreateScript(const std::filesystem::path &parentPath, const std::string &scriptName, const std::string &scriptType)
Create a new script file.
Definition AssetManager.cpp:256
Definition AssetsPanel.cpp:7
State information for the asset browser.
Definition AssetItem.h:51
Represents a single asset item in the file browser.
Definition AssetItem.h:30