CogEngine: fix imgui ID conflict in Inspector window

This commit is contained in:
Arnaud Jamin
2025-01-14 23:34:30 -05:00
parent c6881534b8
commit c561f4b92d
@@ -205,6 +205,7 @@ void FCogEngineWindow_Inspector::RenderMenu()
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
ImGui::PushID("Favorites");
for (Favorite& Favorite : Favorites) for (Favorite& Favorite : Favorites)
{ {
const TWeakObjectPtr<UObject>& Object = Favorite.Object; const TWeakObjectPtr<UObject>& Object = Favorite.Object;
@@ -214,21 +215,26 @@ void FCogEngineWindow_Inspector::RenderMenu()
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
} }
ImGui::PopID();
//----------------------------------- //-----------------------------------
// HISTORY // HISTORY
//----------------------------------- //-----------------------------------
ImGui::Spacing(); ImGui::Spacing();
ImGui::SeparatorText("HISTORY"); ImGui::SeparatorText("HISTORY");
ImGui::PushID("History");
for (int32 i = History.Num() - 1; i >= 0; i--) for (int32 i = History.Num() - 1; i >= 0; i--)
{ {
ImGui::PushID(i);
const TWeakObjectPtr<const UObject>& Object = History[i]; const TWeakObjectPtr<const UObject>& Object = History[i];
if (ImGui::MenuItem(TCHAR_TO_ANSI(*GetNameSafe(Object.Get())), nullptr, i == HistoryIndex)) if (ImGui::MenuItem(TCHAR_TO_ANSI(*GetNameSafe(Object.Get())), nullptr, i == HistoryIndex))
{ {
NewHistoryIndex = i; NewHistoryIndex = i;
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
ImGui::PopID();
} }
ImGui::PopID();
ImGui::EndChild(); ImGui::EndChild();
ImGui::EndPopup(); ImGui::EndPopup();