From b2162f33d43acb4ab80e9e5445afec15f2524673 Mon Sep 17 00:00:00 2001 From: T-rvw <429601557@qq.com> Date: Tue, 6 Feb 2024 16:40:22 +0800 Subject: [PATCH] fix imgui id confliction --- Engine/Source/Runtime/ImGui/ImGuiUtils.hpp | 13 ++++++++++--- Engine/Source/ThirdParty/AssetPipeline | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Engine/Source/Runtime/ImGui/ImGuiUtils.hpp b/Engine/Source/Runtime/ImGui/ImGuiUtils.hpp index 9391689a..09a5bb40 100644 --- a/Engine/Source/Runtime/ImGui/ImGuiUtils.hpp +++ b/Engine/Source/Runtime/ImGui/ImGuiUtils.hpp @@ -145,12 +145,13 @@ static bool ImGuiVectorProperty(const char* pName, T& value, cd::Unit unit = cd: constexpr float labelIndetation = 10.0f; + ImGui::PushID(pName); ImGui::Indent(labelIndetation); ImGuiUtils::Text(pName, 0.8f); ImGui::Unindent(labelIndetation); ImGui::PushItemWidth(350); ImGui::SameLine(100.0f); - + //std::string metricName = std::format("%.2f{}", cd::GetUnitName(unit)); std::string metricName = "%.2f"; metricName += cd::GetUnitName(unit); @@ -179,11 +180,15 @@ static bool ImGuiVectorProperty(const char* pName, T& value, cd::Unit unit = cd: } ImGui::PopItemWidth(); + ImGui::PopID(); + return dirty; } static bool ImGuiTransformProperty(const char* pName, cd::Transform& value) { + ImGui::PushID(pName); + bool dirty = false; if (ImGuiVectorProperty("Translation", value.GetTranslation())) { @@ -272,6 +277,7 @@ static bool ImGuiTransformProperty(const char* pName, cd::Transform& value) ImGui::Checkbox("Uniform", &UniformScaleEnabled); engine::TransformComponent::SetUseUniformScale(UniformScaleEnabled); ImGui::Columns(1); + ImGui::PopID(); return dirty; } @@ -284,15 +290,15 @@ static void ColorPickerProperty(const char* pName, T& color) { showMap[pName] = false; } + + ImGui::PushID(pName); ImGui::TextUnformatted(pName); ImGui::SameLine(); ImGui::NextColumn(); - ImGui::PushID(pName); if (ImGui::Button("...")) { showMap[pName] = true; } - ImGui::PopID(); ImGui::PushItemWidth(-1); ImGui::SameLine(); ImGui::NextColumn(); @@ -331,6 +337,7 @@ static void ColorPickerProperty(const char* pName, T& color) ImGui::End(); } ImGui::Separator(); + ImGui::PopID(); } } diff --git a/Engine/Source/ThirdParty/AssetPipeline b/Engine/Source/ThirdParty/AssetPipeline index 92c6cf02..554888b5 160000 --- a/Engine/Source/ThirdParty/AssetPipeline +++ b/Engine/Source/ThirdParty/AssetPipeline @@ -1 +1 @@ -Subproject commit 92c6cf026fd41781bc3f430a1be49fa274a14bb9 +Subproject commit 554888b5c624f7909173184160fa3656caa8f56a