diff --git a/SofaImGui/src/SofaImGui/windows/MouseManager.cpp b/SofaImGui/src/SofaImGui/windows/MouseManager.cpp index f933263a89..2c674ee179 100644 --- a/SofaImGui/src/SofaImGui/windows/MouseManager.cpp +++ b/SofaImGui/src/SofaImGui/windows/MouseManager.cpp @@ -29,8 +29,6 @@ namespace windows { - - void showManagerMouseWindow(const char *const & windowNameMouseManager, WindowState& winManagerMouse, sofaglfw::SofaGLFWBaseGUI* baseGUI) @@ -56,6 +54,9 @@ void showManagerMouseWindow(const char *const & windowNameMouseManager, if (ImGui::CollapsingHeader(buttonNames.at(button).c_str())) { auto* operation = pickHandler->getOperation(button); + + if(!operation) continue; + std::string currentOperationDescription; for (const auto& [label, creator] : OperationFactory::getInstance()->registry) @@ -73,6 +74,9 @@ void showManagerMouseWindow(const char *const & windowNameMouseManager, if (ImGui::Selectable(creator->getDescription().c_str(), isSelected)) { pickHandler->changeOperation(button, label); + operation = pickHandler->getOperation(button); // Re-fetch the operation after call to changeOperation() + + if (!operation) continue; } if (isSelected) ImGui::SetItemDefaultFocus(); @@ -108,7 +112,7 @@ void showManagerMouseWindow(const char *const & windowNameMouseManager, float stiffness = fixOperation->getStiffness(); if (ImGui::SliderFloat("Stiffness", &stiffness, 0.0f, 100000.0f)) { - attachOperation->setStiffness(stiffness); + fixOperation->setStiffness(stiffness); } } else if (auto* inciseOperation = dynamic_cast(operation))