45 lines
1.6 KiB
ActionScript
45 lines
1.6 KiB
ActionScript
class ShaderExplorer : DockPanel {
|
|
string currentPath = "";
|
|
|
|
void onRender() {
|
|
setupAutomaticColumns(128);
|
|
|
|
// To avoid problems we will cache the current path
|
|
const string cache_currentPath = currentPath;
|
|
if (cache_currentPath != "") {
|
|
drawIconCentered("folder", 64);
|
|
if (isItemClicked(0) and isMouseDoubleClicked(0)) {
|
|
currentPath = "";
|
|
}
|
|
textCenter(cache_currentPath + "/..");
|
|
nextColumn();
|
|
}
|
|
|
|
ResourceType resourceType = ResourceType::Shader;
|
|
int dirCount = getDirCount(resourceType, cache_currentPath);
|
|
for (int i = 0; i < dirCount; i++) {
|
|
drawIconCentered("folder", 64);
|
|
|
|
if (isItemClicked(0) and isMouseDoubleClicked(0)) {
|
|
print(getDirPathById(resourceType, cache_currentPath, i));
|
|
currentPath = getDirPathById(resourceType, cache_currentPath, i);
|
|
}
|
|
|
|
textCenter(getDirNameById(resourceType, cache_currentPath, i));
|
|
nextColumn();
|
|
}
|
|
|
|
int meshCount = getResourceCount(resourceType, cache_currentPath);
|
|
for (int i = 0; i < meshCount; i++) {
|
|
drawIconCentered("file", 64);
|
|
dragDropSource("SHADER",
|
|
any(getResourcePathById(resourceType, cache_currentPath, i)),
|
|
getResourcePathById(resourceType, cache_currentPath, i));
|
|
|
|
|
|
textCenter(getResourceNameById(resourceType, cache_currentPath, i));
|
|
nextColumn();
|
|
}
|
|
endColumns();
|
|
}
|
|
} |