@@ -52,22 +52,9 @@ namespace py = pybind11;
5252namespace sofapython3
5353{
5454
55- PYBIND11_MODULE (Simulation, simulation )
55+ void initRoot (Node* n, bool enableSceneChecking = true )
5656{
57- // These are needed to force the dynamic loading of module dependencies (found in CMakeLists.txt)
58- sofa::core::init ();
59- sofa::simulation::core::init ();
60- sofa::simulation::graph::init ();
61-
62- simulation.doc () =sofapython3::doc::simulation::Class;
63-
64- moduleAddSceneCheck (simulation);
65- moduleAddSceneCheckMainRegistry (simulation);
66-
67- simulation.def (" print" , [](Node* n){ sofa::simulation::node::print (n); }, sofapython3::doc::simulation::print);
68- simulation.def (" animate" , [](Node* n, SReal dt=0.0 ){ sofa::simulation::node::animate (n, dt); },sofapython3::doc::simulation::animate);
69- simulation.def (" init" , [](Node* n){ sofa::simulation::node::init (n); }, sofapython3::doc::simulation::init);
70- simulation.def (" initRoot" , [](Node* n)
57+ if (enableSceneChecking)
7158 {
7259 auto & pluginManager = sofa::helper::system::PluginManager::getInstance ();
7360 auto res = pluginManager.loadPlugin (" SceneChecking" );
@@ -86,8 +73,28 @@ PYBIND11_MODULE(Simulation, simulation)
8673 {
8774 msg_warning (" Could not load SceneChecking, no scene check will be performed." );
8875 }
89- sofa::simulation::node::initRoot (n);
90- }, sofapython3::doc::simulation::initRoot);
76+ }
77+ sofa::simulation::node::initRoot (n);
78+ }
79+
80+ PYBIND11_MODULE (Simulation, simulation)
81+ {
82+ // These are needed to force the dynamic loading of module dependencies (found in CMakeLists.txt)
83+ sofa::core::init ();
84+ sofa::simulation::core::init ();
85+ sofa::simulation::graph::init ();
86+
87+ simulation.doc () =sofapython3::doc::simulation::Class;
88+
89+ moduleAddSceneCheck (simulation);
90+ moduleAddSceneCheckMainRegistry (simulation);
91+
92+ simulation.def (" print" , [](Node* n){ sofa::simulation::node::print (n); }, sofapython3::doc::simulation::print);
93+ simulation.def (" animate" , [](Node* n, SReal dt=0.0 ){ sofa::simulation::node::animate (n, dt); },sofapython3::doc::simulation::animate);
94+ simulation.def (" init" , [](Node* n){ sofa::simulation::node::init (n); }, sofapython3::doc::simulation::init);
95+ simulation.def (" initRoot" , [](Node* n) {initRoot ( n, true );}, sofapython3::doc::simulation::initRoot);
96+ simulation.def (" initRoot" , [](Node* n, bool enableSceneChecking) {initRoot ( n, enableSceneChecking );}, sofapython3::doc::simulation::initRoot);
97+
9198 simulation.def (" initVisual" , [](Node* n){ n->getVisualLoop ()->initStep (sofa::core::visual::VisualParams::defaultInstance ()); }, sofapython3::doc::simulation::initVisual);
9299 simulation.def (" reset" , [](Node* n){ sofa::simulation::node::reset (n); }, sofapython3::doc::simulation::reset);
93100
0 commit comments