DeerEngine/roe/editor/mesh_explorer.as

45 lines
1.6 KiB
ActionScript

class MeshExplorer : 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::Mesh;
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::Mesh, cache_currentPath, i));
currentPath = getDirPathById(ResourceType::Mesh, cache_currentPath, i);
}
textCenter(getDirNameById(ResourceType::Mesh, cache_currentPath, i));
nextColumn();
}
int meshCount = getResourceCount(ResourceType::Mesh, cache_currentPath);
for (int i = 0; i < meshCount; i++) {
drawIconCentered("file", 64);
dragDropSource("MESH",
any(getResourcePathById(ResourceType::Mesh, cache_currentPath, i)),
getResourcePathById(ResourceType::Mesh, cache_currentPath, i));
textCenter(getResourceNameById(ResourceType::Mesh, cache_currentPath, i));
nextColumn();
}
endColumns();
}
}