Skip to content

Commit

Permalink
[examples] Use initRoot instead of init (#476)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugtalbot authored Jan 8, 2025
1 parent 9d01d90 commit 6376097
Show file tree
Hide file tree
Showing 16 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion examples/ReadTheDocs_Example.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def createScene(rootNode):

rootNode.bbox = [[-1, -1, -1],[1,1,1]]

rootNode.addObject("RequiredPlugin", pluginName=[ 'Sofa.Component.AnimationLoop',
rootNode.addObject("RequiredPlugin", pluginName=['Sofa.Component.AnimationLoop',
'Sofa.Component.Collision.Detection.Algorithm',
'Sofa.Component.Collision.Detection.Intersection',
'Sofa.Component.Collision.Geometry',
Expand Down
2 changes: 1 addition & 1 deletion examples/additional-examples/ControllerScene.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def main():
# Create and initialize the scene
root = Sofa.Core.Node()
createScene(root)
Sofa.Simulation.init(root)
Sofa.Simulation.initRoot(root)

# Run simulation
for i in range(0, 360):
Expand Down
2 changes: 1 addition & 1 deletion examples/additional-examples/pygame_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def createScene(root):
if __name__ == '__main__':
root = Sofa.Core.Node("myroot")
createScene(root)
Sofa.Simulation.init(root)
Sofa.Simulation.initRoot(root)
init_display(root)
try:
while True:
Expand Down
2 changes: 1 addition & 1 deletion examples/additional-examples/pyqt_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def __init__(self):

def init_sim(self):
# start the simulator
Sofa.Simulation.init(self.root)
Sofa.Simulation.initRoot(self.root)

def step_sim(self):
self.visuals.camera.position = self.visuals.camera.position + [-0.0002, 0, 0]
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced_timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def createScene(root):
def main():
root = Sofa.Core.Node("root")
createScene(root)
Sofa.Simulation.init(root)
Sofa.Simulation.initRoot(root)

# Run the simulation for 5 steps
for iteration in range(5):
Expand Down
2 changes: 1 addition & 1 deletion examples/basic-addGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def main():
root = Sofa.Core.Node("root")
# Call the below 'createScene' function to create the scene graph
createScene(root)
Sofa.Simulation.init(root)
Sofa.Simulation.initRoot(root)

if not USE_GUI:
for iteration in range(10):
Expand Down
2 changes: 1 addition & 1 deletion examples/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def main():
createScene(root)

# Once defined, initialization of the scene graph
Sofa.Simulation.init(root)
Sofa.Simulation.initRoot(root)

# Run the simulation for 10 steps
for iteration in range(10):
Expand Down
1 change: 1 addition & 0 deletions examples/emptyController.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def main():

root=Sofa.Core.Node("root")
createScene(root)
Sofa.Simulation.initRoot(root)

Sofa.Gui.GUIManager.Init("myscene", "qglviewer")
Sofa.Gui.GUIManager.createGUI(root, __file__)
Expand Down
2 changes: 1 addition & 1 deletion examples/emptyDataEngine.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def main():

root=Sofa.Core.Node("root")
createScene(root)
Sofa.Simulation.init(root)
Sofa.Simulation.initRoot(root)

Sofa.Gui.GUIManager.Init("myscene", "qglviewer")
Sofa.Gui.GUIManager.createGUI(root, __file__)
Expand Down
2 changes: 1 addition & 1 deletion examples/emptyForceField.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def main():

root=Sofa.Core.Node("root")
createScene(root)
Sofa.Simulation.init(root)
Sofa.Simulation.initRoot(root)

Sofa.Gui.GUIManager.Init("myscene", "qglviewer")
Sofa.Gui.GUIManager.createGUI(root, __file__)
Expand Down
2 changes: 1 addition & 1 deletion examples/example-forcefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def main():

root=Sofa.Core.Node("root")
createScene(root)
Sofa.Simulation.init(root)
Sofa.Simulation.initRoot(root)

Sofa.Gui.GUIManager.Init("myscene", "qglviewer")
Sofa.Gui.GUIManager.createGUI(root, __file__)
Expand Down
2 changes: 1 addition & 1 deletion examples/liver-scriptcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def main():

root = Sofa.Core.Node("root")
createScene(root)
Sofa.Simulation.init(root)
Sofa.Simulation.initRoot(root)

if not USE_GUI:
for iteration in range(10):
Expand Down
2 changes: 1 addition & 1 deletion examples/liver.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def main():

root = Sofa.Core.Node("root")
createScene(root)
Sofa.Simulation.init(root)
Sofa.Simulation.initRoot(root)

if not USE_GUI:
for iteration in range(10):
Expand Down
2 changes: 1 addition & 1 deletion examples/loadXMLfromPython.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def main():

root = Sofa.Core.Node("root")
createScene(root)
Sofa.Simulation.init(root)
Sofa.Simulation.initRoot(root)

# Find out the supported GUIs
print ("Supported GUIs are: " + Sofa.Gui.GUIManager.ListSupportedGUI(","))
Expand Down
1 change: 0 additions & 1 deletion examples/springForceField.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def createScene(root):
])



root.addObject('DefaultAnimationLoop')

surface_node = root.addChild('Surface')
Expand Down
2 changes: 1 addition & 1 deletion examples/taskScheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def createScene(root):
def main():
root = Sofa.Core.Node("root")
createScene(root)
Sofa.Simulation.init(root)
Sofa.Simulation.initRoot(root)

for nb_threads in range(1, TaskScheduler.GetHardwareThreadsCount() + 1):
print(f'Number of threads #{nb_threads}')
Expand Down

0 comments on commit 6376097

Please sign in to comment.