|
|
|
|
/******************************************************************************
|
|
|
|
|
* File - asset_browser.h
|
|
|
|
|
* Author - Joey Pollack
|
|
|
|
|
* Date - 2021/11/10 (y/m/d)
|
|
|
|
|
* Mod Date - 2021/11/10 (y/m/d)
|
|
|
|
|
* Description - Browse and manage project assets
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef ASSET_BROWSER_H_
|
|
|
|
|
#define ASSET_BROWSER_H_
|
|
|
|
|
|
|
|
|
|
#include <gui/panel.h>
|
|
|
|
|
#include <editor/editor.h>
|
|
|
|
|
|
|
|
|
|
#include <filesystem>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
namespace lunarium
|
|
|
|
|
{
|
|
|
|
|
namespace editor
|
|
|
|
|
{
|
|
|
|
|
class AssetBrowser : public gui::Panel
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
AssetBrowser(std::filesystem::path dir, Editor* pEditor);
|
|
|
|
|
|
|
|
|
|
void SetAssetDirectory(std::filesystem::path dir);
|
|
|
|
|
|
|
|
|
|
bool DoFrame();
|
|
|
|
|
|
|
|
|
|
std::filesystem::path GetSelectedDirectory();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
struct Node
|
|
|
|
|
{
|
|
|
|
|
std::filesystem::path Myself;
|
|
|
|
|
std::vector<Node*> Children;
|
|
|
|
|
std::vector<std::filesystem::path> Files;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::filesystem::path mAssetDirectory;
|
|
|
|
|
std::filesystem::path mSelectedDir;
|
|
|
|
|
Node* mTreeRoot;
|
|
|
|
|
Node* mSelectedNode;
|
|
|
|
|
Editor* mpEditor;
|
|
|
|
|
bool mNewFolder;
|
|
|
|
|
bool mSyncTree;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Node* ReloadAssets(std::filesystem::path dir);
|
|
|
|
|
Node* FindNodeAt(std::filesystem::path dir);
|
|
|
|
|
|
|
|
|
|
void DoDirTree(std::filesystem::path dir);
|
|
|
|
|
void DoContextMenu();
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif // ASSET_BROWSER_H_
|