Menu with buttons and checkboxes example 1¶
menu.py¶
1# © 2024 Autodesk, Inc. All rights reserved.
2
3print("Executing demo script!")
4
5newScene()
6
7loadGeometry("$VRED_EXAMPLES/geo/car.osb")
8loadGeometry("$VRED_EXAMPLES/geo/teddy.osb")
9
10updateScene()
11calcVertexNormals()
12
13teddy = findNode("Teddy_Bear", True);
14teddy.makeTransform()
15
16axis = createLine(0,0,0,0,0,1,0,0,0)
17hideNode(axis)
18
19# define interpolator that will be activated over a menu entry
20cubeInt = vrInterpolator()
21cubeSlide = vrRotationAxisSlide(teddy, axis, 0, 359, 8.0)
22cubeInt.add(cubeSlide)
23
24# define menu with entries and respective functions to be called
25menu1 = vrMenu(0.05, 1, 1)
26menu1.setTransform(-1.5, 0, -10, 0, 45 , 0)
27menu1.addLabel("<font color=red>Menu</font>")
28menu1.addCheckBox("Rotate teddy", cubeInt)
29menu1.addCheckBox("Show scenegraph", "showScenegraph(item_state)")
30menu1.addPushButton("Update Scene", "updateScene()")
31menu1.setAlpha(0.3)
32
33timer = vrTimer(0.2, true)
34timer.setActive(true)
35timer.connect("menu1.show()")
36
37print("Press Shift and click onto each menu entry")