From 4b4b5f2fcf1745b77a12b58c6adf23aa370d3789 Mon Sep 17 00:00:00 2001 From: hugtalbot Date: Sun, 26 Jan 2025 23:06:31 +0100 Subject: [PATCH 1/7] Fix compilation with Lifecycle v25.06 --- SofaGLFW/src/SofaGLFW/SofaGLFWBaseGUI.cpp | 2 +- SofaGLFW/src/SofaGLFW/SofaGLFWGUI.cpp | 4 ++-- exe/Main.cpp | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/SofaGLFW/src/SofaGLFW/SofaGLFWBaseGUI.cpp b/SofaGLFW/src/SofaGLFW/SofaGLFWBaseGUI.cpp index ec406dd61e..8b2a764380 100644 --- a/SofaGLFW/src/SofaGLFW/SofaGLFWBaseGUI.cpp +++ b/SofaGLFW/src/SofaGLFW/SofaGLFWBaseGUI.cpp @@ -517,7 +517,7 @@ void SofaGLFWBaseGUI::initVisual() DisplayFlags* displayFlags = visualStyle->d_displayFlags.beginEdit(); displayFlags->setShowVisualModels(tristate::true_value); - visualStyle->displayFlags.endEdit(); + visualStyle->d_displayFlags.endEdit(); m_groot->addObject(visualStyle); visualStyle->init(); diff --git a/SofaGLFW/src/SofaGLFW/SofaGLFWGUI.cpp b/SofaGLFW/src/SofaGLFW/SofaGLFWGUI.cpp index b8a4d74704..0529bd4dd3 100644 --- a/SofaGLFW/src/SofaGLFW/SofaGLFWGUI.cpp +++ b/SofaGLFW/src/SofaGLFW/SofaGLFWGUI.cpp @@ -95,9 +95,9 @@ void SofaGLFWGUI::centerWindow() void SofaGLFWGUI::setViewerConfiguration(sofa::component::setting::ViewerSetting* viewerConf) { - const type::Vec<2, int>& res = viewerConf->resolution.getValue(); + const type::Vec<2, int>& res = viewerConf->d_resolution.getValue(); - if (viewerConf->fullscreen.getValue()) + if (viewerConf->d_fullscreen.getValue()) { m_bCreateWithFullScreen = true; } diff --git a/exe/Main.cpp b/exe/Main.cpp index 1094f3ef57..bdd157267b 100644 --- a/exe/Main.cpp +++ b/exe/Main.cpp @@ -105,13 +105,13 @@ int main(int argc, char** argv) groot->get(viewerConf, sofa::core::objectmodel::BaseContext::SearchRoot); if (viewerConf) { - if (viewerConf->fullscreen.getValue()) + if (viewerConf->d_fullscreen.getValue()) { isFullScreen = true; } else { - resolution = viewerConf->resolution.getValue(); + resolution = viewerConf->d_resolution.getValue(); } } @@ -137,10 +137,10 @@ int main(int argc, char** argv) groot->get(background, sofa::core::objectmodel::BaseContext::SearchRoot); if (background) { - if (background->image.getValue().empty()) - glfwGUI.setBackgroundColor(background->color.getValue()); + if (background->d_image.getValue().empty()) + glfwGUI.setBackgroundColor(background->d_color.getValue()); else - glfwGUI.setBackgroundImage(background->image.getFullPath()); + glfwGUI.setBackgroundImage(background->d_image.getFullPath()); } // Run the main loop From 98acaf1ed4cef51ec48f320c56f2dd9f33a57372 Mon Sep 17 00:00:00 2001 From: hugtalbot Date: Wed, 29 Jan 2025 22:01:47 +0100 Subject: [PATCH 2/7] Fix compilation further to lifecycle v25.06 --- SofaGLFW/src/SofaGLFW/SofaGLFWBaseGUI.cpp | 3 ++- SofaImGui/CMakeLists.txt | 2 ++ SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp | 2 +- SofaImGui/src/SofaImGui/windows/Plugins.cpp | 3 ++- SofaImGui/src/SofaImGui/windows/Settings.cpp | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/SofaGLFW/src/SofaGLFW/SofaGLFWBaseGUI.cpp b/SofaGLFW/src/SofaGLFW/SofaGLFWBaseGUI.cpp index 8b2a764380..f4296bd712 100644 --- a/SofaGLFW/src/SofaGLFW/SofaGLFWBaseGUI.cpp +++ b/SofaGLFW/src/SofaGLFW/SofaGLFWBaseGUI.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -513,7 +514,7 @@ void SofaGLFWBaseGUI::initVisual() if (!visualStyle) { visualStyle = sofa::core::objectmodel::New(); - visualStyle->setName(helper::NameDecoder::getShortName()); + visualStyle->setName(sofa::core::objectmodel::BaseClassNameHelper::getShortName()); DisplayFlags* displayFlags = visualStyle->d_displayFlags.beginEdit(); displayFlags->setShowVisualModels(tristate::true_value); diff --git a/SofaImGui/CMakeLists.txt b/SofaImGui/CMakeLists.txt index b21b591489..7b7e726ad2 100644 --- a/SofaImGui/CMakeLists.txt +++ b/SofaImGui/CMakeLists.txt @@ -46,6 +46,8 @@ FetchContent_Declare(simpleini ) FetchContent_MakeAvailable(simpleini) +set (CMAKE_CXX_STANDARD 20) + set(IMGUI_HEADER_FILES ${imgui_SOURCE_DIR}/backends/imgui_impl_glfw.h ${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.h diff --git a/SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp b/SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp index c00a7941b8..bfffaa5758 100644 --- a/SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp +++ b/SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp @@ -117,7 +117,7 @@ void ImGuiGUIEngine::init() ini.SetUnicode(); if (sofa::helper::system::FileSystem::exists(sofaimgui::AppIniFile::getAppIniFile())) { - SI_Error rc = ini.LoadFile(sofaimgui::AppIniFile::getAppIniFile().c_str()); + [[maybe_unused]] SI_Error rc = ini.LoadFile(sofaimgui::AppIniFile::getAppIniFile().c_str()); assert(rc == SI_OK); } diff --git a/SofaImGui/src/SofaImGui/windows/Plugins.cpp b/SofaImGui/src/SofaImGui/windows/Plugins.cpp index 9d08afcb16..f82e10adf0 100644 --- a/SofaImGui/src/SofaImGui/windows/Plugins.cpp +++ b/SofaImGui/src/SofaImGui/windows/Plugins.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -98,7 +99,7 @@ namespace windows ImGui::TextWrapped("%s", pluginIt->second.getModuleDescription()); ImGui::Spacing(); ImGui::TextDisabled("Components:"); - ImGui::TextWrapped("%s", pluginIt->second.getModuleComponentList()); + ImGui::TextWrapped("%s", sofa::core::ObjectFactory::getInstance()->listClassesFromTarget(pluginIt->second.getModuleName()).c_str()); ImGui::Spacing(); ImGui::TextDisabled("Path:"); ImGui::TextWrapped("%s", selectedPlugin.c_str()); diff --git a/SofaImGui/src/SofaImGui/windows/Settings.cpp b/SofaImGui/src/SofaImGui/windows/Settings.cpp index 989c190726..da54ed339d 100644 --- a/SofaImGui/src/SofaImGui/windows/Settings.cpp +++ b/SofaImGui/src/SofaImGui/windows/Settings.cpp @@ -58,7 +58,7 @@ namespace windows sofaimgui::setStyle(sofaimgui::listStyles[styleCurrent]); const auto style = sofaimgui::listStyles[styleCurrent]; ini.SetValue("Style", "theme", style, sofaimgui::ini::styleDescription); - SI_Error rc = ini.SaveFile(sofaimgui::AppIniFile::getAppIniFile().c_str()); + [[maybe_unused]] SI_Error rc = ini.SaveFile(sofaimgui::AppIniFile::getAppIniFile().c_str()); } if (isSelected) ImGui::SetItemDefaultFocus(); From 55aada7fa1e03abef94b1274b260f990d17250e4 Mon Sep 17 00:00:00 2001 From: hugtalbot Date: Wed, 29 Jan 2025 22:06:02 +0100 Subject: [PATCH 3/7] Remove un-needed CXX flag --- SofaImGui/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/SofaImGui/CMakeLists.txt b/SofaImGui/CMakeLists.txt index 7b7e726ad2..b21b591489 100644 --- a/SofaImGui/CMakeLists.txt +++ b/SofaImGui/CMakeLists.txt @@ -46,8 +46,6 @@ FetchContent_Declare(simpleini ) FetchContent_MakeAvailable(simpleini) -set (CMAKE_CXX_STANDARD 20) - set(IMGUI_HEADER_FILES ${imgui_SOURCE_DIR}/backends/imgui_impl_glfw.h ${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.h From 3d0b6a2b3b3be75e5a1d4e11bb9c6a59211c257c Mon Sep 17 00:00:00 2001 From: Paul Baksic <30337881+bakpaul@users.noreply.github.com> Date: Wed, 12 Feb 2025 02:24:01 +0100 Subject: [PATCH 4/7] Set compilation of plugins by default (#141) * Set compilation by default * Update ci.yml * Update ci.yml --- .github/workflows/ci.yml | 8 ++------ CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f6ca6a3a3..7322bbe4a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,7 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \ -DAPPLICATION_RUNSOFAGLFW=ON \ - -DPLUGIN_SOFAGLFW=ON \ + -DPLUGIN_SOFAIMGUI=OFF \ ../src \ && ninja -v install" else @@ -66,7 +66,7 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \ -DAPPLICATION_RUNSOFAGLFW=ON \ - -DPLUGIN_SOFAGLFW=ON \ + -DPLUGIN_SOFAIMGUI=OFF \ ../src ninja -v install echo ${CCACHE_BASEDIR} @@ -194,8 +194,6 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \ -DAPPLICATION_RUNSOFAGLFW=ON \ - -DPLUGIN_SOFAGLFW=ON \ - -DPLUGIN_SOFAIMGUI=ON \ ../src \ && ninja -v install" else @@ -209,8 +207,6 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \ -DAPPLICATION_RUNSOFAGLFW=ON \ - -DPLUGIN_SOFAGLFW=ON \ - -DPLUGIN_SOFAIMGUI=ON \ ../src ninja -v install echo ${CCACHE_BASEDIR} diff --git a/CMakeLists.txt b/CMakeLists.txt index 60e3999c09..e8ff80a0f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,6 @@ cmake_minimum_required(VERSION 3.12) find_package(Sofa.Config REQUIRED) -sofa_add_subdirectory(plugin SofaGLFW SofaGLFW) -sofa_add_subdirectory(plugin SofaImGui SofaImGui) +sofa_add_subdirectory(plugin SofaGLFW SofaGLFW ON) +sofa_add_subdirectory(plugin SofaImGui SofaImGui ON) sofa_add_subdirectory(application exe runSofaGLFW OFF) From 97e4dde67dcf27c45519960e13a89a2b35c55e23 Mon Sep 17 00:00:00 2001 From: Paul Baksic <30337881+bakpaul@users.noreply.github.com> Date: Wed, 12 Feb 2025 09:19:36 +0100 Subject: [PATCH 5/7] Set priotity to force Imgui as the default GUI (#149) --- SofaGLFW/src/SofaGLFW/initSofaGLFW.cpp | 2 +- SofaImGui/src/SofaImGui/initSofaImGui.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SofaGLFW/src/SofaGLFW/initSofaGLFW.cpp b/SofaGLFW/src/SofaGLFW/initSofaGLFW.cpp index 33d0edd81f..0d50c0e95b 100644 --- a/SofaGLFW/src/SofaGLFW/initSofaGLFW.cpp +++ b/SofaGLFW/src/SofaGLFW/initSofaGLFW.cpp @@ -47,7 +47,7 @@ void initExternalModule() { first = false; #if SOFAGLFW_HAVE_SOFA_GUI_COMMON - sofa::gui::common::GUIManager::RegisterGUI("glfw", &sofaglfw::SofaGLFWGUI::CreateGUI); + sofa::gui::common::GUIManager::RegisterGUI("glfw", &sofaglfw::SofaGLFWGUI::CreateGUI,nullptr,0); #endif // SOFAGLFW_HAVE_SOFA_GUI_COMMON } } diff --git a/SofaImGui/src/SofaImGui/initSofaImGui.cpp b/SofaImGui/src/SofaImGui/initSofaImGui.cpp index bbcc25c814..340993b2b3 100644 --- a/SofaImGui/src/SofaImGui/initSofaImGui.cpp +++ b/SofaImGui/src/SofaImGui/initSofaImGui.cpp @@ -48,7 +48,7 @@ void initExternalModule() sofa::helper::logging::MessageDispatcher::addHandler(&sofa::helper::logging::MainLoggingMessageHandler::getInstance()); sofa::helper::logging::MainLoggingMessageHandler::getInstance().activate(); - sofa::gui::common::GUIManager::RegisterGUI("imgui", &sofaimgui::ImGuiGUI::CreateGUI); + sofa::gui::common::GUIManager::RegisterGUI("imgui", &sofaimgui::ImGuiGUI::CreateGUI,nullptr,1); } } From 7d53ebf44c9632b8993fdcc07423e6ee07412d81 Mon Sep 17 00:00:00 2001 From: hugtalbot Date: Wed, 12 Feb 2025 15:45:46 +0100 Subject: [PATCH 6/7] remove changes unrelated to the PR --- SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp | 2 +- SofaImGui/src/SofaImGui/windows/Settings.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp b/SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp index bfffaa5758..c00a7941b8 100644 --- a/SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp +++ b/SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp @@ -117,7 +117,7 @@ void ImGuiGUIEngine::init() ini.SetUnicode(); if (sofa::helper::system::FileSystem::exists(sofaimgui::AppIniFile::getAppIniFile())) { - [[maybe_unused]] SI_Error rc = ini.LoadFile(sofaimgui::AppIniFile::getAppIniFile().c_str()); + SI_Error rc = ini.LoadFile(sofaimgui::AppIniFile::getAppIniFile().c_str()); assert(rc == SI_OK); } diff --git a/SofaImGui/src/SofaImGui/windows/Settings.cpp b/SofaImGui/src/SofaImGui/windows/Settings.cpp index da54ed339d..989c190726 100644 --- a/SofaImGui/src/SofaImGui/windows/Settings.cpp +++ b/SofaImGui/src/SofaImGui/windows/Settings.cpp @@ -58,7 +58,7 @@ namespace windows sofaimgui::setStyle(sofaimgui::listStyles[styleCurrent]); const auto style = sofaimgui::listStyles[styleCurrent]; ini.SetValue("Style", "theme", style, sofaimgui::ini::styleDescription); - [[maybe_unused]] SI_Error rc = ini.SaveFile(sofaimgui::AppIniFile::getAppIniFile().c_str()); + SI_Error rc = ini.SaveFile(sofaimgui::AppIniFile::getAppIniFile().c_str()); } if (isSelected) ImGui::SetItemDefaultFocus(); From 33e920973e892913840aeace01cd031024745605 Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 12 Feb 2025 16:02:23 +0100 Subject: [PATCH 7/7] Apply suggestions from code review --- exe/Main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/exe/Main.cpp b/exe/Main.cpp index 0638537556..09e8c71043 100644 --- a/exe/Main.cpp +++ b/exe/Main.cpp @@ -138,7 +138,6 @@ int main(int argc, char** argv) if (background) { if (background->d_image.getValue().empty()) - glfwGUI.setWindowBackgroundColor(background->d_color.getValue()); else glfwGUI.setWindowBackgroundImage(background->d_image.getFullPath());