35 lines
1.4 KiB
ActionScript

class ShaderExplorer : DockPanel {
string currentPath = "";
void onRender() {
// To avoid problems we will cache the current path
const string cache_currentPath = currentPath;
AssetType resourceType = AssetType::Shader;
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(resourceType, cache_currentPath, i));
currentPath = Assets::getDirPathById(resourceType, cache_currentPath, i);
}
UI::textCenter(Assets::getDirNameById(resourceType, cache_currentPath, i));
UI::nextColumn();
}
int meshCount = Assets::getAssetCount(resourceType, cache_currentPath);
for (int i = 0; i < meshCount; i++) {
UI::drawIconCentered("file", 64);
UI::dragDropSource("SHADER",
any(Assets::getAssetTypePathById(resourceType, cache_currentPath, i)),
Assets::getAssetTypePathById(resourceType, cache_currentPath, i));
UI::textCenter(Assets::getAssetNameById(resourceType, cache_currentPath, i));
UI::nextColumn();
}
UI::endColumns();
}
}