Skip to content

Commit 1c253e4

Browse files
committed
improve example.
1 parent 81cff26 commit 1c253e4

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

examples/example-drawing-controller.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from numpy import array
55
from Sofa.Types import RGBAColor
66

7-
87
class DrawingExamples(Sofa.Core.Controller):
98
def __init__(self, *args, **kwargs):
109
# These are needed (and the normal way to override from a python class)
@@ -16,16 +15,6 @@ def __init__(self, *args, **kwargs):
1615
def draw(self, visual_context):
1716
dt = visual_context.getDrawTool()
1817

19-
dt.disableLighting()
20-
dt.drawPoints(array([[-1.5,-1.0,0.0]]), 5.0, RGBAColor("red"))
21-
dt.drawPoints([[-1.3,0,-1], [1.3,0,-1]], 10.0, RGBAColor("green"))
22-
dt.drawLines([[-1.3,0,-1], [1.3,0,-1]], 1.0, RGBAColor("green"))
23-
dt.drawFrames([[-1.5,0.1,-1]], [[0.0,0,0,1.0]], [0.1,0.1,0.1])
24-
25-
dt.drawText([-2.0,0.0,0.0], 0.5, "This is not a raptor", RGBAColor("white"))
26-
dt.drawOverlayText([10, 10], 12, "Overlay text", RGBAColor("pink"))
27-
dt.enableLighting()
28-
2918
if self.target is not None:
3019
dt.disableLighting()
3120
dt.drawPoints(self.target.position, 5.0, RGBAColor("blue"))
@@ -36,6 +25,18 @@ def draw(self, visual_context):
3625

3726
dt.drawFrames(self.mo.position, [0.1,0.1,0.1])
3827

28+
dt.disableLighting()
29+
dt.drawPoints(array([[-1.5,-1.0,0.0]]), 5.0, RGBAColor("red"))
30+
dt.drawPoints([[-1.3,0,-1], [1.3,0,-1]], 10.0, RGBAColor("green"))
31+
dt.drawLines([[-1.3,0,-1], [1.3,0,-1]], 1.0, RGBAColor("green"))
32+
dt.drawFrames([[-1.5,0.1,-1]], [[0.0,0,0,1.0]], [0.1,0.1,0.1])
33+
34+
dt.drawText([-2.0,-1.0,0.0], 0.5, "This is not a raptor", RGBAColor("white"))
35+
dt.drawOverlayText([10, 10], 16, "Overlay text", RGBAColor("pink"))
36+
dt.enableLighting()
37+
38+
39+
3940
def createScene(root):
4041
root.dt = 0.01
4142
root.bbox = [[-1,-1,-1],[1,1,1]]

0 commit comments

Comments
 (0)