From 03ecea02b8e2b635e82364058e2e09497cc4034c Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Wed, 3 Jun 2026 18:02:28 +0200 Subject: [PATCH 1/3] Add camera when none is added to the scene --- SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp | 12 ++++++++---- SofaImGui/src/SofaImGui/ObjectColor.cpp | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp b/SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp index 0694fd9f63..db771cc290 100644 --- a/SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp +++ b/SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp @@ -79,6 +79,7 @@ #include #include #include +#include #include @@ -223,18 +224,21 @@ void ImGuiGUIEngine::loadFile(sofaglfw::SofaGLFWBaseGUI* baseGUI, sofa::core::sp sofa::simulation::node::initRoot(groot.get()); - auto camera = baseGUI->getCamera(); - if (camera) + + baseGUI->addCameraIfRequired(); + + if (baseGUI->getCamera()) { + if( groot->f_bbox.getValue().isValid()) { - camera->fitBoundingBox(groot->f_bbox.getValue().minBBox(), groot->f_bbox.getValue().maxBBox()); + baseGUI->getCamera()->fitBoundingBox(groot->f_bbox.getValue().minBBox(), groot->f_bbox.getValue().maxBBox()); } else { msg_warning_when(!groot->f_bbox.getValue().isValid(), "GUI") << "Global bounding box is invalid: " << groot->f_bbox.getValue(); } - baseGUI->changeCamera(camera); + baseGUI->changeCamera(baseGUI->getCamera()); } else { diff --git a/SofaImGui/src/SofaImGui/ObjectColor.cpp b/SofaImGui/src/SofaImGui/ObjectColor.cpp index dd9a274703..ce5afa2abb 100644 --- a/SofaImGui/src/SofaImGui/ObjectColor.cpp +++ b/SofaImGui/src/SofaImGui/ObjectColor.cpp @@ -49,7 +49,7 @@ namespace sofaimgui objectType=sofa::simulation::Colors::FFIELD; else if(object->toBaseAnimationLoop()) objectType=sofa::simulation::Colors::SOLVER; - else if(object->toOdeSolver()) + else if(object->toIntegrationScheme()) objectType=sofa::simulation::Colors::SOLVER; else if(object->toPipeline()) objectType=sofa::simulation::Colors::COLLISION; From 73ec9fd380d977b96112bf90145f9f03ad8c34e2 Mon Sep 17 00:00:00 2001 From: Paul Baksic <30337881+bakpaul@users.noreply.github.com> Date: Thu, 4 Jun 2026 08:58:57 +0200 Subject: [PATCH 2/3] Revert IntegrationScheme fixe --- SofaImGui/src/SofaImGui/ObjectColor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SofaImGui/src/SofaImGui/ObjectColor.cpp b/SofaImGui/src/SofaImGui/ObjectColor.cpp index ce5afa2abb..da52bba3e5 100644 --- a/SofaImGui/src/SofaImGui/ObjectColor.cpp +++ b/SofaImGui/src/SofaImGui/ObjectColor.cpp @@ -49,7 +49,7 @@ namespace sofaimgui objectType=sofa::simulation::Colors::FFIELD; else if(object->toBaseAnimationLoop()) objectType=sofa::simulation::Colors::SOLVER; - else if(object->toIntegrationScheme()) + else if(object->toODESolver()) objectType=sofa::simulation::Colors::SOLVER; else if(object->toPipeline()) objectType=sofa::simulation::Colors::COLLISION; From e20ca9c8b38e95a1399b95eb6e906ccdf0a3203a Mon Sep 17 00:00:00 2001 From: Paul Baksic <30337881+bakpaul@users.noreply.github.com> Date: Thu, 4 Jun 2026 08:59:22 +0200 Subject: [PATCH 3/3] FIX typo --- SofaImGui/src/SofaImGui/ObjectColor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SofaImGui/src/SofaImGui/ObjectColor.cpp b/SofaImGui/src/SofaImGui/ObjectColor.cpp index da52bba3e5..dd9a274703 100644 --- a/SofaImGui/src/SofaImGui/ObjectColor.cpp +++ b/SofaImGui/src/SofaImGui/ObjectColor.cpp @@ -49,7 +49,7 @@ namespace sofaimgui objectType=sofa::simulation::Colors::FFIELD; else if(object->toBaseAnimationLoop()) objectType=sofa::simulation::Colors::SOLVER; - else if(object->toODESolver()) + else if(object->toOdeSolver()) objectType=sofa::simulation::Colors::SOLVER; else if(object->toPipeline()) objectType=sofa::simulation::Colors::COLLISION;