-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
102 lines (93 loc) · 3.45 KB
/
utils.py
File metadata and controls
102 lines (93 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import json
import yaml
def dict_from_json(jsonfile: str) -> dict:
"""Returns the contents of a JSON file.
:param jsonfile: The JSON file.
:type jsonfile: str
:return: The file's contents.
:rtype: dict
"""
with open(jsonfile) as file:
loaded_dict = json.load(file)
return loaded_dict
def dict_from_yaml(yamlfile: str) -> dict:
"""Returns the contents of a YAML file.
:param yamlfile: The YAML file.
:type yamlfile: str
:return: The file's contents.
:rtype: dict
"""
with open(yamlfile) as file:
loaded_dict = yaml.safe_load(file)
return loaded_dict
def get_display_options_code(
fps: bool = True,
axis: bool = True,
layer: bool = False,
resolution: bool = False,
timeline: bool = False,
camera: bool = False,
grid: bool = False,
selection_outline: bool = True,
light: bool = False,
skeleton: bool = False,
mesh: bool = True,
path_tracing_results: bool = False,
audio: bool = False,
device_memory: bool = True,
host_memory: bool = True,
) -> int:
"""Returns the code that represents the display options for a SimulationApp object.
:param fps: Whether to show FPS in the Viewport info panel. Defaults to True.
:type fps: bool, optional
:param axis: Whether to show the world coordinate frame in the Viewport bottom left corner. Defaults to True.
:type axis: bool, optional
:param layer: _description_. Defaults to False.
:type layer: bool, optional
:param resolution: Whether to show the resolution in the Viewport info panel. Defaults to False.
:type resolution: bool, optional
:param timeline: Whether to show the simulation timeline. Defaults to False.
:type timeline: bool, optional
:param camera: Whether to show a symbol for cameras in the Viewport. Defaults to False.
:type camera: bool, optional
:param grid: Whether to draw a grid in the xy-plane of the world coordinate system in the Viewport. Defaults to
False.
:type grid: bool, optional
:param selection_outline: Whether to outline the currently selected prim in the Viewport. Defaults to True.
:type selection_outline: bool, optional
:param light: Whether to show a symbol for light prims in the Viewport. Defaults to False.
:type light: bool, optional
:param skeleton: _description_. Defaults to False.
:type skeleton: bool, optional
:param mesh: _description_. Defaults to True.
:type mesh: bool, optional
:param path_tracing_results: _description_. Defaults to False.
:type path_tracing_results: bool, optional
:param audio: _description_. Defaults to False.
:type audio: bool, optional
:param device_memory: Whether to show the device memory in the Viewport info panel. Defaults to True.
:type device_memory: bool, optional
:param host_memory: Whether to show the host memory in the Viewport info panel. Defaults to True.
:type host_memory: bool, optional
:return: The display options code.
:rtype: int
"""
display_options = (
0
| (fps << 0)
| (axis << 1)
| (layer << 2)
| (resolution << 3)
| (timeline << 4)
| (camera << 5)
| (grid << 6)
| (selection_outline << 7)
| (light << 8)
| (skeleton << 9)
| (mesh << 10)
| (path_tracing_results << 11)
| (audio << 12)
| (device_memory << 13)
| (host_memory << 14)
)
return display_options