Skip to content

Commit 518a52d

Browse files
authored
[examples] Use pluginName for RequiredPlugin (#602)
1 parent ada5769 commit 518a52d

9 files changed

Lines changed: 22 additions & 44 deletions

File tree

examples/CCDIntersection.py

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,15 @@ def createScene(root_node):
2020

2121
plugins = root_node.addChild('plugins')
2222

23-
plugins.addObject('RequiredPlugin', name="MultiThreading")
24-
plugins.addObject('RequiredPlugin', name="Sofa.Component.AnimationLoop")
25-
plugins.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Algorithm")
26-
plugins.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Intersection")
27-
plugins.addObject('RequiredPlugin', name="Sofa.Component.Collision.Geometry")
28-
plugins.addObject('RequiredPlugin', name="Sofa.Component.Collision.Response.Contact")
29-
plugins.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Lagrangian.Correction")
30-
plugins.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Lagrangian.Solver")
31-
plugins.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh")
32-
plugins.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Direct")
33-
plugins.addObject('RequiredPlugin', name="Sofa.Component.Mapping.Linear")
34-
plugins.addObject('RequiredPlugin', name="Sofa.Component.Mass")
35-
plugins.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
36-
plugins.addObject('RequiredPlugin', name="Sofa.Component.SolidMechanics.FEM.Elastic")
37-
plugins.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
38-
plugins.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Dynamic")
39-
plugins.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Grid")
40-
plugins.addObject('RequiredPlugin', name="Sofa.Component.Topology.Mapping")
41-
plugins.addObject('RequiredPlugin', name="Sofa.Component.Visual")
42-
plugins.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
43-
plugins.addObject('RequiredPlugin', name="Sofa.Component.Engine.Select")
44-
plugins.addObject('RequiredPlugin', name="Sofa.GUI.Component")
23+
plugins.addObject('RequiredPlugin', pluginName=["MultiThreading", "Sofa.Component.AnimationLoop",
24+
"Sofa.Component.Collision.Detection.Algorithm", "Sofa.Component.Collision.Detection.Intersection",
25+
"Sofa.Component.Collision.Geometry", "Sofa.Component.Collision.Response.Contact",
26+
"Sofa.Component.Constraint.Lagrangian.Correction", "Sofa.Component.Constraint.Lagrangian.Solver",
27+
"Sofa.Component.IO.Mesh", "Sofa.Component.LinearSolver.Direct", "Sofa.Component.Mapping.Linear",
28+
"Sofa.Component.Mass", "Sofa.Component.ODESolver.Backward", "Sofa.Component.SolidMechanics.FEM.Elastic",
29+
"Sofa.Component.StateContainer", "Sofa.Component.Topology.Container.Dynamic",
30+
"Sofa.Component.Topology.Container.Grid", "Sofa.Component.Topology.Mapping", "Sofa.Component.Visual",
31+
"Sofa.GL.Component.Rendering3D", "Sofa.Component.Engine.Select", "Sofa.GUI.Component"])
4532

4633
root_node.addObject('VisualStyle', displayFlags="showVisual")
4734
root_node.addObject('ConstraintAttachButtonSetting')

examples/access_matrix.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,16 @@ def createScene(root):
2727

2828
root.addObject('VisualStyle', displayFlags="showBehaviorModels showForceFields")
2929

30-
root.addObject("RequiredPlugin", pluginName=['Sofa.Component.Mass',
31-
'Sofa.Component.StateContainer',
32-
'Sofa.Component.Topology.Container.Grid',
33-
'Sofa.Component.Visual'
30+
root.addObject("RequiredPlugin", pluginName=['Sofa.Component.Mass', 'Sofa.Component.StateContainer',
31+
'Sofa.Component.Topology.Container.Grid', 'Sofa.Component.Visual',
32+
'Sofa.Component.Constraint.Projective', 'Sofa.Component.Engine.Select',
33+
'Sofa.Component.LinearSolver.Direct', 'Sofa.Component.LinearSystem',
34+
'Sofa.Component.ODESolver.Backward','Sofa.Component.SolidMechanics.FEM.Elastic'
3435
])
3536

3637
root.addObject('DefaultAnimationLoop', parallelODESolving=True)
3738
root.addObject('DefaultVisualManagerLoop')
3839

39-
plugins = root.addChild('plugins')
40-
plugins.addObject('RequiredPlugin', name='Sofa.Component.Constraint.Projective')
41-
plugins.addObject('RequiredPlugin', name='Sofa.Component.Engine.Select')
42-
plugins.addObject('RequiredPlugin', name='Sofa.Component.LinearSolver.Direct')
43-
plugins.addObject('RequiredPlugin', name='Sofa.Component.LinearSystem')
44-
plugins.addObject('RequiredPlugin', name='Sofa.Component.ODESolver.Backward')
45-
plugins.addObject('RequiredPlugin', name='Sofa.Component.SolidMechanics.FEM.Elastic')
46-
4740
node_crs = createBeam(root, 'CompressedRowSparseMatrixMat3x3d')
4841
node_crs.addObject('SparseLDLSolver', template="CompressedRowSparseMatrixMat3x3d")
4942

examples/additional-examples/pygame_example.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ def simple_render(rootNode):
5353
def createScene(root):
5454
# Register all the common component in the factory.
5555
SofaRuntime.PluginRepository.addFirstPath(os.path.join(sofa_directory, 'bin'))
56-
root.addObject("RequiredPlugin", name="Sofa.Component")
57-
root.addObject("RequiredPlugin", name="Sofa.GL.Component")
56+
root.addObject("RequiredPlugin", pluginName=["Sofa.Component", "Sofa.GL.Component"])
5857

5958
### these are just some things that stay still and move around
6059
# so you know the animation is actually happening

examples/basic-addGUI.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def main():
3636
# Function called when the scene graph is being created
3737
def createScene(root):
3838

39-
root.addObject('RequiredPlugin', name='Sofa.Component.StateContainer')
39+
root.addObject('RequiredPlugin', pluginName='Sofa.Component.StateContainer')
4040

4141
# Scene must now include a AnimationLoop
4242
root.addObject('DefaultAnimationLoop')

examples/basic-useQtGUI.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def main():
3737
# Function called when the scene graph is being created
3838
def createScene(root):
3939

40-
root.addObject('RequiredPlugin', name='Sofa.Component.StateContainer')
40+
root.addObject('RequiredPlugin', pluginName='Sofa.Component.StateContainer')
4141

4242
# Scene must now include a AnimationLoop
4343
root.addObject('DefaultAnimationLoop')

examples/basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def main():
2525
# Function called when the scene graph is being created
2626
def createScene(root):
2727

28-
root.addObject('RequiredPlugin', name='Sofa.Component.StateContainer')
28+
root.addObject('RequiredPlugin', pluginName='Sofa.Component.StateContainer')
2929

3030
# Scene must now include a AnimationLoop
3131
root.addObject('DefaultAnimationLoop')

examples/loadXMLfromPython.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ def createScene(root):
77
# Call the above function to create the scene graph
88
scene="""
99
<Node dt="0.005" gravity="0 0 0">
10-
<RequiredPlugin name="Sofa.GL.Component.Rendering2D" />
11-
<RequiredPlugin name="Sofa.Component.StateContainer" />
10+
<RequiredPlugin pluginName="Sofa.GL.Component.Rendering2D" />
11+
<RequiredPlugin pluginName="Sofa.Component.StateContainer" />
1212
1313
<Node name="child1">
1414
<MechanicalObject template="Rigid3d" position="0 0 0 0 0 0 1" showObject="1"/>

examples/pointSetTopologyModifier.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ def createScene(root):
88

99
root.addObject("DefaultAnimationLoop")
1010
root.addObject("DefaultVisualManagerLoop")
11-
root.addObject("RequiredPlugin", name="Sofa.Component.Topology.Container.Dynamic")
12-
root.addObject('RequiredPlugin', name='Sofa.Component.StateContainer')
11+
root.addObject("RequiredPlugin", pluginName=["Sofa.Component.Topology.Container.Dynamic", "Sofa.Component.StateContainer"])
1312

1413
container = root.addObject("PointSetTopologyContainer", points=[[0, 0, 0], [1, 0, 0]])
1514
modifier = root.addObject("PointSetTopologyModifier")

examples/scene_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def main():
2020
# Function called when the scene graph is being created
2121
def createScene(root):
2222

23-
root.addObject('RequiredPlugin', name='Sofa.Component.StateContainer')
23+
root.addObject('RequiredPlugin', pluginName='Sofa.Component.StateContainer')
2424

2525
# Scene must now include a AnimationLoop
2626
root.addObject('DefaultAnimationLoop')

0 commit comments

Comments
 (0)