-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Closed
Labels
label/id and id stackimplicit identifiers, pushid(), id stackimplicit identifiers, pushid(), id stack
Description
Docking branch (but I recall having this issue some years ago as well, using the main branch).
VS compiler
Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Operating System: Windows
Multiple inputs are being selected and edited at the same time
First of all, thank you a lot for your time :). I have a vector of (pair <string, std::any>) and I am iterating it in order to draw some inputs (text, float, int, vec3, etc.), and when I try to edit one of them, every of the inputs drawn is selected and edited.
This is how it looks when I do not interact with it:
Code of the loop
// Here's some code anyone can copy and paste to reproduce your issue
for (auto& uniform : uniforms)
{
ImGui::SetNextItemWidth(ImGui::GetWindowWidth() / 4.0f);
ImGui::InputText("", &uniform.first);
ImGui::SameLine();
if (uniform.second.type() == typeid(int))
{
auto& val = std::any_cast<int&>(uniform.second);
ImGui::InputInt("Value", &val);
continue;
}
if (uniform.second.type() == typeid(float))
{
auto& val = std::any_cast<float&>(uniform.second);
ImGui::InputFloat("Value", &val);
continue;
}
if (uniform.second.type() == typeid(glm::vec4))
{
auto& val = std::any_cast<glm::vec4&>(uniform.second);
ImGui::InputFloat4("Value", &(val.x));
continue;
}
if (uniform.second.type() == typeid(glm::vec3))
{
auto& val = std::any_cast<glm::vec3&>(uniform.second);
ImGui::InputFloat3("Value", &(val.x));
continue;
}
if (uniform.second.type() == typeid(glm::vec2))
{
auto& val = std::any_cast<glm::vec2&>(uniform.second);
ImGui::InputFloat2("Value", &(val.x));
continue;
}
}
Metadata
Metadata
Assignees
Labels
label/id and id stackimplicit identifiers, pushid(), id stackimplicit identifiers, pushid(), id stack