76 lines
2.1 KiB
ActionScript
76 lines
2.1 KiB
ActionScript
class AssetExplorer : DockPanel {
|
|
AssetType searchAssetType = AssetType::None;
|
|
string currentPath = "";
|
|
|
|
void onRender() {
|
|
UI::text("\t");
|
|
UI::sameline();
|
|
if (UI::button("Assets")) {
|
|
searchAssetType = AssetType::None;
|
|
currentPath = "";
|
|
}
|
|
|
|
if (searchAssetType != AssetType::None) {
|
|
UI::sameline();
|
|
UI::text("/");
|
|
UI::sameline();
|
|
|
|
switch (searchAssetType) {
|
|
case AssetType::Mesh :
|
|
if (UI::button("Meshes")) {
|
|
currentPath = "";
|
|
}
|
|
break;
|
|
|
|
case AssetType::Shader :
|
|
if (UI::button("Shaders")) {
|
|
currentPath = "";
|
|
}
|
|
break;
|
|
|
|
default:
|
|
UI::text("Error");
|
|
break;
|
|
}
|
|
|
|
if (currentPath != "") {
|
|
array<string>@ paths = Engine::dividePath(currentPath);
|
|
|
|
for (uint i = 0; i < paths.length(); i++) {
|
|
UI::sameline();
|
|
UI::text("/");
|
|
UI::sameline();
|
|
|
|
// If we select that path
|
|
if (UI::button(paths[i])) {
|
|
|
|
// We obtain that pat
|
|
string changePath = "";
|
|
for (uint z = 0; z <= i; z++) {
|
|
if (z != 0)
|
|
changePath += "/";
|
|
changePath += paths[z];
|
|
}
|
|
|
|
currentPath = changePath;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
UI::setupAutomaticColumns(128);
|
|
if (searchAssetType == AssetType::None) {
|
|
searchAssetType = renderRootAssets();
|
|
}
|
|
|
|
if (searchAssetType == AssetType::Mesh) {
|
|
currentPath = renderMeshExplorer(currentPath);
|
|
if (currentPath == "..") {
|
|
searchAssetType = AssetType::None;
|
|
currentPath = "";
|
|
}
|
|
}
|
|
UI::setupColumns(1);
|
|
}
|
|
}
|