You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to run SOFA from a Python interpreter (no runSofa). The usual way is the following code:
importSofaimportSofa.Guiroot=Sofa.Core.Node("root") # Generate the root node scene_lib.createScene(root, config) # Create the scene graphSofa.Simulation.init(root) # Initialization of the scene graphSofa.Gui.GUIManager.Init("myscene", "imgui")
Sofa.Gui.GUIManager.createGUI(root, __file__)
Sofa.Gui.GUIManager.SetDimension(1080, 1080)
Sofa.Gui.GUIManager.MainLoop(root)
But nothing happens and no GUI appears. The script ends without error.
I added the following message: #69, to find out that the root node is not given to the GUI. Hence the GUI cannot run.
In other GUIs, the root node is given to the GUI in the Sofa.Gui.GUIManager.createGUI function, via setScene. But in ImGuiGUI::CreateGUI, setScene is not called. I tried to add it, but it has side effects and it is too early for them, leading to a crash.
A workaround is to explicitly call setScene in the python script:
importSofaimportSofa.Guiroot=Sofa.Core.Node("root") # Generate the root node scene_lib.createScene(root, config) # Create the scene graphSofa.Simulation.init(root) # Initialization of the scene graphSofa.Gui.GUIManager.Init("myscene", "imgui")
Sofa.Gui.GUIManager.createGUI(root, __file__)
Sofa.Gui.GUIManager.SetDimension(1080, 1080)
Sofa.Gui.GUIManager.SetScene(root, __file__) # <---------------------------- HERESofa.Gui.GUIManager.MainLoop(root)
It would be nice to have consistency with the other GUIs.
The text was updated successfully, but these errors were encountered:
I was trying to run SOFA from a Python interpreter (no
runSofa
). The usual way is the following code:But nothing happens and no GUI appears. The script ends without error.
I added the following message: #69, to find out that the root node is not given to the GUI. Hence the GUI cannot run.
In other GUIs, the root node is given to the GUI in the
Sofa.Gui.GUIManager.createGUI
function, viasetScene
. But inImGuiGUI::CreateGUI
,setScene
is not called. I tried to add it, but it has side effects and it is too early for them, leading to a crash.A workaround is to explicitly call
setScene
in the python script:It would be nice to have consistency with the other GUIs.
The text was updated successfully, but these errors were encountered: