bauiv1lib.settings.vrtesting

Provides UI for testing vr settings.

 1# Released under the MIT License. See LICENSE for details.
 2#
 3"""Provides UI for testing vr settings."""
 4
 5from __future__ import annotations
 6
 7from typing import TYPE_CHECKING
 8
 9import bauiv1 as bui
10from bauiv1lib.settings.testing import TestingWindow
11
12if TYPE_CHECKING:
13    from typing import Any
14
15
16class VRTestingWindow(TestingWindow):
17    """Window for testing vr settings."""
18
19    def __init__(self, transition: str = 'in_right'):
20        entries: list[dict[str, Any]] = []
21        app = bui.app
22        assert app.classic is not None
23
24        # These are gear-vr only.
25        if (
26            app.classic.platform == 'android'
27            and app.classic.subplatform == 'oculus'
28        ):
29            entries += [
30                {
31                    'name': 'timeWarpDebug',
32                    'label': 'Time Warp Debug',
33                    'increment': 1.0,
34                },
35                {
36                    'name': 'chromaticAberrationCorrection',
37                    'label': 'Chromatic Aberration Correction',
38                    'increment': 1.0,
39                },
40                {
41                    'name': 'vrMinimumVSyncs',
42                    'label': 'Minimum Vsyncs',
43                    'increment': 1.0,
44                },
45                # {'name':'eyeOffsX','label':'Eye IPD','increment':0.001}
46            ]
47
48        # Cardboard/gearvr get eye offset controls.
49        # if app.platform == 'android':
50        #     entries += [
51        #         {'name':'eyeOffsY','label':'Eye Offset Y','increment':0.01},
52        #         {'name':'eyeOffsZ','label':'Eye Offset Z','increment':0.005}]
53
54        # Everyone gets head-scale.
55        entries += [
56            {'name': 'headScale', 'label': 'Head Scale', 'increment': 1.0}
57        ]
58
59        # And everyone gets all these.
60        entries += [
61            {
62                'name': 'vrCamOffsetY',
63                'label': 'In-Game Cam Offset Y',
64                'increment': 0.1,
65            },
66            {
67                'name': 'vrCamOffsetZ',
68                'label': 'In-Game Cam Offset Z',
69                'increment': 0.1,
70            },
71            {
72                'name': 'vrOverlayScale',
73                'label': 'Overlay Scale',
74                'increment': 0.025,
75            },
76            {
77                'name': 'allowCameraMovement',
78                'label': 'Allow Camera Movement',
79                'increment': 1.0,
80            },
81            {
82                'name': 'cameraPanSpeedScale',
83                'label': 'Camera Movement Speed',
84                'increment': 0.1,
85            },
86            {
87                'name': 'showOverlayBounds',
88                'label': 'Show Overlay Bounds',
89                'increment': 1,
90            },
91        ]
92
93        super().__init__(
94            bui.Lstr(resource='settingsWindowAdvanced.vrTestingText'),
95            entries,
96            transition,
97        )
class VRTestingWindow(bauiv1lib.settings.testing.TestingWindow):
17class VRTestingWindow(TestingWindow):
18    """Window for testing vr settings."""
19
20    def __init__(self, transition: str = 'in_right'):
21        entries: list[dict[str, Any]] = []
22        app = bui.app
23        assert app.classic is not None
24
25        # These are gear-vr only.
26        if (
27            app.classic.platform == 'android'
28            and app.classic.subplatform == 'oculus'
29        ):
30            entries += [
31                {
32                    'name': 'timeWarpDebug',
33                    'label': 'Time Warp Debug',
34                    'increment': 1.0,
35                },
36                {
37                    'name': 'chromaticAberrationCorrection',
38                    'label': 'Chromatic Aberration Correction',
39                    'increment': 1.0,
40                },
41                {
42                    'name': 'vrMinimumVSyncs',
43                    'label': 'Minimum Vsyncs',
44                    'increment': 1.0,
45                },
46                # {'name':'eyeOffsX','label':'Eye IPD','increment':0.001}
47            ]
48
49        # Cardboard/gearvr get eye offset controls.
50        # if app.platform == 'android':
51        #     entries += [
52        #         {'name':'eyeOffsY','label':'Eye Offset Y','increment':0.01},
53        #         {'name':'eyeOffsZ','label':'Eye Offset Z','increment':0.005}]
54
55        # Everyone gets head-scale.
56        entries += [
57            {'name': 'headScale', 'label': 'Head Scale', 'increment': 1.0}
58        ]
59
60        # And everyone gets all these.
61        entries += [
62            {
63                'name': 'vrCamOffsetY',
64                'label': 'In-Game Cam Offset Y',
65                'increment': 0.1,
66            },
67            {
68                'name': 'vrCamOffsetZ',
69                'label': 'In-Game Cam Offset Z',
70                'increment': 0.1,
71            },
72            {
73                'name': 'vrOverlayScale',
74                'label': 'Overlay Scale',
75                'increment': 0.025,
76            },
77            {
78                'name': 'allowCameraMovement',
79                'label': 'Allow Camera Movement',
80                'increment': 1.0,
81            },
82            {
83                'name': 'cameraPanSpeedScale',
84                'label': 'Camera Movement Speed',
85                'increment': 0.1,
86            },
87            {
88                'name': 'showOverlayBounds',
89                'label': 'Show Overlay Bounds',
90                'increment': 1,
91            },
92        ]
93
94        super().__init__(
95            bui.Lstr(resource='settingsWindowAdvanced.vrTestingText'),
96            entries,
97            transition,
98        )

Window for testing vr settings.

VRTestingWindow(transition: str = 'in_right')
20    def __init__(self, transition: str = 'in_right'):
21        entries: list[dict[str, Any]] = []
22        app = bui.app
23        assert app.classic is not None
24
25        # These are gear-vr only.
26        if (
27            app.classic.platform == 'android'
28            and app.classic.subplatform == 'oculus'
29        ):
30            entries += [
31                {
32                    'name': 'timeWarpDebug',
33                    'label': 'Time Warp Debug',
34                    'increment': 1.0,
35                },
36                {
37                    'name': 'chromaticAberrationCorrection',
38                    'label': 'Chromatic Aberration Correction',
39                    'increment': 1.0,
40                },
41                {
42                    'name': 'vrMinimumVSyncs',
43                    'label': 'Minimum Vsyncs',
44                    'increment': 1.0,
45                },
46                # {'name':'eyeOffsX','label':'Eye IPD','increment':0.001}
47            ]
48
49        # Cardboard/gearvr get eye offset controls.
50        # if app.platform == 'android':
51        #     entries += [
52        #         {'name':'eyeOffsY','label':'Eye Offset Y','increment':0.01},
53        #         {'name':'eyeOffsZ','label':'Eye Offset Z','increment':0.005}]
54
55        # Everyone gets head-scale.
56        entries += [
57            {'name': 'headScale', 'label': 'Head Scale', 'increment': 1.0}
58        ]
59
60        # And everyone gets all these.
61        entries += [
62            {
63                'name': 'vrCamOffsetY',
64                'label': 'In-Game Cam Offset Y',
65                'increment': 0.1,
66            },
67            {
68                'name': 'vrCamOffsetZ',
69                'label': 'In-Game Cam Offset Z',
70                'increment': 0.1,
71            },
72            {
73                'name': 'vrOverlayScale',
74                'label': 'Overlay Scale',
75                'increment': 0.025,
76            },
77            {
78                'name': 'allowCameraMovement',
79                'label': 'Allow Camera Movement',
80                'increment': 1.0,
81            },
82            {
83                'name': 'cameraPanSpeedScale',
84                'label': 'Camera Movement Speed',
85                'increment': 0.1,
86            },
87            {
88                'name': 'showOverlayBounds',
89                'label': 'Show Overlay Bounds',
90                'increment': 1,
91            },
92        ]
93
94        super().__init__(
95            bui.Lstr(resource='settingsWindowAdvanced.vrTestingText'),
96            entries,
97            transition,
98        )

Create a MainWindow given a root widget and transition info.

Automatically handles in and out transitions on the provided widget, so there is no need to set transitions when creating it.