diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index b608b482c..6862def2b 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -30,7 +30,7 @@ jobs: - name: Download SOFA nightly build run: | curl --output sofa.zip -L \ - https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries-v20.12/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/MacOS/*zip*/MacOS.zip + https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/MacOS/*zip*/MacOS.zip - name: Install SOFA nightly build run: | @@ -108,7 +108,7 @@ jobs: - name: Download SOFA nightly build run: | curl --output sofa.zip -L \ - https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries-v20.12/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/MacOS/*zip*/MacOS.zip + https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/MacOS/*zip*/MacOS.zip - name: Install SOFA nightly build run: | diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index e158aaf98..41d5455e8 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -45,7 +45,7 @@ jobs: - name: Download SOFA nightly build run: | curl --output sofa.zip -L \ - https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries-v20.12/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/Linux/*zip*/Linux.zip + https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/Linux/*zip*/Linux.zip - name: Install SOFA nightly build run: | @@ -123,7 +123,7 @@ jobs: - name: Download SOFA nightly build run: | curl --output sofa.zip -L \ - https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries-v20.12/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/Linux/*zip*/Linux.zip + https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/Linux/*zip*/Linux.zip - name: Install SOFA nightly build run: | diff --git a/Plugin/CMakeLists.txt b/Plugin/CMakeLists.txt index df66d3200..3a09b927e 100644 --- a/Plugin/CMakeLists.txt +++ b/Plugin/CMakeLists.txt @@ -36,7 +36,7 @@ endif(SP3_BUILD_TEST) find_package(pybind11 CONFIG REQUIRED) find_package(SofaFramework REQUIRED) -find_package(SofaSimulation REQUIRED) +find_package(SofaSimulationGraph REQUIRED) add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) add_library(SofaPython3::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) diff --git a/Plugin/PluginConfig.cmake.in b/Plugin/PluginConfig.cmake.in index 50b01f8b9..27e17a8e8 100644 --- a/Plugin/PluginConfig.cmake.in +++ b/Plugin/PluginConfig.cmake.in @@ -4,7 +4,7 @@ find_package(pybind11 CONFIG REQUIRED) find_package(SofaFramework REQUIRED) -find_package(SofaSimulation REQUIRED) +find_package(SofaSimulationGraph REQUIRED) # If we are importing this config file and the target is not yet there this is indicating that # target is an imported one. So we include it diff --git a/Plugin/src/SofaPython3/PythonEnvironment.h b/Plugin/src/SofaPython3/PythonEnvironment.h index f74e968f8..7c2a5d755 100644 --- a/Plugin/src/SofaPython3/PythonEnvironment.h +++ b/Plugin/src/SofaPython3/PythonEnvironment.h @@ -22,7 +22,7 @@ #include #include - +#include /// Fixes compile errors: /// removing all slots macros is necessary if embedded in a Qt project diff --git a/Plugin/src/SofaPython3/SceneLoaderPY3.cpp b/Plugin/src/SofaPython3/SceneLoaderPY3.cpp index 1651b020c..4edc79253 100644 --- a/Plugin/src/SofaPython3/SceneLoaderPY3.cpp +++ b/Plugin/src/SofaPython3/SceneLoaderPY3.cpp @@ -33,9 +33,11 @@ using sofa::simulation::graph::DAGNode; #include namespace py = pybind11; -using namespace sofa::core::objectmodel; +#include using sofa::helper::system::SetDirectory; +using namespace sofa::core::objectmodel; + MSG_REGISTER_CLASS(sofapython3::SceneLoaderPY3, "SofaPython3::SceneLoader") PYBIND11_DECLARE_HOLDER_TYPE(Base, sofa::core::sptr, true) diff --git a/bindings/BindingsConfig.cmake.in b/bindings/BindingsConfig.cmake.in index 2676b1514..42e41b64c 100644 --- a/bindings/BindingsConfig.cmake.in +++ b/bindings/BindingsConfig.cmake.in @@ -18,10 +18,14 @@ find_package(SofaDeformable REQUIRED) # Required by the bindings Sofa.Components, Sofa.Core, Sofa.Helper, Sofa.Simulation, Sofa.Types, SofaGui find_package(SofaFramework REQUIRED) -# Required by the bindings Sofa.Core, Sofa.Simulation, SofaRuntime -find_package(SofaSimulation REQUIRED) +# Required by the bindings Sofa.Simulation, SofaRuntime +find_package(SofaSimulationGraph REQUIRED) + +# Required by the bindings SofaRuntime +find_package(SofaSimulationCommon REQUIRED) # Required by the bindings SofaGui +find_package(Sofa.GL QUIET) find_package(SofaGui REQUIRED) # Required by the bindings Sofa.Core diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseObject.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseObject.cpp index 6bd48a9c5..9880ec666 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseObject.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_BaseObject.cpp @@ -29,6 +29,7 @@ // Imports for getCategories #include #include +#include #include #include #include diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ForceField.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ForceField.cpp index dbef23548..fa3c9f8ee 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ForceField.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_ForceField.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include using sofapython3::PythonEnvironment; diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_PythonScriptEvent.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_PythonScriptEvent.cpp index 70712d4d5..5ac62a4f3 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_PythonScriptEvent.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_PythonScriptEvent.cpp @@ -21,6 +21,7 @@ #include #include #include +#include /// Makes an alias for the pybind11 namespace to increase readability. namespace py { using namespace pybind11; } @@ -30,7 +31,7 @@ using namespace pybind11::literals; SOFA_EVENT_CPP(PythonScriptEvent) -PythonScriptEvent::PythonScriptEvent(sofa::simulation::Node::SPtr sender, const char* eventName, py::object userData) +PythonScriptEvent::PythonScriptEvent(sofa::core::sptr sender, const char* eventName, py::object userData) : sofa::core::objectmodel::ScriptEvent(sender,eventName) , m_userData(userData){} diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_PythonScriptEvent.h b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_PythonScriptEvent.h index fec66daec..a9c5e8344 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_PythonScriptEvent.h +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_PythonScriptEvent.h @@ -22,6 +22,7 @@ #include #include +#include #include @@ -32,7 +33,7 @@ class PythonScriptEvent : public sofa::core::objectmodel::ScriptEvent { SOFA_EVENT_H(PythonScriptEvent) public: - PythonScriptEvent(sofa::simulation::Node::SPtr sender, const char* eventName, pybind11::object userData=pybind11::none()); + PythonScriptEvent(sofa::core::sptr sender, const char* eventName, pybind11::object userData=pybind11::none()); ~PythonScriptEvent() override; pybind11::object getUserData() const { return m_userData; } inline static const char* GetClassName() { return "PythonScriptEvent"; } diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Core/CMakeLists.txt b/bindings/Sofa/src/SofaPython3/Sofa/Core/CMakeLists.txt index 0a1fb34fe..09d1c956a 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Core/CMakeLists.txt +++ b/bindings/Sofa/src/SofaPython3/Sofa/Core/CMakeLists.txt @@ -70,7 +70,6 @@ if (NOT TARGET SofaPython3::Plugin) endif() find_package(SofaFramework REQUIRED) -find_package(SofaSimulation REQUIRED) find_package(SofaBaseCollision REQUIRED) find_package(SofaBaseVisual REQUIRED) find_package(SofaBaseUtils REQUIRED) diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Simulation/CMakeLists.txt b/bindings/Sofa/src/SofaPython3/Sofa/Simulation/CMakeLists.txt index 1cd7bbd8b..f15f819e6 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Simulation/CMakeLists.txt +++ b/bindings/Sofa/src/SofaPython3/Sofa/Simulation/CMakeLists.txt @@ -13,7 +13,7 @@ if (NOT TARGET SofaPython3::Plugin) endif() find_package(SofaFramework REQUIRED) -find_package(SofaSimulation REQUIRED) +find_package(SofaSimulationGraph REQUIRED) SP3_add_python_module( TARGET ${PROJECT_NAME} diff --git a/bindings/Sofa/src/SofaPython3/Sofa/Simulation/Submodule_Simulation.cpp b/bindings/Sofa/src/SofaPython3/Sofa/Simulation/Submodule_Simulation.cpp index e83bb18b1..bd3825244 100644 --- a/bindings/Sofa/src/SofaPython3/Sofa/Simulation/Submodule_Simulation.cpp +++ b/bindings/Sofa/src/SofaPython3/Sofa/Simulation/Submodule_Simulation.cpp @@ -21,11 +21,13 @@ #include #include +#include using sofa::simulation::Simulation; #include using sofa::simulation::graph::DAGSimulation; +#include using sofa::simulation::Node; using namespace pybind11::literals; diff --git a/bindings/SofaGui/CMakeLists.txt b/bindings/SofaGui/CMakeLists.txt index 2ebe32f9b..7b3865d32 100644 --- a/bindings/SofaGui/CMakeLists.txt +++ b/bindings/SofaGui/CMakeLists.txt @@ -22,5 +22,5 @@ SP3_add_python_module( DESTINATION Sofa SOURCES ${SOURCE_FILES} HEADERS ${HEADER_FILES} - DEPENDS SofaCore SofaGuiCommon SofaGuiMain SofaPython3::Plugin SofaPython3::Bindings.Sofa.Core + DEPENDS SofaCore SofaGuiCommon SofaGui SofaPython3::Plugin SofaPython3::Bindings.Sofa.Core ) diff --git a/bindings/SofaGui/src/SofaPython3/SofaGui/Binding_GUIManager.cpp b/bindings/SofaGui/src/SofaPython3/SofaGui/Binding_GUIManager.cpp index ae156cd39..12a5d648c 100644 --- a/bindings/SofaGui/src/SofaPython3/SofaGui/Binding_GUIManager.cpp +++ b/bindings/SofaGui/src/SofaPython3/SofaGui/Binding_GUIManager.cpp @@ -23,6 +23,7 @@ #include #include #include +#include /// Makes an alias for the pybind11 namespace to increase readability. namespace py { using namespace pybind11; } diff --git a/bindings/SofaGui/src/SofaPython3/SofaGui/Module_SofaGui.cpp b/bindings/SofaGui/src/SofaPython3/SofaGui/Module_SofaGui.cpp index 16872c1d3..0ec7a1e54 100644 --- a/bindings/SofaGui/src/SofaPython3/SofaGui/Module_SofaGui.cpp +++ b/bindings/SofaGui/src/SofaPython3/SofaGui/Module_SofaGui.cpp @@ -20,7 +20,7 @@ #include -#include +#include #include #include "Binding_BaseGui.h" @@ -57,7 +57,7 @@ PYBIND11_MODULE(Gui, m) { // This is needed to make sure the GuiMain library (libSofaGuiMain.so) is correctly // linked since the GUIs are statically created during the load of the library. - sofa::gui::initMain(); + sofa::gui::initSofaGui(); sofa::core::init(); moduleAddBaseGui(m); diff --git a/bindings/SofaRuntime/CMakeLists.txt b/bindings/SofaRuntime/CMakeLists.txt index 1ebd68976..6a81bd40e 100644 --- a/bindings/SofaRuntime/CMakeLists.txt +++ b/bindings/SofaRuntime/CMakeLists.txt @@ -10,7 +10,8 @@ set(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/SofaPython3/SofaRuntime/Timer/Submodule_Timer_doc.h ) -find_package(SofaSimulation REQUIRED) +find_package(SofaSimulationGraph REQUIRED) +find_package(SofaSimulationCommon REQUIRED) SP3_add_python_package( SOURCE_DIRECTORY diff --git a/bindings/SofaRuntime/src/SofaPython3/SofaRuntime/Timer/Submodule_Timer.cpp b/bindings/SofaRuntime/src/SofaPython3/SofaRuntime/Timer/Submodule_Timer.cpp index 8e375197b..96c8497f2 100644 --- a/bindings/SofaRuntime/src/SofaPython3/SofaRuntime/Timer/Submodule_Timer.cpp +++ b/bindings/SofaRuntime/src/SofaPython3/SofaRuntime/Timer/Submodule_Timer.cpp @@ -19,11 +19,13 @@ ******************************************************************************/ #include +#include using sofa::helper::AdvancedTimer; #include "Submodule_Timer.h" #include "Submodule_Timer_doc.h" +#include namespace sofapython3 { diff --git a/bindings/SofaTypes/src/SofaPython3/SofaTypes/Binding_Vec.cpp b/bindings/SofaTypes/src/SofaPython3/SofaTypes/Binding_Vec.cpp index 36041b642..c89240a9f 100644 --- a/bindings/SofaTypes/src/SofaPython3/SofaTypes/Binding_Vec.cpp +++ b/bindings/SofaTypes/src/SofaPython3/SofaTypes/Binding_Vec.cpp @@ -21,6 +21,8 @@ #include "Binding_Vec.h" #include #include +#include +using sofa::type::Vec; #define BINDING_VEC_MAKE_NAME(N, T) \ std::string(std::string("Vec") + std::to_string(N) + typeid(T).name()) @@ -188,7 +190,7 @@ py::class_> addVec(py::module &m) p.def("normalized", &VecClass::normalized); p.def("sum", &VecClass::sum); p.def("dot", [](const VecClass &self, const VecClass &b) { - return sofa::defaulttype::dot(self, b); + return sofa::type::dot(self, b); }); @@ -217,7 +219,15 @@ T addCross(T p) { p.def("cross", [](typename T::type& a, typename T::type& b) { - return sofa::defaulttype::cross(a,b); + if constexpr (T::type::spatial_dimensions == 2 || T::type::spatial_dimensions == 3) + { + return sofa::type::cross(a, b); + } + else + { + // can only call cross with vec2 or vec3 + return T(); + } }); return p; } diff --git a/bindings/SofaTypes/src/SofaPython3/SofaTypes/Binding_Vec.h b/bindings/SofaTypes/src/SofaPython3/SofaTypes/Binding_Vec.h index 47d7ceb53..6e1981f83 100644 --- a/bindings/SofaTypes/src/SofaPython3/SofaTypes/Binding_Vec.h +++ b/bindings/SofaTypes/src/SofaPython3/SofaTypes/Binding_Vec.h @@ -23,12 +23,15 @@ namespace py = pybind11; using namespace pybind11::literals; -#include -using sofa::defaulttype::Vec; +#include +namespace sofa::type { +template +class Vec; +} namespace pyVec { -template -std::string __str__(const Vec &self, bool repr = false); +template +std::string __str__(const sofa::type::Vec &self, bool repr = false); } // namespace pyVec void moduleAddVec(py::module &m);