47 lines
1.7 KiB
ActionScript
47 lines
1.7 KiB
ActionScript
class MeshExplorer : DockPanel {
|
|
string currentPath = "";
|
|
|
|
void onRender() {
|
|
|
|
UI::setupAutomaticColumns(128);
|
|
|
|
// 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();
|
|
}
|
|
|
|
AssetType resourceType = AssetType::Mesh;
|
|
int dirCount = Assets::getDirCount(resourceType, cache_currentPath);
|
|
for (int i = 0; i < dirCount; i++) {
|
|
UI::drawIconCentered("folder", 64);
|
|
|
|
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();
|
|
|
|
}
|
|
}
|