Skip to content

Commit

Permalink
Fix ImGui crash on material view
Browse files Browse the repository at this point in the history
  • Loading branch information
enginmanap committed Dec 3, 2024
1 parent 52c105b commit 846a399
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Editor/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,14 +680,15 @@ void Editor::renderEditor() {
bool isSelected = false;
auto allMaterials = world->assetManager->getMaterials();
ImGui::Text("Total material count is %llu", allMaterials.size());
ImGui::BeginListBox("Materials");
for (auto it = allMaterials.begin(); it != allMaterials.end(); ++it) {
isSelected = selectedHash == it->first;
if (ImGui::Selectable((it->second.first->getName() + " -> " + std::to_string(it->first)).c_str(), isSelected)) {
selectedHash = it->first;
if (ImGui::BeginListBox("Materials")) {
for (auto it = allMaterials.begin(); it != allMaterials.end(); ++it) {
isSelected = selectedHash == it->first;
if (ImGui::Selectable((it->second.first->getName() + " -> " + std::to_string(it->first)).c_str(), isSelected)) {
selectedHash = it->first;
}
}
ImGui::EndListBox();
}
ImGui::EndListBox();
auto selectedMaterialIt = allMaterials.find(selectedHash);
if(selectedMaterialIt != allMaterials.end()) {
selectedMaterialIt->second.first->addImGuiEditorElements(*world->request);
Expand Down

0 comments on commit 846a399

Please sign in to comment.