simscope 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. simscope/__init__.py +6 -0
  2. simscope/__main__.py +8 -0
  3. simscope/_assets/simscope-app.css +2 -0
  4. simscope/_assets/simscope-app.js +4311 -0
  5. simscope/_assets/simscope-player.js +4325 -0
  6. simscope/_assets/simscope-web.LICENSES.txt +407 -0
  7. simscope/_icon.py +22 -0
  8. simscope/_mjviser.py +203 -0
  9. simscope/annotations.py +1132 -0
  10. simscope/cli.py +482 -0
  11. simscope/core.py +257 -0
  12. simscope/derived.py +697 -0
  13. simscope/export.py +799 -0
  14. simscope/highlights.py +947 -0
  15. simscope/importers.py +874 -0
  16. simscope/index.py +579 -0
  17. simscope/io/__init__.py +45 -0
  18. simscope/io/blockfile.py +938 -0
  19. simscope/io/cas.py +294 -0
  20. simscope/io/codecs.py +566 -0
  21. simscope/io/errors.py +9 -0
  22. simscope/io/manifest.py +358 -0
  23. simscope/io/pack.py +563 -0
  24. simscope/io/scene.py +239 -0
  25. simscope/isaaclab.py +1460 -0
  26. simscope/library.py +705 -0
  27. simscope/mujoco.py +578 -0
  28. simscope/py.typed +0 -0
  29. simscope/recorder.py +784 -0
  30. simscope/server/__init__.py +9 -0
  31. simscope/server/app.py +149 -0
  32. simscope/server/blocks.py +191 -0
  33. simscope/server/jobs.py +166 -0
  34. simscope/server/routes.py +707 -0
  35. simscope/server/security.py +218 -0
  36. simscope/server/state.py +751 -0
  37. simscope/server/static.py +84 -0
  38. simscope/transforms.py +147 -0
  39. simscope-0.1.1.dist-info/METADATA +132 -0
  40. simscope-0.1.1.dist-info/RECORD +45 -0
  41. simscope-0.1.1.dist-info/WHEEL +4 -0
  42. simscope-0.1.1.dist-info/entry_points.txt +3 -0
  43. simscope-0.1.1.dist-info/licenses/LICENSE.md +201 -0
  44. simscope-0.1.1.dist-info/licenses/THIRD_PARTY_NOTICES.md +267 -0
  45. simscope-0.1.1.dist-info/licenses/src/simscope/_assets/simscope-web.LICENSES.txt +407 -0
@@ -0,0 +1,407 @@
1
+ simscope's browser bundles include the following third-party software.
2
+
3
+ @fontsource-variable/geist 5.3.0 (OFL-1.1)
4
+
5
+ Copyright 2024 The Geist Project Authors (https://github.com/vercel/geist-font) Geist-Italic[wght].ttf: Copyright 2024 The Geist Project Authors (https://github.com/vercel/geist-font)
6
+
7
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
8
+ This license is copied below, and is also available with a FAQ at:
9
+ http://scripts.sil.org/OFL
10
+
11
+
12
+ ===========================================================
13
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
14
+ ===========================================================
15
+
16
+ PREAMBLE
17
+ The goals of the Open Font License (OFL) are to stimulate worldwide
18
+ development of collaborative font projects, to support the font creation
19
+ efforts of academic and linguistic communities, and to provide a free and
20
+ open framework in which fonts may be shared and improved in partnership
21
+ with others.
22
+
23
+ The OFL allows the licensed fonts to be used, studied, modified and
24
+ redistributed freely as long as they are not sold by themselves. The
25
+ fonts, including any derivative works, can be bundled, embedded,
26
+ redistributed and/or sold with any software provided that any reserved
27
+ names are not used by derivative works. The fonts and derivatives,
28
+ however, cannot be released under any other type of license. The
29
+ requirement for fonts to remain under this license does not apply
30
+ to any document created using the fonts or their derivatives.
31
+
32
+ DEFINITIONS
33
+ "Font Software" refers to the set of files released by the Copyright
34
+ Holder(s) under this license and clearly marked as such. This may
35
+ include source files, build scripts and documentation.
36
+
37
+ "Reserved Font Name" refers to any names specified as such after the
38
+ copyright statement(s).
39
+
40
+ "Original Version" refers to the collection of Font Software components as
41
+ distributed by the Copyright Holder(s).
42
+
43
+ "Modified Version" refers to any derivative made by adding to, deleting,
44
+ or substituting == in part or in whole == any of the components of the
45
+ Original Version, by changing formats or by porting the Font Software to a
46
+ new environment.
47
+
48
+ "Author" refers to any designer, engineer, programmer, technical
49
+ writer or other person who contributed to the Font Software.
50
+
51
+ PERMISSION & CONDITIONS
52
+ Permission is hereby granted, free of charge, to any person obtaining
53
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
54
+ redistribute, and sell modified and unmodified copies of the Font
55
+ Software, subject to the following conditions:
56
+
57
+ 1) Neither the Font Software nor any of its individual components,
58
+ in Original or Modified Versions, may be sold by itself.
59
+
60
+ 2) Original or Modified Versions of the Font Software may be bundled,
61
+ redistributed and/or sold with any software, provided that each copy
62
+ contains the above copyright notice and this license. These can be
63
+ included either as stand-alone text files, human-readable headers or
64
+ in the appropriate machine-readable metadata fields within text or
65
+ binary files as long as those fields can be easily viewed by the user.
66
+
67
+ 3) No Modified Version of the Font Software may use the Reserved Font
68
+ Name(s) unless explicit written permission is granted by the corresponding
69
+ Copyright Holder. This restriction only applies to the primary font name as
70
+ presented to the users.
71
+
72
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
73
+ Software shall not be used to promote, endorse or advertise any
74
+ Modified Version, except to acknowledge the contribution(s) of the
75
+ Copyright Holder(s) and the Author(s) or with their explicit written
76
+ permission.
77
+
78
+ 5) The Font Software, modified or unmodified, in part or in whole,
79
+ must be distributed entirely under this license, and must not be
80
+ distributed under any other license. The requirement for fonts to
81
+ remain under this license does not apply to any document created
82
+ using the Font Software.
83
+
84
+ TERMINATION
85
+ This license becomes null and void if any of the above conditions are
86
+ not met.
87
+
88
+ DISCLAIMER
89
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
90
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
91
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
92
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
93
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
94
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
95
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
96
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
97
+ OTHER DEALINGS IN THE FONT SOFTWARE.
98
+
99
+ ========================================================================
100
+
101
+ @tanstack/react-virtual 3.14.13 (MIT)
102
+
103
+ MIT License
104
+
105
+ Copyright (c) 2021-present Tanner Linsley
106
+
107
+ Permission is hereby granted, free of charge, to any person obtaining a copy
108
+ of this software and associated documentation files (the "Software"), to deal
109
+ in the Software without restriction, including without limitation the rights
110
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
111
+ copies of the Software, and to permit persons to whom the Software is
112
+ furnished to do so, subject to the following conditions:
113
+
114
+ The above copyright notice and this permission notice shall be included in all
115
+ copies or substantial portions of the Software.
116
+
117
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
118
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
119
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
120
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
121
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
122
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
123
+ SOFTWARE.
124
+
125
+ ========================================================================
126
+
127
+ camera-controls 3.1.2 (MIT)
128
+
129
+ MIT License
130
+
131
+ Copyright (c) 2017 @yomotsu
132
+
133
+ Permission is hereby granted, free of charge, to any person obtaining a copy
134
+ of this software and associated documentation files (the "Software"), to deal
135
+ in the Software without restriction, including without limitation the rights
136
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
137
+ copies of the Software, and to permit persons to whom the Software is
138
+ furnished to do so, subject to the following conditions:
139
+
140
+ The above copyright notice and this permission notice shall be included in all
141
+ copies or substantial portions of the Software.
142
+
143
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
144
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
145
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
146
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
147
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
148
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
149
+ SOFTWARE.
150
+
151
+ ========================================================================
152
+
153
+ lucide-react 1.49.0 (ISC)
154
+
155
+ ISC License
156
+
157
+ Copyright (c) 2026 Lucide Icons and Contributors
158
+
159
+ Permission to use, copy, modify, and/or distribute this software for any
160
+ purpose with or without fee is hereby granted, provided that the above
161
+ copyright notice and this permission notice appear in all copies.
162
+
163
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
164
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
165
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
166
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
167
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
168
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
169
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
170
+
171
+ ===
172
+
173
+ The following Lucide icons are derived from the Feather project:
174
+
175
+ airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle, divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2, navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out
176
+
177
+ The MIT License (MIT) (for the icons listed above)
178
+
179
+ Copyright (c) 2013-present Cole Bemis
180
+
181
+ Permission is hereby granted, free of charge, to any person obtaining a copy
182
+ of this software and associated documentation files (the "Software"), to deal
183
+ in the Software without restriction, including without limitation the rights
184
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
185
+ copies of the Software, and to permit persons to whom the Software is
186
+ furnished to do so, subject to the following conditions:
187
+
188
+ The above copyright notice and this permission notice shall be included in all
189
+ copies or substantial portions of the Software.
190
+
191
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
192
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
193
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
194
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
195
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
196
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
197
+ SOFTWARE.
198
+
199
+ ========================================================================
200
+
201
+ radix-ui 1.6.7 (MIT)
202
+
203
+ MIT License
204
+
205
+ Copyright (c) 2022 WorkOS
206
+
207
+ Permission is hereby granted, free of charge, to any person obtaining a copy
208
+ of this software and associated documentation files (the "Software"), to deal
209
+ in the Software without restriction, including without limitation the rights
210
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
211
+ copies of the Software, and to permit persons to whom the Software is
212
+ furnished to do so, subject to the following conditions:
213
+
214
+ The above copyright notice and this permission notice shall be included in all
215
+ copies or substantial portions of the Software.
216
+
217
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
218
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
219
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
220
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
221
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
222
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
223
+ SOFTWARE.
224
+
225
+ ========================================================================
226
+
227
+ react 19.3.0 (MIT)
228
+
229
+ MIT License
230
+
231
+ Copyright (c) Meta Platforms, Inc. and affiliates.
232
+
233
+ Permission is hereby granted, free of charge, to any person obtaining a copy
234
+ of this software and associated documentation files (the "Software"), to deal
235
+ in the Software without restriction, including without limitation the rights
236
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
237
+ copies of the Software, and to permit persons to whom the Software is
238
+ furnished to do so, subject to the following conditions:
239
+
240
+ The above copyright notice and this permission notice shall be included in all
241
+ copies or substantial portions of the Software.
242
+
243
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
244
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
245
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
246
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
247
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
248
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
249
+ SOFTWARE.
250
+
251
+ ========================================================================
252
+
253
+ react-dom 19.3.0 (MIT)
254
+
255
+ MIT License
256
+
257
+ Copyright (c) Meta Platforms, Inc. and affiliates.
258
+
259
+ Permission is hereby granted, free of charge, to any person obtaining a copy
260
+ of this software and associated documentation files (the "Software"), to deal
261
+ in the Software without restriction, including without limitation the rights
262
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
263
+ copies of the Software, and to permit persons to whom the Software is
264
+ furnished to do so, subject to the following conditions:
265
+
266
+ The above copyright notice and this permission notice shall be included in all
267
+ copies or substantial portions of the Software.
268
+
269
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
270
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
271
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
272
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
273
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
274
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
275
+ SOFTWARE.
276
+
277
+ ========================================================================
278
+
279
+ react-resizable-panels 4.14.1 (MIT)
280
+
281
+ The MIT License (MIT)
282
+
283
+ Copyright (c) 2018 Brian Vaughn
284
+
285
+ Permission is hereby granted, free of charge, to any person obtaining a copy
286
+ of this software and associated documentation files (the "Software"), to deal
287
+ in the Software without restriction, including without limitation the rights
288
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
289
+ copies of the Software, and to permit persons to whom the Software is
290
+ furnished to do so, subject to the following conditions:
291
+
292
+ The above copyright notice and this permission notice shall be included in all
293
+ copies or substantial portions of the Software.
294
+
295
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
296
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
297
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
298
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
299
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
300
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
301
+ SOFTWARE.
302
+
303
+ ========================================================================
304
+
305
+ three 0.186.1 (MIT)
306
+
307
+ The MIT License
308
+
309
+ Copyright © 2010-2026 three.js authors
310
+
311
+ Permission is hereby granted, free of charge, to any person obtaining a copy
312
+ of this software and associated documentation files (the "Software"), to deal
313
+ in the Software without restriction, including without limitation the rights
314
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
315
+ copies of the Software, and to permit persons to whom the Software is
316
+ furnished to do so, subject to the following conditions:
317
+
318
+ The above copyright notice and this permission notice shall be included in
319
+ all copies or substantial portions of the Software.
320
+
321
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
322
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
323
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
324
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
325
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
326
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
327
+ THE SOFTWARE.
328
+
329
+ ========================================================================
330
+
331
+ uplot 1.6.32 (MIT)
332
+
333
+ The MIT License (MIT)
334
+
335
+ Copyright (c) 2022 Leon Sorokin
336
+
337
+ Permission is hereby granted, free of charge, to any person obtaining a copy
338
+ of this software and associated documentation files (the "Software"), to deal
339
+ in the Software without restriction, including without limitation the rights
340
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
341
+ copies of the Software, and to permit persons to whom the Software is
342
+ furnished to do so, subject to the following conditions:
343
+
344
+ The above copyright notice and this permission notice shall be included in
345
+ all copies or substantial portions of the Software.
346
+
347
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
348
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
349
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
350
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
351
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
352
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
353
+ THE SOFTWARE.
354
+
355
+ ========================================================================
356
+
357
+ zustand 5.0.15 (MIT)
358
+
359
+ MIT License
360
+
361
+ Copyright (c) 2019 Paul Henschel
362
+
363
+ Permission is hereby granted, free of charge, to any person obtaining a copy
364
+ of this software and associated documentation files (the "Software"), to deal
365
+ in the Software without restriction, including without limitation the rights
366
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
367
+ copies of the Software, and to permit persons to whom the Software is
368
+ furnished to do so, subject to the following conditions:
369
+
370
+ The above copyright notice and this permission notice shall be included in all
371
+ copies or substantial portions of the Software.
372
+
373
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
374
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
375
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
376
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
377
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
378
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
379
+ SOFTWARE.
380
+
381
+ ========================================================================
382
+
383
+ tailwindcss 4.3.3 (MIT)
384
+
385
+ MIT License
386
+
387
+ Copyright (c) Tailwind Labs, Inc.
388
+
389
+ Permission is hereby granted, free of charge, to any person obtaining a copy
390
+ of this software and associated documentation files (the "Software"), to deal
391
+ in the Software without restriction, including without limitation the rights
392
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
393
+ copies of the Software, and to permit persons to whom the Software is
394
+ furnished to do so, subject to the following conditions:
395
+
396
+ The above copyright notice and this permission notice shall be included in all
397
+ copies or substantial portions of the Software.
398
+
399
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
400
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
401
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
402
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
403
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
404
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
405
+ SOFTWARE.
406
+
407
+ ========================================================================
simscope/_icon.py ADDED
@@ -0,0 +1,22 @@
1
+ """The tab icon: the viewer's magnifying-glass mark on a dark tile."""
2
+
3
+ import base64
4
+
5
+ _SVG = (
6
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">'
7
+ '<rect width="24" height="24" rx="5" fill="#171717"/>'
8
+ '<g fill="none" stroke="#fafafa" stroke-linecap="round"'
9
+ ' stroke-linejoin="round">'
10
+ '<circle cx="10.5" cy="10.5" r="6.25" stroke-width="2"/>'
11
+ '<path d="M15.2 15.2 20.5 20.5" stroke-width="2.4"/>'
12
+ '<path d="M7 11.4c.9 0 1.1-2.6 2-2.6s1.1 3.4 2 3.4'
13
+ ' 1.1-4.2 2-4.2.9 3 1.5 3"'
14
+ ' stroke-width="1.1"/></g></svg>'
15
+ )
16
+
17
+ ICON_LINK = (
18
+ '<link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,'
19
+ + base64.b64encode(_SVG.encode()).decode()
20
+ + '">'
21
+ )
22
+ """A ``<link>`` for the page head; a data URI, so it adds no request."""
simscope/_mjviser.py ADDED
@@ -0,0 +1,203 @@
1
+ """MuJoCo model-to-geometry helpers adapted from mjviser.
2
+
3
+ This module is adapted from ``mjviser/conversions.py`` in mjviser
4
+ (https://github.com/mujocolab/mjviser), which is licensed under the Apache
5
+ License, Version 2.0. The upstream copyright notice reads "Copyright 2025,
6
+ The mjlab Developers". Upstream commit:
7
+ ``ae0b219a2049a95e1321214e4efd1d395ee4bf39``. The license text and this
8
+ attribution are reproduced in ``THIRD_PARTY_NOTICES.md``.
9
+
10
+ Changes made to the upstream code (Apache-2.0 section 4(b)): the trimesh and
11
+ Pillow outputs were replaced by plain numpy arrays; mesh unwrapping now
12
+ shares vertices with identical position and texture coordinate; the
13
+ heightfield address uses ``hfield_adr`` instead of a Python loop; texture
14
+ extraction returns pixel arrays; the cube-map, hull, site, and merging
15
+ helpers, and everything that touches the viewer, were dropped; the color rule
16
+ was checked against ``mjv_updateScene``.
17
+
18
+ Texture coordinate convention (kept from upstream): ``uvs`` follow OpenGL,
19
+ so ``(0, 0)`` is the bottom-left of the image as displayed. Pixel arrays
20
+ returned here are flipped to top-down row order to match, which is how PNG
21
+ and three.js (``flipY = true``) expect them.
22
+ """
23
+
24
+ import mujoco
25
+ import numpy as np
26
+ import numpy.typing as npt
27
+
28
+ DEFAULT_GEOM_RGBA = np.array([0.5, 0.5, 0.5, 1.0], dtype=np.float32)
29
+ """MuJoCo's default ``geom/@rgba``. A geom that still has it defers to its
30
+ material color."""
31
+
32
+
33
+ def texture_id(model: mujoco.MjModel, matid: int) -> int:
34
+ """Returns the color texture id of a material.
35
+
36
+ Args:
37
+ model: The compiled model.
38
+ matid: Material id, or a negative value for "no material".
39
+
40
+ Returns:
41
+ The id of the RGB texture, else of the RGBA texture, else ``-1``.
42
+ """
43
+ if matid < 0 or matid >= model.nmat:
44
+ return -1
45
+ for role in (
46
+ mujoco.mjtTextureRole.mjTEXROLE_RGB,
47
+ mujoco.mjtTextureRole.mjTEXROLE_RGBA,
48
+ ):
49
+ texid = int(model.mat_texid[matid, int(role)])
50
+ if texid >= 0:
51
+ return texid
52
+ return -1
53
+
54
+
55
+ def texture_pixels(
56
+ model: mujoco.MjModel, texid: int
57
+ ) -> npt.NDArray[np.uint8] | None:
58
+ """Extracts a 2D texture as top-down 8-bit RGB or RGBA pixels.
59
+
60
+ MuJoCo stores rows bottom-up, so the rows are flipped, as in mjviser.
61
+ Single-channel textures are expanded to RGB. Cube maps, skyboxes, and
62
+ other channel counts are not supported.
63
+
64
+ Args:
65
+ model: The compiled model.
66
+ texid: Texture id.
67
+
68
+ Returns:
69
+ A ``[H, W, 3]`` or ``[H, W, 4]`` uint8 array, or ``None`` if the
70
+ texture is not a supported 2D texture.
71
+ """
72
+ if int(model.tex_type[texid]) != int(mujoco.mjtTexture.mjTEXTURE_2D):
73
+ return None
74
+ width = int(model.tex_width[texid])
75
+ height = int(model.tex_height[texid])
76
+ nchannel = int(model.tex_nchannel[texid])
77
+ if nchannel not in (1, 3, 4) or width < 1 or height < 1:
78
+ return None
79
+ adr = int(model.tex_adr[texid])
80
+ data = model.tex_data[adr : adr + width * height * nchannel]
81
+ pixels = np.flipud(data.reshape(height, width, nchannel))
82
+ if nchannel == 1:
83
+ pixels = np.repeat(pixels, 3, axis=2)
84
+ return np.ascontiguousarray(pixels, dtype=np.uint8)
85
+
86
+
87
+ def effective_geom_rgba(model: mujoco.MjModel) -> npt.NDArray[np.float32]:
88
+ """Resolves the displayed color of every geom.
89
+
90
+ Follows MuJoCo's own rule (verified against ``mjv_updateScene``): a geom
91
+ uses its material color only when it has a material and its own
92
+ ``rgba`` is still the default; otherwise ``geom_rgba`` wins. Upstream
93
+ mjviser prefers the material color unconditionally.
94
+
95
+ Args:
96
+ model: The compiled model.
97
+
98
+ Returns:
99
+ A new ``[ngeom, 4]`` float32 array.
100
+ """
101
+ rgba = model.geom_rgba.astype(np.float32, copy=True)
102
+ matid = model.geom_matid
103
+ defer = (matid >= 0) & np.all(rgba == DEFAULT_GEOM_RGBA, axis=1)
104
+ rgba[defer] = model.mat_rgba[matid[defer]]
105
+ return rgba
106
+
107
+
108
+ def mesh_arrays(
109
+ model: mujoco.MjModel, mesh_id: int, *, with_uvs: bool
110
+ ) -> tuple[
111
+ npt.NDArray[np.float32],
112
+ npt.NDArray[np.uint32],
113
+ npt.NDArray[np.float32] | None,
114
+ ]:
115
+ """Extracts a mesh asset in the frame MuJoCo stores it in.
116
+
117
+ ``mesh_vert`` is already recentered and scaled by the compiler, and
118
+ ``geom_pos``/``geom_quat`` of geoms using the mesh compensate for that.
119
+ So the returned vertices need only the geom's own pose.
120
+
121
+ When ``with_uvs`` is set and the mesh has texture coordinates, vertices
122
+ are split so each unique (position, texcoord) pair becomes one vertex.
123
+
124
+ Args:
125
+ model: The compiled model.
126
+ mesh_id: Mesh asset id.
127
+ with_uvs: Whether to also return texture coordinates.
128
+
129
+ Returns:
130
+ ``(vertices, faces, uvs)`` with shapes ``[V, 3]``, ``[F, 3]`` and
131
+ ``[V, 2]``; ``uvs`` is ``None`` when unused or unavailable.
132
+ """
133
+ vert_adr = int(model.mesh_vertadr[mesh_id])
134
+ vert_num = int(model.mesh_vertnum[mesh_id])
135
+ face_adr = int(model.mesh_faceadr[mesh_id])
136
+ face_num = int(model.mesh_facenum[mesh_id])
137
+ vertices = model.mesh_vert[vert_adr : vert_adr + vert_num]
138
+ faces = model.mesh_face[face_adr : face_adr + face_num]
139
+
140
+ texcoord_num = int(model.mesh_texcoordnum[mesh_id])
141
+ if not with_uvs or texcoord_num == 0:
142
+ return (
143
+ vertices.astype(np.float32, copy=True),
144
+ faces.astype(np.uint32),
145
+ None,
146
+ )
147
+
148
+ texcoord_adr = int(model.mesh_texcoordadr[mesh_id])
149
+ texcoords = model.mesh_texcoord[texcoord_adr : texcoord_adr + texcoord_num]
150
+ face_texcoord = model.mesh_facetexcoord[face_adr : face_adr + face_num]
151
+ pair = faces.ravel().astype(np.int64) * texcoord_num + face_texcoord.ravel()
152
+ unique_pair, inverse = np.unique(pair, return_inverse=True)
153
+ return (
154
+ vertices[unique_pair // texcoord_num].astype(np.float32),
155
+ inverse.reshape(-1, 3).astype(np.uint32),
156
+ texcoords[unique_pair % texcoord_num].astype(np.float32),
157
+ )
158
+
159
+
160
+ def hfield_arrays(
161
+ model: mujoco.MjModel, hfield_id: int, *, with_uvs: bool
162
+ ) -> tuple[
163
+ npt.NDArray[np.float32],
164
+ npt.NDArray[np.uint32],
165
+ npt.NDArray[np.float32] | None,
166
+ ]:
167
+ """Tessellates a height field in the geom frame.
168
+
169
+ Grid vertex ``(row, col)`` sits at ``x = -sx + 2 sx col / (ncol - 1)``,
170
+ ``y = -sy + 2 sy row / (nrow - 1)`` and ``z = elevation * sz``. The
171
+ base skirt below the field is not generated. Triangles wind
172
+ counter-clockwise seen from +z.
173
+
174
+ Args:
175
+ model: The compiled model.
176
+ hfield_id: Height field asset id.
177
+ with_uvs: Whether to also return grid texture coordinates.
178
+
179
+ Returns:
180
+ ``(vertices, faces, uvs)`` with shapes ``[nrow*ncol, 3]``,
181
+ ``[F, 3]`` and ``[nrow*ncol, 2]``; ``uvs`` is ``None`` unless
182
+ ``with_uvs``.
183
+ """
184
+ nrow = int(model.hfield_nrow[hfield_id])
185
+ ncol = int(model.hfield_ncol[hfield_id])
186
+ sx, sy, sz, _base = model.hfield_size[hfield_id]
187
+ adr = int(model.hfield_adr[hfield_id])
188
+ elevation = model.hfield_data[adr : adr + nrow * ncol].reshape(nrow, ncol)
189
+
190
+ xx, yy = np.meshgrid(np.linspace(-sx, sx, ncol), np.linspace(-sy, sy, nrow))
191
+ vertices = np.stack((xx, yy, elevation * sz), axis=-1).reshape(-1, 3)
192
+
193
+ rows, cols = np.mgrid[: nrow - 1, : ncol - 1]
194
+ i0 = (rows * ncol + cols).ravel()
195
+ faces = np.column_stack(
196
+ (i0, i0 + 1, i0 + ncol + 1, i0, i0 + ncol + 1, i0 + ncol)
197
+ ).reshape(-1, 3)
198
+
199
+ uvs = None
200
+ if with_uvs:
201
+ uu, vv = np.meshgrid(np.linspace(0, 1, ncol), np.linspace(0, 1, nrow))
202
+ uvs = np.stack((uu, vv), axis=-1).reshape(-1, 2).astype(np.float32)
203
+ return vertices.astype(np.float32), faces.astype(np.uint32), uvs