Working on Asset Manager Explorer
This commit is contained in:
parent
c4d9dd300b
commit
a02469b935
@ -30,7 +30,7 @@ DockId=0x00000005,1
|
|||||||
Pos=0,439
|
Pos=0,439
|
||||||
Size=1280,281
|
Size=1280,281
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000004,1
|
DockId=0x00000004,0
|
||||||
|
|
||||||
[Window][TreePannel]
|
[Window][TreePannel]
|
||||||
Pos=0,24
|
Pos=0,24
|
||||||
@ -76,7 +76,7 @@ DockId=0x00000005,2
|
|||||||
Pos=0,439
|
Pos=0,439
|
||||||
Size=1280,281
|
Size=1280,281
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000004,2
|
DockId=0x00000004,1
|
||||||
|
|
||||||
[Docking][Data]
|
[Docking][Data]
|
||||||
DockSpace ID=0xA1672E74 Window=0x4647B76E Pos=0,24 Size=1280,696 Split=Y Selected=0x34A4C10F
|
DockSpace ID=0xA1672E74 Window=0x4647B76E Pos=0,24 Size=1280,696 Split=Y Selected=0x34A4C10F
|
||||||
|
@ -27,6 +27,9 @@ namespace Deer {
|
|||||||
// dir
|
// dir
|
||||||
std::string getDirNameById(AssetType, std::string& dir, int i);
|
std::string getDirNameById(AssetType, std::string& dir, int i);
|
||||||
|
|
||||||
|
std::string getParentPath(std::string&);
|
||||||
|
std::string getParentPathName(std::string&);
|
||||||
|
|
||||||
// INTERNAL
|
// INTERNAL
|
||||||
const char* getAssetTypePath(AssetType);
|
const char* getAssetTypePath(AssetType);
|
||||||
const char* getAssetTypeExtension(AssetType);
|
const char* getAssetTypeExtension(AssetType);
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
namespace Deer {
|
|
||||||
namespace EditorEngine {
|
|
||||||
}
|
|
||||||
}
|
|
@ -100,6 +100,14 @@ namespace Deer {
|
|||||||
return dirData.elements[i].stem().string();
|
return dirData.elements[i].stem().string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string getParentPath(std::string& path) {
|
||||||
|
return Path(path).parent_path().string();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string getParentPathName(std::string& path) {
|
||||||
|
return Path(path).parent_path().stem().string();
|
||||||
|
}
|
||||||
|
|
||||||
std::string getAssetTypePathById(AssetType type, std::string& dir,
|
std::string getAssetTypePathById(AssetType type, std::string& dir,
|
||||||
int i) {
|
int i) {
|
||||||
const char* resourcePath = getAssetTypePath(type);
|
const char* resourcePath = getAssetTypePath(type);
|
||||||
|
@ -42,6 +42,10 @@ namespace Deer {
|
|||||||
|
|
||||||
scriptEngine->SetDefaultNamespace("Engine");
|
scriptEngine->SetDefaultNamespace("Engine");
|
||||||
REGISTER_GLOBAL_FUNC("void print(const string& in)", print);
|
REGISTER_GLOBAL_FUNC("void print(const string& in)", print);
|
||||||
|
REGISTER_GLOBAL_FUNC("string getParentPath(const string&in)",
|
||||||
|
getParentPath);
|
||||||
|
REGISTER_GLOBAL_FUNC("string getParentPathName(const string&in)",
|
||||||
|
getParentPathName);
|
||||||
scriptEngine->SetDefaultNamespace("");
|
scriptEngine->SetDefaultNamespace("");
|
||||||
|
|
||||||
scriptEngine->SetDefaultNamespace("UI");
|
scriptEngine->SetDefaultNamespace("UI");
|
||||||
|
@ -6,7 +6,15 @@ class AssetExplorer : DockPanel {
|
|||||||
UI::setupAutomaticColumns(128);
|
UI::setupAutomaticColumns(128);
|
||||||
|
|
||||||
if (searchAssetType == AssetType::None) {
|
if (searchAssetType == AssetType::None) {
|
||||||
searchAssetType = renderGenerics();
|
searchAssetType = renderRootAssets();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (searchAssetType == AssetType::Mesh) {
|
||||||
|
currentPath = renderMeshExplorer(currentPath);
|
||||||
|
if (currentPath == "..") {
|
||||||
|
searchAssetType = AssetType::None;
|
||||||
|
currentPath = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,3 +10,31 @@ bool drawFolder(string&in name) {
|
|||||||
UI::nextColumn();
|
UI::nextColumn();
|
||||||
return click;
|
return click;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool drawFile(string&in name) {
|
||||||
|
bool click = false;
|
||||||
|
UI::drawIconCentered("file", 64);
|
||||||
|
if (UI::isItemClicked(0) and UI::isMouseDoubleClicked(0)) {
|
||||||
|
click = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
UI::textCenter(name);
|
||||||
|
UI::nextColumn();
|
||||||
|
return click;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool drawFile(string&in name, string&in dragId, any dragData, string&in overlay) {
|
||||||
|
bool click = false;
|
||||||
|
UI::drawIconCentered("file", 64);
|
||||||
|
if (UI::isItemClicked(0) and UI::isMouseDoubleClicked(0)) {
|
||||||
|
click = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
UI::dragDropSource(dragId,
|
||||||
|
dragData,
|
||||||
|
overlay);
|
||||||
|
|
||||||
|
UI::textCenter(name);
|
||||||
|
UI::nextColumn();
|
||||||
|
return click;
|
||||||
|
}
|
||||||
|
@ -1,46 +1,33 @@
|
|||||||
class MeshExplorer : DockPanel {
|
string renderMeshExplorer(string&in dir) {
|
||||||
string currentPath = "";
|
string return_dir = dir;
|
||||||
|
|
||||||
void onRender() {
|
if (dir == "") {
|
||||||
|
if (drawFolder("Assets/..")) {
|
||||||
UI::setupAutomaticColumns(128);
|
return_dir = "..";
|
||||||
|
|
||||||
// To avoid problems we will cache the current path
|
|
||||||
const string cache_currentPath = currentPath;
|
|
||||||
if (cache_currentPath != "") {
|
|
||||||
UI::drawIconCentered("folder", 64);
|
|
||||||
if (UI::isItemClicked(0) and UI::isMouseDoubleClicked(0)) {
|
|
||||||
currentPath = "";
|
|
||||||
}
|
}
|
||||||
UI::textCenter(cache_currentPath + "/..");
|
}
|
||||||
UI::nextColumn();
|
|
||||||
|
if (dir != "" && drawFolder(Engine::getParentPathName(dir) + "/..")) {
|
||||||
|
return_dir = Engine::getParentPath(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetType resourceType = AssetType::Mesh;
|
AssetType resourceType = AssetType::Mesh;
|
||||||
int dirCount = Assets::getDirCount(resourceType, cache_currentPath);
|
|
||||||
|
int dirCount = Assets::getDirCount(resourceType, dir);
|
||||||
for (int i = 0; i < dirCount; i++) {
|
for (int i = 0; i < dirCount; i++) {
|
||||||
UI::drawIconCentered("folder", 64);
|
if (drawFolder(Assets::getDirNameById(AssetType::Mesh, dir, i))) {
|
||||||
|
return_dir = Assets::getDirPathById(AssetType::Mesh, dir, i);
|
||||||
if (UI::isItemClicked(0) and UI::isMouseDoubleClicked(0)) {
|
|
||||||
Engine::print(Assets::getDirPathById(AssetType::Mesh, cache_currentPath, i));
|
|
||||||
currentPath = Assets::getDirPathById(AssetType::Mesh, cache_currentPath, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
UI::textCenter(Assets::getDirNameById(AssetType::Mesh, cache_currentPath, i));
|
|
||||||
UI::nextColumn();
|
|
||||||
}
|
|
||||||
|
|
||||||
int meshCount = Assets::getAssetCount(AssetType::Mesh, cache_currentPath);
|
|
||||||
for (int i = 0; i < meshCount; i++) {
|
|
||||||
UI::drawIconCentered("file", 64);
|
|
||||||
UI::dragDropSource("MESH",
|
|
||||||
any(Assets::getAssetTypePathById(AssetType::Mesh, cache_currentPath, i)),
|
|
||||||
Assets::getAssetTypePathById(AssetType::Mesh, cache_currentPath, i));
|
|
||||||
|
|
||||||
UI::textCenter(Assets::getAssetNameById(AssetType::Mesh, cache_currentPath, i));
|
|
||||||
UI::nextColumn();
|
|
||||||
}
|
|
||||||
UI::endColumns();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//int meshCount = Assets::getAssetCount(AssetType::Mesh, dir);
|
||||||
|
//for (int i = 0; i < meshCount; i++) {
|
||||||
|
// drawFile(
|
||||||
|
// Assets::getAssetNameById(AssetType::Mesh, dir, i),
|
||||||
|
// "MESH",
|
||||||
|
// any(Assets::getAssetTypePathById(AssetType::Mesh, dir, i)),
|
||||||
|
// Assets::getAssetTypePathById(AssetType::Mesh, dir, i));
|
||||||
|
//}
|
||||||
|
|
||||||
|
return return_dir;
|
||||||
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Here we render the base folders
|
// Here we render the base folders
|
||||||
AssetType renderGenerics() {
|
AssetType renderRootAssets() {
|
||||||
AssetType selectedAssetType = AssetType::None;
|
AssetType selectedAssetType = AssetType::None;
|
||||||
|
|
||||||
if (drawFolder("Scripts")) selectedAssetType = AssetType::None;
|
if (drawFolder("Scripts")) selectedAssetType = AssetType::None;
|
@ -389,6 +389,8 @@ namespace Assets { int getDirCount(AssetType, const string&in); }
|
|||||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||||
namespace Engine { void print(const string&in); }
|
namespace Engine { void print(const string&in); }
|
||||||
|
namespace Engine { string getParentPath(const string&in); }
|
||||||
|
namespace Engine { string getParentPathName(const string&in); }
|
||||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||||
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
||||||
@ -792,6 +794,8 @@ namespace Assets { int getDirCount(AssetType, const string&in); }
|
|||||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||||
namespace Engine { void print(const string&in); }
|
namespace Engine { void print(const string&in); }
|
||||||
|
namespace Engine { string getParentPath(const string&in); }
|
||||||
|
namespace Engine { string getParentPathName(const string&in); }
|
||||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||||
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
||||||
|
@ -389,6 +389,8 @@ namespace Assets { int getDirCount(AssetType, const string&in); }
|
|||||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||||
namespace Engine { void print(const string&in); }
|
namespace Engine { void print(const string&in); }
|
||||||
|
namespace Engine { string getParentPath(const string&in); }
|
||||||
|
namespace Engine { string getParentPathName(const string&in); }
|
||||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||||
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
||||||
@ -792,6 +794,8 @@ namespace Assets { int getDirCount(AssetType, const string&in); }
|
|||||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||||
namespace Engine { void print(const string&in); }
|
namespace Engine { void print(const string&in); }
|
||||||
|
namespace Engine { string getParentPath(const string&in); }
|
||||||
|
namespace Engine { string getParentPathName(const string&in); }
|
||||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||||
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
||||||
|
@ -389,6 +389,8 @@ namespace Assets { int getDirCount(AssetType, const string&in); }
|
|||||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||||
namespace Engine { void print(const string&in); }
|
namespace Engine { void print(const string&in); }
|
||||||
|
namespace Engine { string getParentPath(const string&in); }
|
||||||
|
namespace Engine { string getParentPathName(const string&in); }
|
||||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||||
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
||||||
@ -792,6 +794,8 @@ namespace Assets { int getDirCount(AssetType, const string&in); }
|
|||||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||||
namespace Engine { void print(const string&in); }
|
namespace Engine { void print(const string&in); }
|
||||||
|
namespace Engine { string getParentPath(const string&in); }
|
||||||
|
namespace Engine { string getParentPathName(const string&in); }
|
||||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||||
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
||||||
|
@ -389,6 +389,8 @@ namespace Assets { int getDirCount(AssetType, const string&in); }
|
|||||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||||
namespace Engine { void print(const string&in); }
|
namespace Engine { void print(const string&in); }
|
||||||
|
namespace Engine { string getParentPath(const string&in); }
|
||||||
|
namespace Engine { string getParentPathName(const string&in); }
|
||||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||||
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
||||||
@ -792,6 +794,8 @@ namespace Assets { int getDirCount(AssetType, const string&in); }
|
|||||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||||
namespace Engine { void print(const string&in); }
|
namespace Engine { void print(const string&in); }
|
||||||
|
namespace Engine { string getParentPath(const string&in); }
|
||||||
|
namespace Engine { string getParentPathName(const string&in); }
|
||||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||||
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
||||||
|
@ -389,6 +389,8 @@ namespace Assets { int getDirCount(AssetType, const string&in); }
|
|||||||
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
namespace Assets { string getDirPathById(AssetType, const string&in, int); }
|
||||||
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
namespace Assets { string getDirNameById(AssetType, const string&in, int); }
|
||||||
namespace Engine { void print(const string&in); }
|
namespace Engine { void print(const string&in); }
|
||||||
|
namespace Engine { string getParentPath(const string&in); }
|
||||||
|
namespace Engine { string getParentPathName(const string&in); }
|
||||||
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
namespace UI { void treeNodeLeaf(const string&in, bool); }
|
||||||
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
namespace UI { bool treeNode(const string&in, bool, any@, ReciverFunc@); }
|
||||||
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
namespace UI { bool componentNode(const string&in, any@, ReciverFunc@); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user