@nebula-spatial/viewer 0.5.16 → 0.5.17
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.
- package/CHANGELOG.md +36 -0
- package/MATERIALX-LIBRARY-AUDIT.md +220 -219
- package/README.md +31 -0
- package/USD-VISUAL-MATERIAL-SUPPORT.md +29 -12
- package/dist/assets/{usd-worker-drur-7bI.js → usd-worker-B6-1I5dT.js} +625 -599
- package/dist/{collision-debug-fwawwhH3.js → collision-debug-CHPrPNT3.js} +1 -1
- package/dist/{index-D9-UMnkK.js → index-cM9KArXm.js} +5 -5
- package/dist/index.js +1 -1
- package/dist/{mjcf-visual-8DniLezh.js → mjcf-visual-C0PWP0vB.js} +1 -1
- package/dist/mujoco-runtime-BV2xR38M.js +739 -0
- package/dist/{session-CEipzQYJ.js → session-CKva1mAh.js} +7 -7
- package/dist/{session-Dn5fAl3z.js → session-D44z2smp.js} +2 -2
- package/dist/{stage-CrDYgXLe.js → stage-pxmOnL0U.js} +1 -1
- package/dist/{urdf-session-BABUz6Qt.js → urdf-session-ChpRmt69.js} +5 -5
- package/dist/usd-session-auH_xmOc.js +10526 -0
- package/dist/version.d.ts +1 -1
- package/dist/{xacro-Q-egO2RI.js → xacro-CjMp9HT5.js} +1 -1
- package/package.json +1 -1
- package/dist/mujoco-runtime-D3JnsOCZ.js +0 -698
- package/dist/usd-session-CNYn-3LD.js +0 -9820
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
function
|
|
2
|
-
return /^https?:$/.test(t.protocol) && e.origin === t.origin && !e.username && !e.password &&
|
|
1
|
+
function Ie(e, t) {
|
|
2
|
+
return /^https?:$/.test(t.protocol) && e.origin === t.origin && !e.username && !e.password && ge(e.pathname).startsWith(ge(new URL(".", t).pathname));
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function ge(e) {
|
|
5
5
|
return e.endsWith("/") ? e : e.slice(0, e.lastIndexOf("/") + 1);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
for (const n of e) for (const
|
|
9
|
-
if (!
|
|
10
|
-
const
|
|
11
|
-
!r || /^(?:data|blob):/i.test(r) || /\.mdl(?:[?#].*)?$/i.test(r) || t(
|
|
7
|
+
function Be(e, t) {
|
|
8
|
+
for (const n of e) for (const s of n.shaders) for (const a of Object.values(s.inputs)) {
|
|
9
|
+
if (!a || typeof a != "object" || Array.isArray(a)) continue;
|
|
10
|
+
const o = a, r = [o.path, o.url, o.resolvedPath].find((c) => typeof c == "string" && c);
|
|
11
|
+
!r || /^(?:data|blob):/i.test(r) || /\.mdl(?:[?#].*)?$/i.test(r) || t(o, r);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const
|
|
14
|
+
function Fe(e, t, n) {
|
|
15
|
+
const s = [];
|
|
16
16
|
try {
|
|
17
|
-
return
|
|
18
|
-
if (t(
|
|
17
|
+
return Be(e, (a, o) => {
|
|
18
|
+
if (t(o)) return;
|
|
19
19
|
const r = {};
|
|
20
20
|
for (const c of ["path", "resolvedPath", "url"])
|
|
21
|
-
c in
|
|
22
|
-
|
|
21
|
+
c in a && (r[c] = a[c], delete a[c]);
|
|
22
|
+
s.push({ asset: a, values: r });
|
|
23
23
|
}), n();
|
|
24
24
|
} finally {
|
|
25
|
-
for (const { asset:
|
|
25
|
+
for (const { asset: a, values: o } of s) Object.assign(a, o);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const ze = "E_ASSET_RESOURCE_NOT_FOUND", Ae = "E_ASSET_RESOURCE_INVALID", We = "E_ASSET_FETCH", He = "E_ASSET_EXTERNAL_DENIED", Xe = "E_ASSET_AUTH", Je = /* @__PURE__ */ new Set([
|
|
29
29
|
"png",
|
|
30
30
|
"jpg",
|
|
31
31
|
"jpeg",
|
|
@@ -38,82 +38,82 @@ const Be = "E_ASSET_RESOURCE_NOT_FOUND", Ie = "E_ASSET_RESOURCE_INVALID", Fe = "
|
|
|
38
38
|
"hdr",
|
|
39
39
|
"exr",
|
|
40
40
|
"ktx2"
|
|
41
|
-
]),
|
|
42
|
-
function
|
|
41
|
+
]), qe = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
|
|
42
|
+
function Ze(e) {
|
|
43
43
|
var n;
|
|
44
44
|
return ((n = (e.split(/[?#]/, 1)[0] ?? e).split(".").pop()) == null ? void 0 : n.toLowerCase()) ?? "";
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
const t =
|
|
48
|
-
return
|
|
46
|
+
function Ye(e) {
|
|
47
|
+
const t = Ze(e);
|
|
48
|
+
return Je.has(t) && !qe.has(t);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Ke(e, t) {
|
|
51
51
|
return Object.assign(new Error(e), { code: t });
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
var
|
|
53
|
+
function Qe(e) {
|
|
54
|
+
var s;
|
|
55
55
|
if (e instanceof Error && e.name === "AbortError") return "aborted";
|
|
56
56
|
const t = e == null ? void 0 : e.code;
|
|
57
|
-
if (t ===
|
|
58
|
-
if (t ===
|
|
59
|
-
if (t ===
|
|
60
|
-
if (t ===
|
|
61
|
-
const n = (
|
|
57
|
+
if (t === ze) return "missing";
|
|
58
|
+
if (t === Ae) return "invalid";
|
|
59
|
+
if (t === We) return "unavailable";
|
|
60
|
+
if (t === Xe || t === He) return "denied";
|
|
61
|
+
const n = (s = /\((\d{3})\)/.exec(e instanceof Error ? e.message : "")) == null ? void 0 : s[1];
|
|
62
62
|
return n === "404" || n === "410" ? "missing" : n === "401" || n === "403" ? "denied" : n != null && n.startsWith("5") ? "unavailable" : "unknown";
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
const t =
|
|
64
|
+
function et(e) {
|
|
65
|
+
const t = Qe(e);
|
|
66
66
|
return t === "missing" || t === "invalid" || t === "unavailable";
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function tt(e, t) {
|
|
69
69
|
return e && /\bhtml\b/i.test(e) ? `返回 HTML 页面(${e})` : e && !/^text\//i.test(e) ? null : /^\uFEFF?\s*(?:<!doctype\s+html|<html|<\?xml[^>]*\bhtml)/i.test(t) ? "返回 HTML 兜底页" : null;
|
|
70
70
|
}
|
|
71
|
-
function et(e, t) {
|
|
72
|
-
return t.byteLength ? Qe(e, new TextDecoder().decode(t.subarray(0, 512))) : "响应内容为空";
|
|
73
|
-
}
|
|
74
|
-
const tt = /<UDIM>/i;
|
|
75
71
|
function nt(e, t) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
if (!
|
|
72
|
+
return t.byteLength ? tt(e, new TextDecoder().decode(t.subarray(0, 512))) : "响应内容为空";
|
|
73
|
+
}
|
|
74
|
+
const rt = /<UDIM>/i;
|
|
75
|
+
function st(e, t) {
|
|
76
|
+
const n = me(e).replaceAll("\\", "/");
|
|
77
|
+
if (!rt.test(n)) return null;
|
|
78
|
+
const s = we(n), a = s.split("/").at(-1);
|
|
79
|
+
if (!a) return { paths: [], tiles: [] };
|
|
80
|
+
const o = ot(a);
|
|
81
|
+
if (!o) return { paths: [], tiles: [] };
|
|
82
82
|
const r = [];
|
|
83
83
|
for (const l of new Set(t)) {
|
|
84
|
-
const p =
|
|
84
|
+
const p = me(l).replaceAll("\\", "/"), g = we(p), u = g.split("/").at(-1);
|
|
85
85
|
if (!u) continue;
|
|
86
|
-
const f =
|
|
86
|
+
const f = o.exec(u);
|
|
87
87
|
if (!f) continue;
|
|
88
88
|
const h = Number(f[1]);
|
|
89
89
|
!Number.isInteger(h) || h < 1001 || h > 9999 || r.push({
|
|
90
90
|
path: l,
|
|
91
91
|
tile: h,
|
|
92
|
-
score:
|
|
92
|
+
score: at(s, g)
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
if (!r.length) return { paths: [], tiles: [] };
|
|
96
|
-
const c = Math.max(...r.map((l) => l.score)),
|
|
96
|
+
const c = Math.max(...r.map((l) => l.score)), i = r.filter((l) => l.score === c).sort((l, p) => l.tile - p.tile || l.path.localeCompare(p.path));
|
|
97
97
|
return {
|
|
98
|
-
paths:
|
|
99
|
-
tiles:
|
|
98
|
+
paths: i.map((l) => l.path),
|
|
99
|
+
tiles: i.map((l) => l.tile)
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function ot(e) {
|
|
103
103
|
const t = e.split(/<UDIM>/i);
|
|
104
|
-
return t.length !== 2 ? null : new RegExp(`^${
|
|
105
|
-
}
|
|
106
|
-
function
|
|
107
|
-
const n = e.split("/").slice(0, -1).filter(Boolean),
|
|
108
|
-
let
|
|
109
|
-
for (;
|
|
110
|
-
const
|
|
111
|
-
if ((
|
|
112
|
-
|
|
104
|
+
return t.length !== 2 ? null : new RegExp(`^${ye(t[0])}(\\d{4})${ye(t[1])}$`, "i");
|
|
105
|
+
}
|
|
106
|
+
function at(e, t) {
|
|
107
|
+
const n = e.split("/").slice(0, -1).filter(Boolean), s = t.split("/").slice(0, -1).filter(Boolean);
|
|
108
|
+
let a = 0;
|
|
109
|
+
for (; a < n.length && a < s.length; ) {
|
|
110
|
+
const o = n.at(-1 - a), r = s.at(-1 - a);
|
|
111
|
+
if ((o == null ? void 0 : o.toLowerCase()) !== (r == null ? void 0 : r.toLowerCase())) break;
|
|
112
|
+
a += 1;
|
|
113
113
|
}
|
|
114
|
-
return
|
|
114
|
+
return a;
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function me(e) {
|
|
117
117
|
const t = e.replace(/%3CUDIM%3E/gi, "<UDIM>");
|
|
118
118
|
try {
|
|
119
119
|
return decodeURIComponent(t);
|
|
@@ -121,101 +121,101 @@ function ge(e) {
|
|
|
121
121
|
return t;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function we(e) {
|
|
125
125
|
const t = e.search(/[?#]/);
|
|
126
126
|
return t < 0 ? e : e.slice(0, t);
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function ye(e) {
|
|
129
129
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
130
130
|
}
|
|
131
|
-
const
|
|
132
|
-
function
|
|
131
|
+
const it = 67324752, ct = 33639248, ut = 101010256, ie = 4294967295, lt = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "webp"]);
|
|
132
|
+
function ft(e) {
|
|
133
133
|
return e.length > 3 && e[0] === 80 && e[1] === 75;
|
|
134
134
|
}
|
|
135
|
-
async function
|
|
136
|
-
const n = new DataView(e.buffer, e.byteOffset, e.byteLength),
|
|
137
|
-
if (
|
|
138
|
-
const
|
|
139
|
-
let
|
|
140
|
-
if (
|
|
135
|
+
async function dt(e, t = {}) {
|
|
136
|
+
const n = new DataView(e.buffer, e.byteOffset, e.byteLength), s = yt(n);
|
|
137
|
+
if (s < 0) throw new Error("Not a zip package: end of central directory not found.");
|
|
138
|
+
const a = n.getUint16(s + 10, !0);
|
|
139
|
+
let o = n.getUint32(s + 16, !0);
|
|
140
|
+
if (a === 65535 || o === ie) throw new Error("ZIP64 usdz packages are not supported.");
|
|
141
141
|
const r = /* @__PURE__ */ new Map(), c = [];
|
|
142
|
-
for (let
|
|
143
|
-
if (
|
|
144
|
-
throw new Error(`Corrupt zip central directory at entry ${
|
|
145
|
-
const l = n.getUint16(
|
|
142
|
+
for (let i = 0; i < a; i += 1) {
|
|
143
|
+
if (o + 46 > n.byteLength || n.getUint32(o, !0) !== ct)
|
|
144
|
+
throw new Error(`Corrupt zip central directory at entry ${i}.`);
|
|
145
|
+
const l = n.getUint16(o + 10, !0), p = n.getUint32(o + 20, !0), g = n.getUint16(o + 28, !0), u = n.getUint16(o + 30, !0), f = n.getUint16(o + 32, !0), h = n.getUint32(o + 42, !0);
|
|
146
146
|
if (p === ie || h === ie)
|
|
147
147
|
throw new Error("ZIP64 usdz packages are not supported.");
|
|
148
|
-
const y = new TextDecoder().decode(e.subarray(
|
|
149
|
-
|
|
148
|
+
const y = new TextDecoder().decode(e.subarray(o + 46, o + 46 + g));
|
|
149
|
+
o += 46 + g + u + f, !y.endsWith("/") && (t.include && !t.include(y) || c.push(pt(e, n, h, p, l).then((w) => ({ name: y, data: w }))));
|
|
150
150
|
}
|
|
151
|
-
for (const { name:
|
|
151
|
+
for (const { name: i, data: l } of await Promise.all(c)) r.set(i, l);
|
|
152
152
|
return r;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function ht(e) {
|
|
155
155
|
if (typeof URL > "u" || typeof URL.createObjectURL != "function") return null;
|
|
156
|
-
const t = new Map([...e].filter(([r]) =>
|
|
156
|
+
const t = new Map([...e].filter(([r]) => Re(r)));
|
|
157
157
|
if (t.size === 0) return null;
|
|
158
158
|
const n = /* @__PURE__ */ new Map();
|
|
159
159
|
for (const r of t.keys()) {
|
|
160
160
|
const c = r.split("/").pop() ?? r;
|
|
161
161
|
n.set(c, n.has(c) ? null : r);
|
|
162
162
|
}
|
|
163
|
-
const
|
|
164
|
-
let c =
|
|
163
|
+
const s = /* @__PURE__ */ new Map(), a = (r) => {
|
|
164
|
+
let c = s.get(r);
|
|
165
165
|
if (!c) {
|
|
166
|
-
const
|
|
167
|
-
c = URL.createObjectURL(new Blob([new Uint8Array(
|
|
166
|
+
const i = t.get(r);
|
|
167
|
+
c = URL.createObjectURL(new Blob([new Uint8Array(i)], { type: wt(r) })), s.set(r, c);
|
|
168
168
|
}
|
|
169
169
|
return c;
|
|
170
|
-
},
|
|
170
|
+
}, o = (r) => {
|
|
171
171
|
if (!r) return null;
|
|
172
|
-
const c =
|
|
172
|
+
const c = mt(gt(r));
|
|
173
173
|
if (!c) return null;
|
|
174
|
-
if (t.has(c)) return
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
174
|
+
if (t.has(c)) return a(c);
|
|
175
|
+
const i = [...t.keys()].filter((g) => g.endsWith(`/${c}`));
|
|
176
|
+
if (i.length === 1) return a(i[0]);
|
|
177
177
|
const l = [...t.keys()].filter((g) => c.endsWith(`/${g}`));
|
|
178
|
-
if (l.length === 1) return
|
|
178
|
+
if (l.length === 1) return a(l[0]);
|
|
179
179
|
const p = n.get(c.split("/").pop() ?? "");
|
|
180
|
-
return p ?
|
|
180
|
+
return p ? a(p) : null;
|
|
181
181
|
};
|
|
182
|
-
for (const r of t.keys())
|
|
182
|
+
for (const r of t.keys()) a(r);
|
|
183
183
|
return {
|
|
184
|
-
urls:
|
|
185
|
-
resolve: (r) =>
|
|
184
|
+
urls: s,
|
|
185
|
+
resolve: (r) => o(r.resolvedPath) ?? o(r.path) ?? o(r.url) ?? null,
|
|
186
186
|
dispose: () => {
|
|
187
|
-
for (const r of
|
|
188
|
-
|
|
187
|
+
for (const r of s.values()) URL.revokeObjectURL(r);
|
|
188
|
+
s.clear();
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
return
|
|
194
|
-
}
|
|
195
|
-
async function
|
|
196
|
-
if (t.getUint32(n, !0) !==
|
|
197
|
-
const
|
|
198
|
-
if (
|
|
199
|
-
if (
|
|
200
|
-
const l = new Blob([new Uint8Array(
|
|
192
|
+
function Re(e) {
|
|
193
|
+
return lt.has(Me(e));
|
|
194
|
+
}
|
|
195
|
+
async function pt(e, t, n, s, a) {
|
|
196
|
+
if (t.getUint32(n, !0) !== it) throw new Error("Corrupt zip local file header.");
|
|
197
|
+
const o = t.getUint16(n + 26, !0), r = t.getUint16(n + 28, !0), c = n + 30 + o + r, i = e.subarray(c, c + s);
|
|
198
|
+
if (a === 0) return i.slice();
|
|
199
|
+
if (a !== 8) throw new Error(`Unsupported zip compression method ${a}.`);
|
|
200
|
+
const l = new Blob([new Uint8Array(i)]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
|
|
201
201
|
return new Uint8Array(await new Response(l).arrayBuffer());
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function gt(e) {
|
|
204
204
|
const t = e.indexOf("[");
|
|
205
205
|
return t >= 0 && e.endsWith("]") ? e.slice(t + 1, -1) : e;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function mt(e) {
|
|
208
208
|
const t = [];
|
|
209
209
|
for (const n of e.replaceAll("\\", "/").split("/"))
|
|
210
210
|
!n || n === "." || (n === ".." ? t.pop() : t.push(n));
|
|
211
211
|
return t.join("/");
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function Me(e) {
|
|
214
214
|
const t = e.split(/[?#]/)[0] ?? e, n = t.lastIndexOf(".");
|
|
215
215
|
return n < 0 ? "" : t.slice(n + 1).toLowerCase();
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
switch (
|
|
217
|
+
function wt(e) {
|
|
218
|
+
switch (Me(e)) {
|
|
219
219
|
case "png":
|
|
220
220
|
return "image/png";
|
|
221
221
|
case "jpg":
|
|
@@ -227,30 +227,30 @@ function gt(e) {
|
|
|
227
227
|
return "application/octet-stream";
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function yt(e) {
|
|
231
231
|
const t = Math.max(0, e.byteLength - 65535 - 22);
|
|
232
232
|
for (let n = e.byteLength - 22; n >= t; n -= 1)
|
|
233
|
-
if (e.getUint32(n, !0) ===
|
|
233
|
+
if (e.getUint32(n, !0) === ut) return n;
|
|
234
234
|
return -1;
|
|
235
235
|
}
|
|
236
|
-
const
|
|
236
|
+
const _t = 1, St = 5, bt = "6f5df5c5901df72d6c87", Et = {
|
|
237
237
|
file: "openusd_probe.js",
|
|
238
238
|
sha256: "f89019f6a03661e6aa6403e8b6b694fa00c92ba1c0c7e09620e25ea8efbe6bc2",
|
|
239
239
|
bytes: 97833
|
|
240
|
-
},
|
|
240
|
+
}, Ut = {
|
|
241
241
|
file: "openusd_probe.wasm",
|
|
242
242
|
sha256: "1170d1ae548f51e5e9d65931df001d8fcd627e8b69b85d9447494c24402893f7",
|
|
243
243
|
bytes: 10744656
|
|
244
244
|
};
|
|
245
|
-
var
|
|
246
|
-
schemaVersion:
|
|
247
|
-
apiVersion:
|
|
248
|
-
runtimeId:
|
|
249
|
-
js:
|
|
250
|
-
wasm:
|
|
245
|
+
var vt = {
|
|
246
|
+
schemaVersion: _t,
|
|
247
|
+
apiVersion: St,
|
|
248
|
+
runtimeId: bt,
|
|
249
|
+
js: Et,
|
|
250
|
+
wasm: Ut
|
|
251
251
|
};
|
|
252
|
-
const
|
|
253
|
-
function
|
|
252
|
+
const Pt = It(vt);
|
|
253
|
+
function It(e) {
|
|
254
254
|
if (!e || typeof e != "object") throw new Error("OpenUSD runtime manifest is missing.");
|
|
255
255
|
const t = e;
|
|
256
256
|
if (t.schemaVersion !== 1 || !Number.isInteger(t.apiVersion) || Number(t.apiVersion) < 1 || typeof t.runtimeId != "string" || !/^[0-9a-f]{20}$/.test(t.runtimeId))
|
|
@@ -259,11 +259,11 @@ function vt(e) {
|
|
|
259
259
|
schemaVersion: t.schemaVersion,
|
|
260
260
|
apiVersion: Number(t.apiVersion),
|
|
261
261
|
runtimeId: t.runtimeId,
|
|
262
|
-
js:
|
|
263
|
-
wasm:
|
|
262
|
+
js: _e(t.js, "openusd_probe.js"),
|
|
263
|
+
wasm: _e(t.wasm, "openusd_probe.wasm")
|
|
264
264
|
});
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function _e(e, t) {
|
|
267
267
|
if (!e || typeof e != "object") throw new Error(`OpenUSD runtime manifest omits ${t}.`);
|
|
268
268
|
const n = e;
|
|
269
269
|
if (n.file !== t || typeof n.sha256 != "string" || !/^[0-9a-f]{64}$/.test(n.sha256) || !Number.isInteger(n.bytes) || Number(n.bytes) < 1)
|
|
@@ -274,28 +274,28 @@ function ye(e, t) {
|
|
|
274
274
|
bytes: Number(n.bytes)
|
|
275
275
|
});
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function At(e, t, n) {
|
|
278
278
|
return WebAssembly.instantiate(e, t).then(
|
|
279
|
-
(
|
|
280
|
-
(
|
|
279
|
+
(s) => n(s, e),
|
|
280
|
+
(s) => {
|
|
281
281
|
setTimeout(() => {
|
|
282
|
-
throw
|
|
282
|
+
throw s;
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
), {};
|
|
286
286
|
}
|
|
287
287
|
function Ne(e, t) {
|
|
288
|
-
const n = async (
|
|
289
|
-
var
|
|
290
|
-
const c = e.GetPrimAtPath(
|
|
288
|
+
const n = async (o, r) => {
|
|
289
|
+
var i;
|
|
290
|
+
const c = e.GetPrimAtPath(o);
|
|
291
291
|
try {
|
|
292
292
|
return r(c);
|
|
293
293
|
} finally {
|
|
294
|
-
(
|
|
294
|
+
(i = c == null ? void 0 : c.delete) == null || i.call(c);
|
|
295
295
|
}
|
|
296
|
-
},
|
|
297
|
-
var
|
|
298
|
-
const c = (
|
|
296
|
+
}, s = (o, r) => {
|
|
297
|
+
var i, l, p, g;
|
|
298
|
+
const c = (i = o == null ? void 0 : o.GetAttribute) == null ? void 0 : i.call(o, r);
|
|
299
299
|
if (!c) return [];
|
|
300
300
|
try {
|
|
301
301
|
return ((l = c.IsValid) == null ? void 0 : l.call(c)) !== !0 ? [] : (((p = c.GetConnections) == null ? void 0 : p.call(c)) ?? []).map((u) => {
|
|
@@ -307,9 +307,9 @@ function Ne(e, t) {
|
|
|
307
307
|
} finally {
|
|
308
308
|
(g = c.delete) == null || g.call(c);
|
|
309
309
|
}
|
|
310
|
-
},
|
|
310
|
+
}, a = (o) => {
|
|
311
311
|
var c;
|
|
312
|
-
const r =
|
|
312
|
+
const r = o && ((c = t.UsdShade) != null && c.ComputeBoundMaterialPath) ? t.UsdShade.ComputeBoundMaterialPath(o) : null;
|
|
313
313
|
return r ? {
|
|
314
314
|
found: !0,
|
|
315
315
|
materialPath: String(r.materialPath ?? ""),
|
|
@@ -318,103 +318,103 @@ function Ne(e, t) {
|
|
|
318
318
|
} : { found: !1, materialPath: "", resolvedTargetPath: "", bindingRelationshipPath: "" };
|
|
319
319
|
};
|
|
320
320
|
return {
|
|
321
|
-
async stageMetadata(
|
|
321
|
+
async stageMetadata(o) {
|
|
322
322
|
var c;
|
|
323
323
|
const r = e.GetPseudoRoot();
|
|
324
324
|
try {
|
|
325
|
-
const
|
|
326
|
-
return { valid: !0, found:
|
|
325
|
+
const i = r.GetMetadata(o);
|
|
326
|
+
return { valid: !0, found: i != null, value: i };
|
|
327
327
|
} finally {
|
|
328
328
|
(c = r.delete) == null || c.call(r);
|
|
329
329
|
}
|
|
330
330
|
},
|
|
331
|
-
async primInfo(
|
|
332
|
-
return n(
|
|
333
|
-
var c,
|
|
331
|
+
async primInfo(o) {
|
|
332
|
+
return n(o, (r) => {
|
|
333
|
+
var c, i, l, p;
|
|
334
334
|
return {
|
|
335
335
|
valid: !!r && ((c = r.IsValid) == null ? void 0 : c.call(r)) !== !1,
|
|
336
|
-
name: String(((
|
|
337
|
-
path:
|
|
336
|
+
name: String(((i = r.GetName) == null ? void 0 : i.call(r)) ?? o.split("/").pop() ?? ""),
|
|
337
|
+
path: o,
|
|
338
338
|
typeName: String(((l = r.GetTypeName) == null ? void 0 : l.call(r)) ?? ""),
|
|
339
339
|
instance: ((p = r.IsInstance) == null ? void 0 : p.call(r)) === !0
|
|
340
340
|
};
|
|
341
341
|
});
|
|
342
342
|
},
|
|
343
|
-
async primChildren(
|
|
344
|
-
return n(
|
|
343
|
+
async primChildren(o) {
|
|
344
|
+
return n(o, (r) => {
|
|
345
345
|
var c;
|
|
346
|
-
return (((c = r.GetChildren) == null ? void 0 : c.call(r)) ?? []).map((
|
|
346
|
+
return (((c = r.GetChildren) == null ? void 0 : c.call(r)) ?? []).map((i) => {
|
|
347
347
|
var p, g;
|
|
348
|
-
const l = String(
|
|
349
|
-
return (g =
|
|
348
|
+
const l = String(i.__path ?? ((p = i.GetPath) == null ? void 0 : p.call(i)) ?? "");
|
|
349
|
+
return (g = i.delete) == null || g.call(i), l;
|
|
350
350
|
});
|
|
351
351
|
});
|
|
352
352
|
},
|
|
353
|
-
async primDescendants(
|
|
353
|
+
async primDescendants(o, r = "") {
|
|
354
354
|
var c;
|
|
355
|
-
return (((c = e.GetDescendants) == null ? void 0 : c.call(e,
|
|
355
|
+
return (((c = e.GetDescendants) == null ? void 0 : c.call(e, o, r)) ?? []).map(String);
|
|
356
356
|
},
|
|
357
|
-
async primAttributes(
|
|
358
|
-
return n(
|
|
357
|
+
async primAttributes(o) {
|
|
358
|
+
return n(o, (r) => {
|
|
359
359
|
var c;
|
|
360
|
-
return (((c = r.GetAttributes) == null ? void 0 : c.call(r)) ?? []).map((
|
|
360
|
+
return (((c = r.GetAttributes) == null ? void 0 : c.call(r)) ?? []).map((i) => {
|
|
361
361
|
var p, g;
|
|
362
|
-
const l = String(((p =
|
|
363
|
-
return (g =
|
|
362
|
+
const l = String(((p = i.GetName) == null ? void 0 : p.call(i)) ?? "");
|
|
363
|
+
return (g = i.delete) == null || g.call(i), l;
|
|
364
364
|
});
|
|
365
365
|
});
|
|
366
366
|
},
|
|
367
|
-
async primMetadata(
|
|
368
|
-
return n(
|
|
367
|
+
async primMetadata(o, r) {
|
|
368
|
+
return n(o, (c) => {
|
|
369
369
|
var p;
|
|
370
|
-
const
|
|
370
|
+
const i = (p = c == null ? void 0 : c.GetMetadata) == null ? void 0 : p.call(c, r), l = typeof i == "string" ? i : i && typeof i == "object" && typeof i.string == "string" ? String(i.string) : void 0;
|
|
371
371
|
return {
|
|
372
372
|
valid: !0,
|
|
373
|
-
found:
|
|
374
|
-
...
|
|
373
|
+
found: i != null,
|
|
374
|
+
...i != null ? { value: i } : {},
|
|
375
375
|
...l !== void 0 ? { text: l } : {}
|
|
376
376
|
};
|
|
377
377
|
});
|
|
378
378
|
},
|
|
379
|
-
async relationshipTargets(
|
|
380
|
-
return n(
|
|
379
|
+
async relationshipTargets(o, r) {
|
|
380
|
+
return n(o, (c) => {
|
|
381
381
|
var l, p, g;
|
|
382
|
-
const
|
|
383
|
-
if (!
|
|
382
|
+
const i = (l = c == null ? void 0 : c.GetRelationship) == null ? void 0 : l.call(c, r);
|
|
383
|
+
if (!i) return [];
|
|
384
384
|
try {
|
|
385
|
-
return (((p =
|
|
385
|
+
return (((p = i.GetTargets) == null ? void 0 : p.call(i)) ?? []).map((u) => {
|
|
386
386
|
var f;
|
|
387
387
|
return typeof u == "string" ? u : String(((f = u.GetString) == null ? void 0 : f.call(u)) ?? u.path ?? "");
|
|
388
388
|
}).filter(Boolean);
|
|
389
389
|
} finally {
|
|
390
|
-
(g =
|
|
390
|
+
(g = i.delete) == null || g.call(i);
|
|
391
391
|
}
|
|
392
392
|
});
|
|
393
393
|
},
|
|
394
|
-
async attributeValue(
|
|
395
|
-
return n(
|
|
394
|
+
async attributeValue(o, r) {
|
|
395
|
+
return n(o, (c) => {
|
|
396
396
|
var l, p, g, u;
|
|
397
|
-
const
|
|
398
|
-
if (!
|
|
397
|
+
const i = (l = c == null ? void 0 : c.GetAttribute) == null ? void 0 : l.call(c, r);
|
|
398
|
+
if (!i) return { valid: !1, authored: !1, value: null };
|
|
399
399
|
try {
|
|
400
|
-
const f = ((p =
|
|
400
|
+
const f = ((p = i.IsValid) == null ? void 0 : p.call(i)) === !0;
|
|
401
401
|
return {
|
|
402
402
|
valid: f,
|
|
403
|
-
authored: f && ((g =
|
|
404
|
-
value: f ?
|
|
403
|
+
authored: f && ((g = i.HasAuthoredValue) == null ? void 0 : g.call(i)) === !0,
|
|
404
|
+
value: f ? i.Get() : null
|
|
405
405
|
};
|
|
406
406
|
} finally {
|
|
407
|
-
(u =
|
|
407
|
+
(u = i.delete) == null || u.call(i);
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
410
|
},
|
|
411
|
-
async attributeValues(
|
|
411
|
+
async attributeValues(o) {
|
|
412
412
|
const r = {};
|
|
413
|
-
for (const c of
|
|
414
|
-
r[c.path] = await n(c.path, (
|
|
413
|
+
for (const c of o)
|
|
414
|
+
r[c.path] = await n(c.path, (i) => Object.fromEntries(
|
|
415
415
|
c.names.map((l) => {
|
|
416
416
|
var g, u, f, h;
|
|
417
|
-
const p = (g =
|
|
417
|
+
const p = (g = i == null ? void 0 : i.GetAttribute) == null ? void 0 : g.call(i, l);
|
|
418
418
|
if (!p) return [l, { valid: !1, authored: !1, value: null }];
|
|
419
419
|
try {
|
|
420
420
|
const y = ((u = p.IsValid) == null ? void 0 : u.call(p)) === !0;
|
|
@@ -430,10 +430,10 @@ function Ne(e, t) {
|
|
|
430
430
|
));
|
|
431
431
|
return r;
|
|
432
432
|
},
|
|
433
|
-
async attributeMetadata(
|
|
434
|
-
return n(
|
|
433
|
+
async attributeMetadata(o, r, c) {
|
|
434
|
+
return n(o, (i) => {
|
|
435
435
|
var p, g, u;
|
|
436
|
-
const l = (p =
|
|
436
|
+
const l = (p = i == null ? void 0 : i.GetAttribute) == null ? void 0 : p.call(i, r);
|
|
437
437
|
if (!l) return { valid: !1, found: !1 };
|
|
438
438
|
try {
|
|
439
439
|
if (((g = l.IsValid) == null ? void 0 : g.call(l)) !== !0) return { valid: !1, found: !1 };
|
|
@@ -448,58 +448,58 @@ function Ne(e, t) {
|
|
|
448
448
|
}
|
|
449
449
|
});
|
|
450
450
|
},
|
|
451
|
-
async attributeConnections(
|
|
452
|
-
return n(
|
|
451
|
+
async attributeConnections(o, r) {
|
|
452
|
+
return n(o, (c) => s(c, r));
|
|
453
453
|
},
|
|
454
|
-
async boundMaterial(
|
|
455
|
-
return n(
|
|
454
|
+
async boundMaterial(o) {
|
|
455
|
+
return n(o, a);
|
|
456
456
|
}
|
|
457
457
|
};
|
|
458
458
|
}
|
|
459
|
-
const
|
|
460
|
-
function
|
|
461
|
-
const n = new Set(t.map(
|
|
462
|
-
for (const
|
|
463
|
-
if (!
|
|
464
|
-
const
|
|
465
|
-
if (
|
|
466
|
-
const r = ce(
|
|
467
|
-
const p = r !== null && ce(
|
|
468
|
-
return Number(g) - Number(p) ||
|
|
459
|
+
const Rt = /^physics$/i, Mt = /^(newton|mjc|mujoco)(?:[_-]|$)/i, Nt = /^(physx|newton|mjc|mujoco)(?:[_-]|)/i;
|
|
460
|
+
function Dt(e, t = []) {
|
|
461
|
+
const n = new Set(t.map(Se)), s = [];
|
|
462
|
+
for (const a of e) {
|
|
463
|
+
if (!Rt.test(a.setName) || n.has(Se(a))) continue;
|
|
464
|
+
const o = a.variantNames.map((i, l) => ({ selection: i, index: l, rank: kt(i) })).filter((i) => i.rank !== null);
|
|
465
|
+
if (o.length === 0 || a.selection && Mt.test(a.selection)) continue;
|
|
466
|
+
const r = ce(a.selection), c = [...o].sort((i, l) => {
|
|
467
|
+
const p = r !== null && ce(i.selection) === r, g = r !== null && ce(l.selection) === r;
|
|
468
|
+
return Number(g) - Number(p) || i.rank - l.rank || i.index - l.index;
|
|
469
469
|
})[0];
|
|
470
|
-
|
|
471
|
-
primPath:
|
|
472
|
-
setName:
|
|
470
|
+
s.push({
|
|
471
|
+
primPath: a.primPath,
|
|
472
|
+
setName: a.setName,
|
|
473
473
|
selection: c.selection
|
|
474
474
|
});
|
|
475
475
|
}
|
|
476
|
-
return
|
|
476
|
+
return s;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function kt(e) {
|
|
479
479
|
return /^newton(?:[_-]|$)/i.test(e) ? 0 : /^mjc(?:[_-]|$)/i.test(e) ? 1 : /^mujoco(?:[_-]|$)/i.test(e) ? 2 : null;
|
|
480
480
|
}
|
|
481
481
|
function ce(e) {
|
|
482
|
-
return e && e.replace(
|
|
482
|
+
return e && e.replace(Nt, "").toLowerCase() || null;
|
|
483
483
|
}
|
|
484
|
-
function
|
|
484
|
+
function Se(e) {
|
|
485
485
|
return `${e.primPath}\0${e.setName}`;
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function xt(e) {
|
|
488
488
|
let t = 0;
|
|
489
489
|
const n = () => {
|
|
490
490
|
for (; t < e.length; ) {
|
|
491
|
-
const
|
|
492
|
-
if (/\s/.test(
|
|
491
|
+
const i = e[t];
|
|
492
|
+
if (/\s/.test(i)) {
|
|
493
493
|
t++;
|
|
494
494
|
continue;
|
|
495
495
|
}
|
|
496
|
-
if (
|
|
496
|
+
if (i === "#") {
|
|
497
497
|
for (; t < e.length && e[t] !== `
|
|
498
498
|
`; ) t++;
|
|
499
499
|
continue;
|
|
500
500
|
}
|
|
501
|
-
if (
|
|
502
|
-
const p =
|
|
501
|
+
if (i === '"' || i === "@" || i === "<") {
|
|
502
|
+
const p = i === "<" ? ">" : i, g = i === '"' && e.slice(t, t + 3) === '"""';
|
|
503
503
|
t += g ? 3 : 1;
|
|
504
504
|
const u = t;
|
|
505
505
|
for (; t < e.length; ) {
|
|
@@ -509,14 +509,14 @@ function Mt(e) {
|
|
|
509
509
|
}
|
|
510
510
|
if (g ? e.slice(t, t + 3) === '"""' : e[t] === p) {
|
|
511
511
|
const f = e.slice(u, t);
|
|
512
|
-
return t += g ? 3 : 1, { kind:
|
|
512
|
+
return t += g ? 3 : 1, { kind: i === "<" ? "path" : "string", value: f };
|
|
513
513
|
}
|
|
514
514
|
t++;
|
|
515
515
|
}
|
|
516
516
|
throw new Error("Unterminated USDA string or path");
|
|
517
517
|
}
|
|
518
|
-
if ("{}()[]=,".includes(
|
|
519
|
-
return t++, { kind: "symbol", value:
|
|
518
|
+
if ("{}()[]=,".includes(i))
|
|
519
|
+
return t++, { kind: "symbol", value: i };
|
|
520
520
|
const l = t;
|
|
521
521
|
for (; t < e.length && !/[\s{}()\[\]=,<>"@#]/.test(e[t]); ) t++;
|
|
522
522
|
if (l === t) {
|
|
@@ -525,21 +525,21 @@ function Mt(e) {
|
|
|
525
525
|
}
|
|
526
526
|
return { kind: "word", value: e.slice(l, t) };
|
|
527
527
|
}
|
|
528
|
-
},
|
|
529
|
-
let
|
|
530
|
-
for (;
|
|
531
|
-
l.value === "[" && l.kind === "symbol" ?
|
|
532
|
-
if (
|
|
533
|
-
},
|
|
534
|
-
let
|
|
535
|
-
for (;
|
|
536
|
-
l.value === "{" && l.kind === "symbol" ?
|
|
537
|
-
if (
|
|
538
|
-
},
|
|
528
|
+
}, s = () => {
|
|
529
|
+
let i = 1, l;
|
|
530
|
+
for (; i && (l = n()); )
|
|
531
|
+
l.value === "[" && l.kind === "symbol" ? i++ : l.value === "]" && l.kind === "symbol" && i--;
|
|
532
|
+
if (i) throw new Error("Unterminated USDA list");
|
|
533
|
+
}, a = () => {
|
|
534
|
+
let i = 1, l;
|
|
535
|
+
for (; i && (l = n()); )
|
|
536
|
+
l.value === "{" && l.kind === "symbol" ? i++ : l.value === "}" && l.kind === "symbol" && i--;
|
|
537
|
+
if (i) throw new Error("Unterminated USDA dictionary");
|
|
538
|
+
}, o = /* @__PURE__ */ new Map(), r = [];
|
|
539
539
|
let c;
|
|
540
540
|
for (; c = n(); ) {
|
|
541
541
|
if (c.kind !== "word") {
|
|
542
|
-
c.kind === "symbol" && c.value === "[" ?
|
|
542
|
+
c.kind === "symbol" && c.value === "[" ? s() : c.kind === "symbol" && c.value === "{" ? a() : c.kind === "symbol" && c.value === "}" && r.pop();
|
|
543
543
|
continue;
|
|
544
544
|
}
|
|
545
545
|
if (["def", "over", "class"].includes(c.value)) {
|
|
@@ -551,7 +551,7 @@ function Mt(e) {
|
|
|
551
551
|
if (d.kind === "symbol" && d.value === "(") m++;
|
|
552
552
|
else if (d.kind === "symbol" && d.value === ")") m--;
|
|
553
553
|
else if (d.kind === "symbol" && d.value === "{") {
|
|
554
|
-
|
|
554
|
+
a();
|
|
555
555
|
continue;
|
|
556
556
|
}
|
|
557
557
|
if (d.kind === "word" && d.value === "apiSchemas") {
|
|
@@ -562,15 +562,15 @@ function Mt(e) {
|
|
|
562
562
|
for (; (d = n()) && d.value !== "]"; )
|
|
563
563
|
d.kind === "string" && d.value.startsWith("PhysxMimicJointAPI:") && w.schemas.push(d.value);
|
|
564
564
|
if (!d) throw new Error("Unterminated USDA apiSchemas");
|
|
565
|
-
} else d.value === "[" && d.kind === "symbol" &&
|
|
565
|
+
} else d.value === "[" && d.kind === "symbol" && s();
|
|
566
566
|
}
|
|
567
567
|
if (!d) throw new Error("Unterminated USDA prim header");
|
|
568
|
-
|
|
568
|
+
o.set(y, w), r.push({ path: y, prim: w });
|
|
569
569
|
continue;
|
|
570
570
|
}
|
|
571
571
|
if (c.value !== "rel" || !r.at(-1)) continue;
|
|
572
|
-
const
|
|
573
|
-
if (!
|
|
572
|
+
const i = n();
|
|
573
|
+
if (!i || i.kind !== "word" || !/^physxMimicJoint:[^:]+:referenceJoint$/.test(i.value)) continue;
|
|
574
574
|
const l = n(), p = n();
|
|
575
575
|
if ((l == null ? void 0 : l.value) !== "=" || !p) continue;
|
|
576
576
|
const g = [];
|
|
@@ -580,11 +580,11 @@ function Mt(e) {
|
|
|
580
580
|
for (; (u = n()) && u.value !== "]"; ) u.kind === "path" && g.push(u.value);
|
|
581
581
|
if (!u) throw new Error("Unterminated USDA relationship");
|
|
582
582
|
}
|
|
583
|
-
r.at(-1).prim.relationships.set(
|
|
583
|
+
r.at(-1).prim.relationships.set(i.value, g);
|
|
584
584
|
}
|
|
585
|
-
return new Map([...
|
|
585
|
+
return new Map([...o].filter(([, i]) => i.schemas.length || i.relationships.size));
|
|
586
586
|
}
|
|
587
|
-
const
|
|
587
|
+
const Ot = [
|
|
588
588
|
1,
|
|
589
589
|
0,
|
|
590
590
|
0,
|
|
@@ -602,102 +602,102 @@ const kt = [
|
|
|
602
602
|
0,
|
|
603
603
|
1
|
|
604
604
|
];
|
|
605
|
-
function
|
|
606
|
-
const t = new Map(e.map((
|
|
607
|
-
const r = n.get(
|
|
605
|
+
function Tt(e) {
|
|
606
|
+
const t = new Map(e.map((o) => [o.path, o])), n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), a = (o) => {
|
|
607
|
+
const r = n.get(o.path);
|
|
608
608
|
if (r) return r;
|
|
609
|
-
if (
|
|
610
|
-
|
|
611
|
-
const c =
|
|
612
|
-
return
|
|
609
|
+
if (s.has(o.path)) return be(o.localMatrix);
|
|
610
|
+
s.add(o.path);
|
|
611
|
+
const c = be(o.localMatrix), i = o.parentPath ? t.get(o.parentPath) : void 0, l = !i || o.resetsXformStack ? c : Ee(c, a(i));
|
|
612
|
+
return s.delete(o.path), n.set(o.path, l), l;
|
|
613
613
|
};
|
|
614
|
-
return e.map((
|
|
615
|
-
if (!
|
|
616
|
-
const r = t.get(
|
|
617
|
-
if (!r) return
|
|
618
|
-
const c =
|
|
619
|
-
return
|
|
620
|
-
...
|
|
621
|
-
localMatrix:
|
|
622
|
-
} :
|
|
614
|
+
return e.map((o) => {
|
|
615
|
+
if (!o.resetsXformStack || !o.parentPath) return o;
|
|
616
|
+
const r = t.get(o.parentPath);
|
|
617
|
+
if (!r) return o;
|
|
618
|
+
const c = a(r), i = Lt(c);
|
|
619
|
+
return i ? {
|
|
620
|
+
...o,
|
|
621
|
+
localMatrix: Ee(a(o), i)
|
|
622
|
+
} : o;
|
|
623
623
|
});
|
|
624
624
|
}
|
|
625
|
-
function
|
|
626
|
-
return
|
|
625
|
+
function be(e) {
|
|
626
|
+
return $t(e) ? e : Ot;
|
|
627
627
|
}
|
|
628
|
-
function
|
|
628
|
+
function $t(e) {
|
|
629
629
|
return (e == null ? void 0 : e.length) === 16 && e.every(Number.isFinite);
|
|
630
630
|
}
|
|
631
|
-
function
|
|
631
|
+
function Ee(e, t) {
|
|
632
632
|
const n = new Array(16);
|
|
633
|
-
for (let
|
|
634
|
-
for (let
|
|
635
|
-
let
|
|
633
|
+
for (let s = 0; s < 4; s++)
|
|
634
|
+
for (let a = 0; a < 4; a++) {
|
|
635
|
+
let o = 0;
|
|
636
636
|
for (let r = 0; r < 4; r++)
|
|
637
|
-
|
|
638
|
-
n[
|
|
637
|
+
o += e[s * 4 + r] * t[r * 4 + a];
|
|
638
|
+
n[s * 4 + a] = o;
|
|
639
639
|
}
|
|
640
640
|
return n;
|
|
641
641
|
}
|
|
642
|
-
function
|
|
642
|
+
function Lt(e) {
|
|
643
643
|
const [
|
|
644
644
|
t,
|
|
645
645
|
n,
|
|
646
|
-
o,
|
|
647
|
-
,
|
|
648
|
-
i,
|
|
649
646
|
s,
|
|
647
|
+
,
|
|
648
|
+
a,
|
|
649
|
+
o,
|
|
650
650
|
r,
|
|
651
651
|
,
|
|
652
652
|
c,
|
|
653
|
-
|
|
653
|
+
i,
|
|
654
654
|
l,
|
|
655
655
|
,
|
|
656
656
|
p,
|
|
657
657
|
g,
|
|
658
658
|
u
|
|
659
|
-
] = e, f =
|
|
660
|
-
Math.abs(t *
|
|
661
|
-
Math.abs(t * r *
|
|
662
|
-
Math.abs(n *
|
|
659
|
+
] = e, f = o * l - r * i, h = s * i - n * l, y = n * r - s * o, w = t * f + a * h + c * y, d = Math.max(
|
|
660
|
+
Math.abs(t * o * l),
|
|
661
|
+
Math.abs(t * r * i),
|
|
662
|
+
Math.abs(n * a * l),
|
|
663
663
|
Math.abs(n * r * c),
|
|
664
|
-
Math.abs(
|
|
665
|
-
Math.abs(
|
|
664
|
+
Math.abs(s * a * i),
|
|
665
|
+
Math.abs(s * o * c),
|
|
666
666
|
1
|
|
667
667
|
);
|
|
668
668
|
if (!Number.isFinite(w) || Math.abs(w) <= Number.EPSILON * d * 16)
|
|
669
669
|
return null;
|
|
670
|
-
const m = 1 / w, S = f * m, _ = h * m, O = y * m,
|
|
670
|
+
const m = 1 / w, S = f * m, _ = h * m, O = y * m, B = (r * c - a * l) * m, j = (t * l - s * c) * m, F = (s * a - t * r) * m, H = (a * i - o * c) * m, J = (n * c - t * i) * m, V = (t * o - n * a) * m;
|
|
671
671
|
return [
|
|
672
672
|
S,
|
|
673
673
|
_,
|
|
674
674
|
O,
|
|
675
675
|
0,
|
|
676
|
-
|
|
676
|
+
B,
|
|
677
677
|
j,
|
|
678
|
-
|
|
678
|
+
F,
|
|
679
679
|
0,
|
|
680
|
-
|
|
680
|
+
H,
|
|
681
681
|
J,
|
|
682
682
|
V,
|
|
683
683
|
0,
|
|
684
|
-
-(p * S + g *
|
|
684
|
+
-(p * S + g * B + u * H),
|
|
685
685
|
-(p * _ + g * j + u * J),
|
|
686
|
-
-(p * O + g *
|
|
686
|
+
-(p * O + g * F + u * V),
|
|
687
687
|
1
|
|
688
688
|
];
|
|
689
689
|
}
|
|
690
|
-
function
|
|
690
|
+
function Ct(e, t = []) {
|
|
691
691
|
return {
|
|
692
692
|
stage: e.stage,
|
|
693
693
|
view: {
|
|
694
694
|
...e.view,
|
|
695
|
-
prims:
|
|
695
|
+
prims: Tt(e.view.prims)
|
|
696
696
|
},
|
|
697
697
|
elements: e.elements,
|
|
698
698
|
materials: e.materials,
|
|
699
699
|
materialAliases: e.materialAliases,
|
|
700
|
-
physics:
|
|
700
|
+
physics: Vt(),
|
|
701
701
|
joints: [],
|
|
702
702
|
cameras: [],
|
|
703
703
|
lights: [],
|
|
@@ -706,10 +706,10 @@ function $t(e, t = []) {
|
|
|
706
706
|
variants: t
|
|
707
707
|
};
|
|
708
708
|
}
|
|
709
|
-
function
|
|
709
|
+
function jt(e, t) {
|
|
710
710
|
e.physics = t.physics, e.joints = t.joints;
|
|
711
711
|
}
|
|
712
|
-
function
|
|
712
|
+
function Vt() {
|
|
713
713
|
return {
|
|
714
714
|
scenes: [],
|
|
715
715
|
rigidBodies: [],
|
|
@@ -718,17 +718,17 @@ function Ct() {
|
|
|
718
718
|
articulationRoots: []
|
|
719
719
|
};
|
|
720
720
|
}
|
|
721
|
-
const
|
|
721
|
+
const Gt = /^(Warning|Error|Fatal|Info|Runtime Error|Coding Error):\s+in\s+(\S+)\s+at line \d+ of .*?\s+--\s+([\s\S]*)$/s, Bt = /(^|[\s(\[])(?:[A-Za-z]:[\\/]|\/)(?:[^ \t\r\n()'"]+[\\/])*[^ \t\r\n()'"]+\.(?:cpp|cxx|cc|hpp|c|h|mjs|js|ts)(?::\d+)*/gi, Ft = /<0x[0-9a-f]+>/gi, zt = /* @__PURE__ */ new Set([
|
|
722
722
|
"USD_MATERIAL_BINDING_API_MISSING",
|
|
723
723
|
"USD_EXTERNAL_REFERENCE_UNRESOLVED"
|
|
724
724
|
]);
|
|
725
|
-
function
|
|
726
|
-
const t =
|
|
727
|
-
return (t ? `${t[1]}: ${t[2]} -- ${t[3]}` : e).replace(
|
|
725
|
+
function Wt(e) {
|
|
726
|
+
const t = Gt.exec(e);
|
|
727
|
+
return (t ? `${t[1]}: ${t[2]} -- ${t[3]}` : e).replace(Bt, "$1<OpenUSD source>").replace(Ft, "<stage>").trim();
|
|
728
728
|
}
|
|
729
|
-
function
|
|
729
|
+
function Ht(e) {
|
|
730
730
|
if (!e || /^(?:Info|Status):/.test(e)) return null;
|
|
731
|
-
const t =
|
|
731
|
+
const t = Wt(e);
|
|
732
732
|
if (!t) return null;
|
|
733
733
|
if (/Found material bindings on prim at path .* but MaterialBindingAPI is not applied/.test(t))
|
|
734
734
|
return { severity: "warning", code: "USD_MATERIAL_BINDING_API_MISSING", message: t };
|
|
@@ -748,63 +748,87 @@ function zt(e) {
|
|
|
748
748
|
message: t
|
|
749
749
|
};
|
|
750
750
|
}
|
|
751
|
-
function
|
|
752
|
-
const t = e.console ?? console, n = /* @__PURE__ */ new Set(),
|
|
753
|
-
let
|
|
754
|
-
const
|
|
755
|
-
var
|
|
751
|
+
function Ue(e = {}) {
|
|
752
|
+
const t = e.console ?? console, n = /* @__PURE__ */ new Set(), s = Math.max(1, e.maxUniqueDiagnostics ?? 64);
|
|
753
|
+
let a = !1;
|
|
754
|
+
const o = (r) => {
|
|
755
|
+
var i;
|
|
756
756
|
const c = r.code === "USD_MATERIAL_BINDING_API_MISSING" ? r.code : `${r.code}\0${r.message}`;
|
|
757
757
|
if (!n.has(c)) {
|
|
758
|
-
if (n.size >=
|
|
759
|
-
|
|
760
|
-
`[openusd] further runtime diagnostics suppressed after ${
|
|
758
|
+
if (n.size >= s) {
|
|
759
|
+
a || (a = !0, t.warn(
|
|
760
|
+
`[openusd] further runtime diagnostics suppressed after ${s} unique messages`
|
|
761
761
|
));
|
|
762
762
|
return;
|
|
763
763
|
}
|
|
764
|
-
n.add(c), (
|
|
764
|
+
n.add(c), (i = e.onDiagnostic) == null || i.call(e, r), !e.onDiagnostic && (zt.has(r.code) || (r.severity === "error" ? t.error(r.message) : t.warn(r.message)));
|
|
765
765
|
}
|
|
766
766
|
};
|
|
767
767
|
return (r) => {
|
|
768
768
|
const c = String(r ?? "");
|
|
769
|
-
for (const
|
|
770
|
-
const l =
|
|
771
|
-
l &&
|
|
769
|
+
for (const i of c.split(/\r?\n/)) {
|
|
770
|
+
const l = Ht(i.trim());
|
|
771
|
+
l && o(l);
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
const ue = "[USD material] ", Xt = /* @__PURE__ */ new WeakMap();
|
|
776
|
+
function Jt(e) {
|
|
777
|
+
const t = [], n = console.warn;
|
|
778
|
+
console.warn = (...s) => {
|
|
779
|
+
const a = s.length === 1 && typeof s[0] == "string" && s[0].startsWith(ue) ? s[0].slice(ue.length) : null;
|
|
780
|
+
if (a !== null) {
|
|
781
|
+
t.push(a);
|
|
782
|
+
return;
|
|
772
783
|
}
|
|
784
|
+
n(...s);
|
|
773
785
|
};
|
|
786
|
+
try {
|
|
787
|
+
return { value: e(), warnings: Object.freeze(t) };
|
|
788
|
+
} catch (s) {
|
|
789
|
+
for (const a of t)
|
|
790
|
+
n(`${ue}${a}`);
|
|
791
|
+
throw s;
|
|
792
|
+
} finally {
|
|
793
|
+
console.warn = n;
|
|
794
|
+
}
|
|
774
795
|
}
|
|
775
|
-
|
|
776
|
-
|
|
796
|
+
function qt(e, t) {
|
|
797
|
+
t.length && Xt.set(e, Object.freeze([...t]));
|
|
798
|
+
}
|
|
799
|
+
const Zt = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
|
|
800
|
+
async function Yt(e) {
|
|
777
801
|
const t = await import(
|
|
778
802
|
/* @vite-ignore */
|
|
779
803
|
e.moduleUrl
|
|
780
|
-
), n = t.default ?? t.createOpenUsdProbe,
|
|
781
|
-
printErr:
|
|
804
|
+
), n = t.default ?? t.createOpenUsdProbe, s = e.wasmModule ? {
|
|
805
|
+
printErr: Ue({ onDiagnostic: e.onRuntimeDiagnostic }),
|
|
782
806
|
instantiateWasm(w, d) {
|
|
783
|
-
return
|
|
807
|
+
return At(e.wasmModule, w, d);
|
|
784
808
|
}
|
|
785
809
|
} : {
|
|
786
|
-
printErr:
|
|
787
|
-
wasmBinary: await (typeof e.wasmBinary == "function" ? e.wasmBinary() : e.wasmBinary ??
|
|
788
|
-
},
|
|
789
|
-
if (r !==
|
|
810
|
+
printErr: Ue({ onDiagnostic: e.onRuntimeDiagnostic }),
|
|
811
|
+
wasmBinary: await (typeof e.wasmBinary == "function" ? e.wasmBinary() : e.wasmBinary ?? an(e.wasmUrl))
|
|
812
|
+
}, a = await n(s), o = e.apiVersion ?? Pt.apiVersion, r = Number(a.ccall("usd_probe_api_version", "number", [], []));
|
|
813
|
+
if (r !== o)
|
|
790
814
|
throw Object.assign(
|
|
791
|
-
new Error(`OpenUSD runtime API mismatch: expected ${
|
|
815
|
+
new Error(`OpenUSD runtime API mismatch: expected ${o}, received ${r}.`),
|
|
792
816
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
793
817
|
);
|
|
794
|
-
const c = e.memfsRoot ?? "/asset",
|
|
818
|
+
const c = e.memfsRoot ?? "/asset", i = e.fetchBytes ?? (async (w) => {
|
|
795
819
|
const d = await fetch(w);
|
|
796
820
|
if (!d.ok) throw Object.assign(new Error(`USD resource request failed (${d.status}): ${w}`), {
|
|
797
821
|
code: d.status === 401 || d.status === 403 ? "E_ASSET_AUTH" : "E_ASSET_FETCH"
|
|
798
822
|
});
|
|
799
|
-
const m = new Uint8Array(await d.arrayBuffer()), S =
|
|
800
|
-
if (S) throw
|
|
823
|
+
const m = new Uint8Array(await d.arrayBuffer()), S = nt(d.headers.get("content-type"), m);
|
|
824
|
+
if (S) throw Ke(`USD resource is not usable (${S}): ${w}`, Ae);
|
|
801
825
|
return m;
|
|
802
|
-
}), l = (w, d, m) => JSON.parse(
|
|
826
|
+
}), l = (w, d, m) => JSON.parse(a.ccall(w, "string", d, m)), p = /* @__PURE__ */ new Set(), g = ve(a);
|
|
803
827
|
let u = 0, f = null;
|
|
804
828
|
async function h() {
|
|
805
829
|
return f || (f = (async () => {
|
|
806
830
|
const w = `${c}/__viewer_warmup__`, d = `${w}/empty.usda`;
|
|
807
|
-
|
|
831
|
+
a.FS.mkdirTree(w), a.FS.writeFile(d, new TextEncoder().encode(`#usda 1.0
|
|
808
832
|
`));
|
|
809
833
|
let m;
|
|
810
834
|
try {
|
|
@@ -813,82 +837,82 @@ async function Wt(e) {
|
|
|
813
837
|
throw new Error(S.error ?? "Failed to initialize the USD Stage runtime.");
|
|
814
838
|
m = S.stageId;
|
|
815
839
|
} finally {
|
|
816
|
-
m !== void 0 && l("usd_probe_stage_release", ["number"], [m]),
|
|
840
|
+
m !== void 0 && l("usd_probe_stage_release", ["number"], [m]), a.FS.analyzePath(d, !0).exists && a.FS.unlink(d);
|
|
817
841
|
}
|
|
818
842
|
})(), f);
|
|
819
843
|
}
|
|
820
844
|
async function y(w, d) {
|
|
821
|
-
const m = new URL(d.sourcePath, "file:///"), S = `${c}/load-${++u}`, _ =
|
|
822
|
-
let b,
|
|
845
|
+
const m = new URL(d.sourcePath, "file:///"), S = `${c}/load-${++u}`, _ = q(m.href, S), O = /* @__PURE__ */ new Set(), B = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map(), F = d.readTextureBytes ?? !0, H = d.collectTextureUrls ?? !F, J = H || F ? ke : sn, V = /* @__PURE__ */ new Map();
|
|
846
|
+
let b, M = null, U = null;
|
|
823
847
|
const R = () => {
|
|
824
|
-
b !== void 0 && p.delete(b) && l("usd_probe_stage_release", ["number"], [b]),
|
|
848
|
+
b !== void 0 && p.delete(b) && l("usd_probe_stage_release", ["number"], [b]), M == null || M.dispose(), Ce(a.FS, S);
|
|
825
849
|
};
|
|
826
850
|
try {
|
|
827
|
-
const A = await
|
|
828
|
-
|
|
851
|
+
const A = await Pe(w);
|
|
852
|
+
fe(a, _, A, O), B.set(_, J(A));
|
|
829
853
|
for (const [E, $] of Object.entries(d.files ?? {})) {
|
|
830
|
-
const
|
|
831
|
-
O.has(
|
|
854
|
+
const X = q(new URL(E, m).href, S), W = await Pe($);
|
|
855
|
+
O.has(X) || B.set(X, J(W)), fe(a, X, W, O);
|
|
832
856
|
}
|
|
833
857
|
const k = new Set(O);
|
|
834
858
|
for (const E of d.packagePaths ?? [])
|
|
835
|
-
k.add(
|
|
836
|
-
const v = d.externalReferenceMode ?? "complete", I =
|
|
837
|
-
let P = {},
|
|
859
|
+
k.add(q(new URL(E, m).href, S));
|
|
860
|
+
const v = d.externalReferenceMode ?? "complete", I = ft(A) ? await dt(A, { include: Re }) : null;
|
|
861
|
+
let P = {}, D, N;
|
|
838
862
|
if (!I && d.autoResolveAssets !== !1) {
|
|
839
|
-
const E = d.resolveBytes ?? ((
|
|
840
|
-
|
|
863
|
+
const E = d.resolveBytes ?? ((X) => i(X)), $ = await tn(
|
|
864
|
+
a,
|
|
841
865
|
m,
|
|
842
866
|
S,
|
|
843
867
|
E,
|
|
844
868
|
l,
|
|
845
869
|
O,
|
|
846
870
|
V,
|
|
847
|
-
|
|
848
|
-
|
|
871
|
+
H ? j : null,
|
|
872
|
+
B,
|
|
849
873
|
d.maxFiles ?? 1024,
|
|
850
874
|
d.maxDepth ?? 8,
|
|
851
875
|
d.maxConcurrency ?? 1,
|
|
852
876
|
v,
|
|
853
877
|
k,
|
|
854
|
-
|
|
878
|
+
F,
|
|
855
879
|
d,
|
|
856
880
|
d.onReferenceSkipped,
|
|
857
881
|
d.onResourceFailed
|
|
858
882
|
);
|
|
859
|
-
P = $.mappings,
|
|
883
|
+
P = $.mappings, D = $.opened, N = $.variantConfiguration;
|
|
860
884
|
} else {
|
|
861
|
-
if (
|
|
862
|
-
|
|
885
|
+
if (D = Object.keys(P).length > 0 ? l("usd_probe_stage_open_mapped", ["string", "string"], [_, JSON.stringify(P)]) : l("usd_probe_stage_open", ["string"], [_]), !D.ok) throw new Error(D.error ?? `Failed to open ${_}`);
|
|
886
|
+
N = De(a, D, d, !0);
|
|
863
887
|
}
|
|
864
|
-
|
|
865
|
-
const x = d.textureResolver ||
|
|
888
|
+
M = I ? ht(I) : null;
|
|
889
|
+
const x = d.textureResolver || M ? (E) => {
|
|
866
890
|
var $;
|
|
867
|
-
return (($ = d.textureResolver) == null ? void 0 : $.call(d, E)) ?? (
|
|
891
|
+
return (($ = d.textureResolver) == null ? void 0 : $.call(d, E)) ?? (M == null ? void 0 : M.resolve(E)) ?? null;
|
|
868
892
|
} : void 0;
|
|
869
|
-
b =
|
|
870
|
-
const { discoveredVariants: T, selections:
|
|
893
|
+
b = D.stageId, p.add(D.stageId);
|
|
894
|
+
const { discoveredVariants: T, selections: z } = N, G = ve(a, V, _), L = G.openStage(D.stageId), oe = await Kt(a, D.stageId, _, {
|
|
871
895
|
batchSize: d.geometryBatchSize,
|
|
872
896
|
onProgress: d.onGeometryProgress
|
|
873
897
|
});
|
|
874
|
-
|
|
875
|
-
const
|
|
898
|
+
Le(oe.materials, V, m), $e(oe.materials, V);
|
|
899
|
+
const je = new Map(z.map((E) => [
|
|
876
900
|
`${E.primPath}\0${E.setName}`,
|
|
877
901
|
E.selection
|
|
878
|
-
])),
|
|
902
|
+
])), Ve = T.map((E) => ({
|
|
879
903
|
...E,
|
|
880
|
-
selection:
|
|
881
|
-
})), ae =
|
|
904
|
+
selection: je.get(`${E.primPath}\0${E.setName}`) ?? E.selection
|
|
905
|
+
})), ae = Ct(oe, Ve), de = d.isTextureAllowed ?? (v === "package" ? (E) => {
|
|
882
906
|
const $ = new URL(E, m);
|
|
883
|
-
return k.has(
|
|
884
|
-
} : void 0),
|
|
907
|
+
return k.has(q($.href, S)) || Ie($, m);
|
|
908
|
+
} : void 0), he = I ? void 0 : de ? (E) => j.has(E) || de(E) : j.size > 0 ? (E) => j.has(E) : void 0;
|
|
885
909
|
return {
|
|
886
910
|
data: ae,
|
|
887
911
|
pxr: G,
|
|
888
912
|
stage: L,
|
|
889
913
|
entryPath: _,
|
|
890
914
|
textureURLs: j,
|
|
891
|
-
...
|
|
915
|
+
...M ? { packageTextures: M } : {},
|
|
892
916
|
buildModel: async () => {
|
|
893
917
|
const { createUSDLoadedModel: E } = await import("@openusd-wasm/three-loader"), $ = () => E(
|
|
894
918
|
ae,
|
|
@@ -910,25 +934,27 @@ async function Wt(e) {
|
|
|
910
934
|
{
|
|
911
935
|
// Keep package texture identities on the model so the visual adapter
|
|
912
936
|
// can resolve textures referenced by unsupported-but-known MDL nodes.
|
|
913
|
-
usdzTextureURLs: (
|
|
937
|
+
usdzTextureURLs: (M == null ? void 0 : M.urls) ?? /* @__PURE__ */ new Map(),
|
|
914
938
|
autoTextureURLs: /* @__PURE__ */ new Map()
|
|
915
939
|
}
|
|
916
|
-
),
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
940
|
+
), X = Jt(
|
|
941
|
+
() => he ? Fe(ae.materials, he, $) : $()
|
|
942
|
+
), W = X.value;
|
|
943
|
+
qt(W, X.warnings), W.usdQuery = Ne(L, G);
|
|
944
|
+
const Ge = W.dispose.bind(W);
|
|
945
|
+
let pe = !1;
|
|
946
|
+
return W.dispose = () => {
|
|
947
|
+
pe || (pe = !0, Ge(), R());
|
|
948
|
+
}, W;
|
|
923
949
|
},
|
|
924
950
|
readPhysics() {
|
|
925
951
|
return U || (U = (async () => {
|
|
926
|
-
if (typeof
|
|
952
|
+
if (typeof a._usd_probe_scene_physics != "function")
|
|
927
953
|
throw Object.assign(
|
|
928
954
|
new Error("USD physics phase requires the matching packaged openusd_probe runtime."),
|
|
929
955
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
930
956
|
);
|
|
931
|
-
const E = l("usd_probe_scene_physics", ["number"], [
|
|
957
|
+
const E = l("usd_probe_scene_physics", ["number"], [D.stageId]);
|
|
932
958
|
if (E.ok !== !0) throw new Error(String(E.error ?? "Failed to extract USD physics."));
|
|
933
959
|
return E;
|
|
934
960
|
})(), U);
|
|
@@ -940,13 +966,13 @@ async function Wt(e) {
|
|
|
940
966
|
}
|
|
941
967
|
}
|
|
942
968
|
return {
|
|
943
|
-
runtime:
|
|
969
|
+
runtime: a,
|
|
944
970
|
pxr: g,
|
|
945
971
|
warmup: h,
|
|
946
972
|
async parseAsync(w, d) {
|
|
947
973
|
const m = await y(w, d);
|
|
948
974
|
try {
|
|
949
|
-
return
|
|
975
|
+
return jt(m.data, await m.readPhysics()), await m.buildModel();
|
|
950
976
|
} catch (S) {
|
|
951
977
|
throw m.release(), S;
|
|
952
978
|
}
|
|
@@ -956,9 +982,9 @@ async function Wt(e) {
|
|
|
956
982
|
}
|
|
957
983
|
};
|
|
958
984
|
}
|
|
959
|
-
function
|
|
960
|
-
const
|
|
961
|
-
class
|
|
985
|
+
function ve(e, t = /* @__PURE__ */ new Map(), n) {
|
|
986
|
+
const s = (u, f, h) => JSON.parse(e.ccall(u, "string", f, h));
|
|
987
|
+
class a {
|
|
962
988
|
constructor(f) {
|
|
963
989
|
this.path = f;
|
|
964
990
|
}
|
|
@@ -968,29 +994,29 @@ function Ue(e, t = /* @__PURE__ */ new Map(), n) {
|
|
|
968
994
|
delete() {
|
|
969
995
|
}
|
|
970
996
|
}
|
|
971
|
-
let
|
|
997
|
+
let o;
|
|
972
998
|
const r = /* @__PURE__ */ new Map(), c = (u, f) => {
|
|
973
|
-
if (!
|
|
999
|
+
if (!o) {
|
|
974
1000
|
const S = e._usd_probe_flatten_stage;
|
|
975
1001
|
if (n && typeof S == "function") {
|
|
976
1002
|
const _ = e.ccall("usd_probe_flatten_stage", "string", ["string"], [n]);
|
|
977
1003
|
if (typeof _ != "string" || !_.startsWith("#usda")) throw new Error("Unable to read flattened USD joint metadata");
|
|
978
|
-
|
|
1004
|
+
o = xt(_);
|
|
979
1005
|
} else
|
|
980
|
-
|
|
1006
|
+
o = /* @__PURE__ */ new Map();
|
|
981
1007
|
}
|
|
982
|
-
const h =
|
|
1008
|
+
const h = o.get(f);
|
|
983
1009
|
if (h || r.has(f)) return h ?? r.get(f);
|
|
984
1010
|
const y = ["rotX", "rotY", "rotZ", "transX", "transY", "transZ", "X", "Y", "Z"], w = [], d = /* @__PURE__ */ new Map();
|
|
985
1011
|
for (const S of y) {
|
|
986
|
-
const _ = `physxMimicJoint:${S}:referenceJoint`, O =
|
|
1012
|
+
const _ = `physxMimicJoint:${S}:referenceJoint`, O = s("usd_probe_relationship_targets", ["number", "string", "string"], [u, f, _]).paths ?? [];
|
|
987
1013
|
O.length && (w.push(`PhysxMimicJointAPI:${S}`), d.set(_, O));
|
|
988
1014
|
}
|
|
989
1015
|
const m = w.length ? { schemas: w, relationships: d } : void 0;
|
|
990
1016
|
return m && r.set(f, m), m;
|
|
991
|
-
},
|
|
1017
|
+
}, i = (u, f, h) => {
|
|
992
1018
|
let y = null;
|
|
993
|
-
const w = () => y ?? (y =
|
|
1019
|
+
const w = () => y ?? (y = s(
|
|
994
1020
|
"usd_probe_attribute_value",
|
|
995
1021
|
["number", "string", "string"],
|
|
996
1022
|
[u, f, h]
|
|
@@ -1004,22 +1030,22 @@ function Ue(e, t = /* @__PURE__ */ new Map(), n) {
|
|
|
1004
1030
|
HasAuthoredValue: () => w().authored === !0,
|
|
1005
1031
|
GetName: () => h,
|
|
1006
1032
|
GetMetadata: (d) => {
|
|
1007
|
-
const m =
|
|
1033
|
+
const m = s("usd_probe_attribute_metadata", ["number", "string", "string", "string"], [u, f, h, d]);
|
|
1008
1034
|
return m.valid === !0 && m.found === !0 ? m.value ?? null : null;
|
|
1009
1035
|
},
|
|
1010
1036
|
// The viewer accepts either plain strings or objects with GetString().
|
|
1011
|
-
GetConnections: () =>
|
|
1037
|
+
GetConnections: () => s("usd_probe_attribute_connections", ["number", "string", "string"], [u, f, h]).paths ?? [],
|
|
1012
1038
|
delete: () => {
|
|
1013
1039
|
}
|
|
1014
1040
|
};
|
|
1015
1041
|
}, l = (u, f) => ({
|
|
1016
1042
|
__path: f,
|
|
1017
1043
|
__stageId: u,
|
|
1018
|
-
IsValid: () =>
|
|
1044
|
+
IsValid: () => s("usd_probe_prim_info", ["number", "string"], [u, f]).valid === !0,
|
|
1019
1045
|
GetName: () => String(f.split("/").pop() ?? ""),
|
|
1020
|
-
GetPath: () => new
|
|
1021
|
-
GetTypeName: () => String(
|
|
1022
|
-
IsInstance: () =>
|
|
1046
|
+
GetPath: () => new a(f),
|
|
1047
|
+
GetTypeName: () => String(s("usd_probe_prim_info", ["number", "string"], [u, f]).typeName ?? ""),
|
|
1048
|
+
IsInstance: () => s("usd_probe_prim_info", ["number", "string"], [u, f]).instance === !0,
|
|
1023
1049
|
GetAppliedSchemas: () => {
|
|
1024
1050
|
var h;
|
|
1025
1051
|
return ((h = c(u, f)) == null ? void 0 : h.schemas) ?? [];
|
|
@@ -1028,29 +1054,29 @@ function Ue(e, t = /* @__PURE__ */ new Map(), n) {
|
|
|
1028
1054
|
var h;
|
|
1029
1055
|
return [...((h = c(u, f)) == null ? void 0 : h.relationships) ?? []].map(([y, w]) => ({
|
|
1030
1056
|
GetName: () => y,
|
|
1031
|
-
GetTargets: () => w.map((d) => new
|
|
1057
|
+
GetTargets: () => w.map((d) => new a(d)),
|
|
1032
1058
|
delete: () => {
|
|
1033
1059
|
}
|
|
1034
1060
|
}));
|
|
1035
1061
|
},
|
|
1036
|
-
GetAttribute: (h) =>
|
|
1037
|
-
GetAttributes: () => (
|
|
1038
|
-
GetChildren: () => (
|
|
1062
|
+
GetAttribute: (h) => i(u, f, h),
|
|
1063
|
+
GetAttributes: () => (s("usd_probe_prim_attributes", ["number", "string"], [u, f]).names ?? []).map((h) => i(u, f, h)),
|
|
1064
|
+
GetChildren: () => (s("usd_probe_prim_children", ["number", "string"], [u, f]).paths ?? []).map((h) => l(u, h)),
|
|
1039
1065
|
GetRelationship: (h) => {
|
|
1040
|
-
const y =
|
|
1066
|
+
const y = s(
|
|
1041
1067
|
"usd_probe_relationship_targets",
|
|
1042
1068
|
["number", "string", "string"],
|
|
1043
1069
|
[u, f, h]
|
|
1044
1070
|
).paths ?? [];
|
|
1045
1071
|
return {
|
|
1046
1072
|
GetName: () => h,
|
|
1047
|
-
GetTargets: () => y.map((w) => new
|
|
1073
|
+
GetTargets: () => y.map((w) => new a(w)),
|
|
1048
1074
|
delete: () => {
|
|
1049
1075
|
}
|
|
1050
1076
|
};
|
|
1051
1077
|
},
|
|
1052
1078
|
GetMetadata: (h) => {
|
|
1053
|
-
const y =
|
|
1079
|
+
const y = s("usd_probe_prim_metadata", ["number", "string", "string"], [u, f, h]);
|
|
1054
1080
|
return y.valid !== !0 ? null : typeof y.text == "string" ? y.text : y.found === !0 ? y.value : null;
|
|
1055
1081
|
},
|
|
1056
1082
|
delete: () => {
|
|
@@ -1061,13 +1087,13 @@ function Ue(e, t = /* @__PURE__ */ new Map(), n) {
|
|
|
1061
1087
|
// Stage-level metadata (metersPerUnit, upAxis, defaultPrim) is authored on
|
|
1062
1088
|
// the layer, not composed onto the pseudo-root prim.
|
|
1063
1089
|
GetMetadata: (f) => {
|
|
1064
|
-
const h =
|
|
1090
|
+
const h = s("usd_probe_stage_metadata", ["number", "string"], [u, f]);
|
|
1065
1091
|
return h.found === !0 ? h.value : null;
|
|
1066
1092
|
},
|
|
1067
1093
|
GetName: () => "",
|
|
1068
1094
|
IsValid: () => !0
|
|
1069
1095
|
}),
|
|
1070
|
-
GetDescendants: (f, h = "") =>
|
|
1096
|
+
GetDescendants: (f, h = "") => s(
|
|
1071
1097
|
"usd_probe_prim_descendants",
|
|
1072
1098
|
["number", "string", "string"],
|
|
1073
1099
|
[u, f, h]
|
|
@@ -1087,12 +1113,12 @@ function Ue(e, t = /* @__PURE__ */ new Map(), n) {
|
|
|
1087
1113
|
deleteFile: (u) => g.unlink(u),
|
|
1088
1114
|
deleteDir: (u) => g.rmdir(u)
|
|
1089
1115
|
},
|
|
1090
|
-
Sdf: { Path:
|
|
1116
|
+
Sdf: { Path: a },
|
|
1091
1117
|
Usd: { TimeCode: { Default: () => ({ delete: () => {
|
|
1092
1118
|
} }) } },
|
|
1093
1119
|
UsdShade: {
|
|
1094
1120
|
ComputeBoundMaterialPath: (u) => {
|
|
1095
|
-
const f =
|
|
1121
|
+
const f = s("usd_probe_bound_material", ["number", "string"], [u.__stageId, u.__path]);
|
|
1096
1122
|
return f.found !== !0 ? null : {
|
|
1097
1123
|
materialPath: String(f.materialPath ?? ""),
|
|
1098
1124
|
resolvedTargetPath: String(f.resolvedTargetPath ?? ""),
|
|
@@ -1101,28 +1127,28 @@ function Ue(e, t = /* @__PURE__ */ new Map(), n) {
|
|
|
1101
1127
|
}
|
|
1102
1128
|
},
|
|
1103
1129
|
UsdUtils: {
|
|
1104
|
-
ExtractSanitizedExternalReferences: (u) =>
|
|
1130
|
+
ExtractSanitizedExternalReferences: (u) => s("usd_probe_external_references", ["string"], [u]).paths ?? []
|
|
1105
1131
|
},
|
|
1106
1132
|
openStage: p
|
|
1107
1133
|
};
|
|
1108
1134
|
}
|
|
1109
|
-
async function
|
|
1135
|
+
async function Kt(e, t, n, s = {}) {
|
|
1110
1136
|
var c;
|
|
1111
1137
|
if (typeof e._usd_probe_scene_visual != "function" || typeof e._usd_probe_scene_geometry != "function" || typeof e._usd_probe_scene_geometry_end != "function")
|
|
1112
1138
|
throw Object.assign(
|
|
1113
1139
|
new Error("USD visual phases require the matching packaged openusd_probe runtime."),
|
|
1114
1140
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
1115
1141
|
);
|
|
1116
|
-
const
|
|
1142
|
+
const a = JSON.parse(e.ccall(
|
|
1117
1143
|
"usd_probe_scene_visual",
|
|
1118
1144
|
"string",
|
|
1119
1145
|
["number", "string"],
|
|
1120
1146
|
[t, n]
|
|
1121
1147
|
));
|
|
1122
|
-
if (
|
|
1123
|
-
const
|
|
1148
|
+
if (a.error) throw new Error(a.error);
|
|
1149
|
+
const o = a, r = Math.max(1, Math.floor(s.batchSize ?? 8));
|
|
1124
1150
|
try {
|
|
1125
|
-
for (const [
|
|
1151
|
+
for (const [i, l] of o.elements.entries()) {
|
|
1126
1152
|
const g = l.geometry.streamIndex;
|
|
1127
1153
|
if (!Number.isInteger(g))
|
|
1128
1154
|
throw new Error(`USD scene geometry is missing a stream index for ${l.path}`);
|
|
@@ -1134,24 +1160,24 @@ async function Jt(e, t, n, o = {}) {
|
|
|
1134
1160
|
));
|
|
1135
1161
|
if (!u.ok) throw new Error(u.error ?? `Failed to stream USD geometry for ${l.path}`);
|
|
1136
1162
|
l.geometry = Object.fromEntries(
|
|
1137
|
-
Object.entries(u.geometry ?? {}).map(([f, h]) => [f,
|
|
1138
|
-
), (c =
|
|
1163
|
+
Object.entries(u.geometry ?? {}).map(([f, h]) => [f, en(e, h)])
|
|
1164
|
+
), (c = s.onProgress) == null || c.call(s, i + 1, o.elements.length, l.path), (i + 1) % r === 0 && await Qt();
|
|
1139
1165
|
}
|
|
1140
1166
|
} finally {
|
|
1141
1167
|
e.ccall("usd_probe_scene_geometry_end", "string", ["number"], [t]);
|
|
1142
1168
|
}
|
|
1143
|
-
return
|
|
1169
|
+
return o;
|
|
1144
1170
|
}
|
|
1145
|
-
function
|
|
1171
|
+
function Qt() {
|
|
1146
1172
|
return new Promise((e) => setTimeout(e, 0));
|
|
1147
1173
|
}
|
|
1148
|
-
function
|
|
1174
|
+
function en(e, t) {
|
|
1149
1175
|
if (!t || typeof t != "object") return t ?? null;
|
|
1150
|
-
const { ptr: n, length:
|
|
1151
|
-
return typeof n != "number" ? t :
|
|
1176
|
+
const { ptr: n, length: s, kind: a } = t;
|
|
1177
|
+
return typeof n != "number" ? t : s ? (a === "i32" ? new Int32Array(e.HEAP32.buffer, n, s) : new Float32Array(e.HEAPF32.buffer, n, s)).slice() : a === "i32" ? new Int32Array() : new Float32Array();
|
|
1152
1178
|
}
|
|
1153
|
-
function De(e, t, n,
|
|
1154
|
-
const
|
|
1179
|
+
function De(e, t, n, s) {
|
|
1180
|
+
const a = (u, f, h) => JSON.parse(e.ccall(u, "string", f, h)), o = [...n.variantSelections ?? []];
|
|
1155
1181
|
let r = [];
|
|
1156
1182
|
if (n.selectMuJoCoPhysicsVariant !== !1) {
|
|
1157
1183
|
if (typeof e._usd_probe_stage_variants != "function")
|
|
@@ -1159,44 +1185,44 @@ function De(e, t, n, o) {
|
|
|
1159
1185
|
new Error("USD variant discovery requires the matching packaged openusd_probe runtime."),
|
|
1160
1186
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
1161
1187
|
);
|
|
1162
|
-
const u =
|
|
1188
|
+
const u = a("usd_probe_stage_variants", ["number"], [t.stageId]);
|
|
1163
1189
|
if (u.ok !== !0)
|
|
1164
1190
|
throw new Error(String(u.error ?? "Failed to enumerate USD variants."));
|
|
1165
1191
|
r = u.variants ?? [];
|
|
1166
1192
|
}
|
|
1167
|
-
const c = new Set(r.map(
|
|
1168
|
-
for (const u of [...
|
|
1169
|
-
p.set(
|
|
1193
|
+
const c = new Set(r.map(Z)), i = s || r.length === 0 ? o : o.filter((u) => c.has(Z(u))), l = n.selectMuJoCoPhysicsVariant === !1 ? [] : Dt(r, i), p = /* @__PURE__ */ new Map();
|
|
1194
|
+
for (const u of [...i, ...l])
|
|
1195
|
+
p.set(Z(u), u);
|
|
1170
1196
|
let g = [];
|
|
1171
1197
|
for (const u of p.values()) {
|
|
1172
|
-
const f =
|
|
1198
|
+
const f = a(
|
|
1173
1199
|
"usd_probe_stage_set_variant",
|
|
1174
1200
|
["number", "string", "string", "string"],
|
|
1175
1201
|
[t.stageId, u.primPath, u.setName, u.selection]
|
|
1176
1202
|
);
|
|
1177
1203
|
if (f.ok === !0)
|
|
1178
1204
|
g.push(u);
|
|
1179
|
-
else if (
|
|
1205
|
+
else if (s)
|
|
1180
1206
|
throw new Error(String(f.error ?? `Failed to select USD variant ${u.primPath}:${u.setName}=${u.selection}`));
|
|
1181
1207
|
}
|
|
1182
1208
|
if (n.selectMuJoCoPhysicsVariant !== !1) {
|
|
1183
|
-
const u = new Set(
|
|
1209
|
+
const u = new Set(i.map(Z)), f = /* @__PURE__ */ new Set();
|
|
1184
1210
|
for (const h of g) {
|
|
1185
|
-
const y =
|
|
1211
|
+
const y = Z(h);
|
|
1186
1212
|
if (u.has(y)) continue;
|
|
1187
1213
|
const w = r.find((S) => S.primPath === h.primPath && S.setName === h.setName);
|
|
1188
1214
|
if (!(w != null && w.selection) || w.selection === h.selection) continue;
|
|
1189
|
-
const d =
|
|
1215
|
+
const d = a(
|
|
1190
1216
|
"usd_probe_prim_descendants",
|
|
1191
1217
|
["number", "string", "string"],
|
|
1192
1218
|
[t.stageId, h.primPath, "MjcActuator"]
|
|
1193
1219
|
);
|
|
1194
1220
|
if (d.ok !== !0) {
|
|
1195
|
-
if (
|
|
1221
|
+
if (s) throw new Error(String(d.error ?? "Failed to inspect USD variants."));
|
|
1196
1222
|
continue;
|
|
1197
1223
|
}
|
|
1198
1224
|
if ((d.paths ?? []).length === 0) continue;
|
|
1199
|
-
const m =
|
|
1225
|
+
const m = a(
|
|
1200
1226
|
"usd_probe_stage_set_variant",
|
|
1201
1227
|
["number", "string", "string", "string"],
|
|
1202
1228
|
[t.stageId, h.primPath, h.setName, w.selection]
|
|
@@ -1205,50 +1231,50 @@ function De(e, t, n, o) {
|
|
|
1205
1231
|
throw new Error(String(m.error ?? `Failed to restore authored USD variant ${h.primPath}:${h.setName}=${w.selection}`));
|
|
1206
1232
|
f.add(y);
|
|
1207
1233
|
}
|
|
1208
|
-
f.size > 0 && (g = g.filter((h) => !f.has(
|
|
1234
|
+
f.size > 0 && (g = g.filter((h) => !f.has(Z(h))));
|
|
1209
1235
|
}
|
|
1210
1236
|
return { discoveredVariants: r, selections: g };
|
|
1211
1237
|
}
|
|
1212
|
-
async function
|
|
1213
|
-
const m = {}, S = [...f], _ =
|
|
1238
|
+
async function tn(e, t, n, s, a, o, r, c, i, l, p, g, u, f, h, y, w, d) {
|
|
1239
|
+
const m = {}, S = [...f], _ = q(t.href, n), O = Oe(t.href, t), B = /* @__PURE__ */ new Set([O]), j = /* @__PURE__ */ new Map([[_, 0]]), F = /* @__PURE__ */ new Set([_]);
|
|
1214
1240
|
r.set(_, O);
|
|
1215
|
-
const
|
|
1241
|
+
const H = /* @__PURE__ */ new Set(), J = () => {
|
|
1216
1242
|
const b = Object.keys(m).length > 0;
|
|
1217
1243
|
if (b && typeof e._usd_probe_stage_open_mapped != "function")
|
|
1218
1244
|
throw Object.assign(
|
|
1219
1245
|
new Error("USD dependency mapping requires the matching packaged openusd_probe.js and .wasm runtime."),
|
|
1220
1246
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
1221
1247
|
);
|
|
1222
|
-
return b ?
|
|
1248
|
+
return b ? a("usd_probe_stage_open_mapped", ["string", "string"], [_, JSON.stringify(m)]) : a("usd_probe_stage_open", ["string"], [_]);
|
|
1223
1249
|
}, V = (b) => {
|
|
1224
|
-
var
|
|
1225
|
-
const
|
|
1226
|
-
if (
|
|
1250
|
+
var z, G;
|
|
1251
|
+
const M = r.get(b.layer);
|
|
1252
|
+
if (M === void 0)
|
|
1227
1253
|
throw new Error(`Missing USD layer identity for ${b.layer}`);
|
|
1228
|
-
const U = ((
|
|
1254
|
+
const U = ((z = Object.entries(m[b.layer] ?? {}).find(([, L]) => L === b.path)) == null ? void 0 : z[0]) ?? b.path;
|
|
1229
1255
|
if (!U || /^(?:data|blob):/i.test(U) || /\.mdl(?:[?#].*)?$/i.test(U))
|
|
1230
1256
|
return null;
|
|
1231
|
-
const R =
|
|
1257
|
+
const R = Te(U, M, t);
|
|
1232
1258
|
if (!R) return null;
|
|
1233
|
-
const { resolved: A, absolute: k, childIdentifier: v } = R, I =
|
|
1234
|
-
if (
|
|
1259
|
+
const { resolved: A, absolute: k, childIdentifier: v } = R, I = q(A.href, n), P = st(I, S), D = (P == null ? void 0 : P.paths.length) === 1 ? P.paths[0] : null, N = D ?? I, x = b.kind !== "resource" || rn(A.pathname), T = (j.get(b.layer) ?? 0) + 1;
|
|
1260
|
+
if (D && r.set(D, v), m[G = b.layer] ?? (m[G] = {}), b.kind === "resource" && u === "package" && P && P.paths.length > 1) {
|
|
1235
1261
|
const L = `${n}/__deferred_udim__/${encodeURIComponent(v)}`;
|
|
1236
1262
|
return m[b.layer][U] = L, r.set(L, v), null;
|
|
1237
1263
|
}
|
|
1238
|
-
if (u === "package" && !f.has(
|
|
1264
|
+
if (u === "package" && !f.has(N) && !Ie(A, t)) {
|
|
1239
1265
|
const L = `${n}/__skipped__/${encodeURIComponent(v)}`;
|
|
1240
|
-
return m[b.layer][U] = L, r.set(L, v),
|
|
1266
|
+
return m[b.layer][U] = L, r.set(L, v), H.has(v) || (H.add(v), w == null || w(v)), null;
|
|
1241
1267
|
}
|
|
1242
1268
|
if (!x && c && (c.set(v, A.href), c.set(U, A.href)), !x && !h)
|
|
1243
|
-
return m[b.layer][U] =
|
|
1244
|
-
if (m[b.layer][U] =
|
|
1245
|
-
return r.set(
|
|
1246
|
-
if (
|
|
1269
|
+
return m[b.layer][U] = N, r.set(N, v), null;
|
|
1270
|
+
if (m[b.layer][U] = N, o.has(N))
|
|
1271
|
+
return r.set(N, v), j.set(N, T), x && F.add(N), null;
|
|
1272
|
+
if (B.has(v)) return null;
|
|
1247
1273
|
if (T > p)
|
|
1248
1274
|
throw new Error(`USD dependency depth limit exceeded (${p}): ${v}`);
|
|
1249
|
-
if (
|
|
1275
|
+
if (B.size >= l)
|
|
1250
1276
|
throw new Error(`USD dependency limit exceeded (${l}).`);
|
|
1251
|
-
return
|
|
1277
|
+
return B.add(v), j.set(N, T), {
|
|
1252
1278
|
item: {
|
|
1253
1279
|
url: A,
|
|
1254
1280
|
depth: T,
|
|
@@ -1263,14 +1289,14 @@ async function Zt(e, t, n, o, i, s, r, c, a, l, p, g, u, f, h, y, w, d) {
|
|
|
1263
1289
|
for (; ; ) {
|
|
1264
1290
|
const b = J();
|
|
1265
1291
|
if (!b.ok) throw new Error(b.error ?? `Failed to open ${_}`);
|
|
1266
|
-
let
|
|
1292
|
+
let M, U = [];
|
|
1267
1293
|
try {
|
|
1268
|
-
if (
|
|
1294
|
+
if (M = De(e, b, y, !1), typeof e._usd_probe_stage_external_references != "function")
|
|
1269
1295
|
throw Object.assign(
|
|
1270
1296
|
new Error("Variant-aware USD dependency discovery requires the matching packaged openusd_probe runtime."),
|
|
1271
1297
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
1272
1298
|
);
|
|
1273
|
-
const R =
|
|
1299
|
+
const R = a("usd_probe_stage_external_references", ["number"], [b.stageId]);
|
|
1274
1300
|
if (R.ok !== !0)
|
|
1275
1301
|
throw new Error(String(R.error ?? "Failed to enumerate active USD dependencies."));
|
|
1276
1302
|
const A = R.dependencies ?? [], k = /* @__PURE__ */ new Set();
|
|
@@ -1282,88 +1308,88 @@ async function Zt(e, t, n, o, i, s, r, c, a, l, p, g, u, f, h, y, w, d) {
|
|
|
1282
1308
|
}
|
|
1283
1309
|
if (U.length === 0) {
|
|
1284
1310
|
const v = /* @__PURE__ */ new Map();
|
|
1285
|
-
for (const I of
|
|
1286
|
-
if (
|
|
1287
|
-
const P =
|
|
1311
|
+
for (const I of F) {
|
|
1312
|
+
if (i.get(I) === !1) continue;
|
|
1313
|
+
const P = a("usd_probe_external_references", ["string"], [I]);
|
|
1288
1314
|
if (v.set(I, P), P.hasVariantSets !== !1) continue;
|
|
1289
|
-
const
|
|
1315
|
+
const D = new Set(
|
|
1290
1316
|
P.compositionPaths ?? []
|
|
1291
1317
|
);
|
|
1292
1318
|
for (const x of P.subLayers ?? []) {
|
|
1293
1319
|
if (!x) continue;
|
|
1294
1320
|
const T = V({ kind: "sublayer", layer: I, path: x });
|
|
1295
|
-
T && !U.some((
|
|
1321
|
+
T && !U.some((z) => z.identifier === T.identifier) && U.push(T);
|
|
1296
1322
|
}
|
|
1297
|
-
const
|
|
1323
|
+
const N = [
|
|
1298
1324
|
["reference", P.references],
|
|
1299
1325
|
["payload", P.payloads]
|
|
1300
1326
|
];
|
|
1301
|
-
for (const [x, T] of
|
|
1302
|
-
for (const
|
|
1303
|
-
if (!
|
|
1304
|
-
const G = V({ kind: x, layer: I, path:
|
|
1327
|
+
for (const [x, T] of N)
|
|
1328
|
+
for (const z of T ?? []) {
|
|
1329
|
+
if (!z || !D.has(z)) continue;
|
|
1330
|
+
const G = V({ kind: x, layer: I, path: z });
|
|
1305
1331
|
G && !U.some((L) => L.identifier === G.identifier) && U.push(G);
|
|
1306
1332
|
}
|
|
1307
1333
|
}
|
|
1308
1334
|
if (U.length === 0)
|
|
1309
1335
|
for (const [I, P] of v) {
|
|
1310
|
-
const
|
|
1336
|
+
const D = new Set(
|
|
1311
1337
|
P.compositionPaths ?? []
|
|
1312
1338
|
);
|
|
1313
|
-
for (const
|
|
1314
|
-
if (!
|
|
1315
|
-
const x = V({ kind: "resource", layer: I, path:
|
|
1339
|
+
for (const N of P.paths ?? []) {
|
|
1340
|
+
if (!N || D.has(N)) continue;
|
|
1341
|
+
const x = V({ kind: "resource", layer: I, path: N });
|
|
1316
1342
|
x && !U.some((T) => T.identifier === x.identifier) && U.push(x);
|
|
1317
1343
|
}
|
|
1318
1344
|
}
|
|
1319
1345
|
}
|
|
1320
1346
|
} catch (R) {
|
|
1321
|
-
throw
|
|
1347
|
+
throw a("usd_probe_stage_release", ["number"], [b.stageId]), R;
|
|
1322
1348
|
}
|
|
1323
1349
|
if (U.length === 0)
|
|
1324
|
-
return { mappings: m, opened: b, variantConfiguration:
|
|
1325
|
-
|
|
1350
|
+
return { mappings: m, opened: b, variantConfiguration: M };
|
|
1351
|
+
a("usd_probe_stage_release", ["number"], [b.stageId]), await nn(
|
|
1326
1352
|
U,
|
|
1327
1353
|
Math.max(1, g),
|
|
1328
1354
|
async ({ item: R, identifier: A }) => {
|
|
1329
1355
|
if (!R.recurse && !h) return;
|
|
1330
|
-
const k =
|
|
1356
|
+
const k = q(R.url.href, n);
|
|
1331
1357
|
let v;
|
|
1332
1358
|
try {
|
|
1333
|
-
v = await
|
|
1359
|
+
v = await s(R.url, A);
|
|
1334
1360
|
} catch (I) {
|
|
1335
|
-
if (!R.resource || !
|
|
1361
|
+
if (!R.resource || !Ye(A) || !et(I))
|
|
1336
1362
|
throw I;
|
|
1337
1363
|
const P = `${n}/__unavailable__/${encodeURIComponent(A)}`;
|
|
1338
1364
|
R.owner && (m[R.owner.path][R.owner.reference] = P), r.set(P, A), d == null || d(A, I);
|
|
1339
1365
|
return;
|
|
1340
1366
|
}
|
|
1341
|
-
|
|
1367
|
+
i.set(k, ke(v)), fe(e, k, v, o), r.set(k, A), R.recurse && (m[k] ?? (m[k] = {}), F.add(k));
|
|
1342
1368
|
}
|
|
1343
1369
|
);
|
|
1344
1370
|
}
|
|
1345
1371
|
}
|
|
1346
|
-
async function
|
|
1347
|
-
const
|
|
1348
|
-
let
|
|
1349
|
-
const
|
|
1350
|
-
for (;
|
|
1351
|
-
const r =
|
|
1352
|
-
|
|
1372
|
+
async function nn(e, t, n) {
|
|
1373
|
+
const s = new Array(e.length);
|
|
1374
|
+
let a = 0;
|
|
1375
|
+
const o = Array.from({ length: Math.min(t, e.length) }, async () => {
|
|
1376
|
+
for (; a < e.length; ) {
|
|
1377
|
+
const r = a++;
|
|
1378
|
+
s[r] = await n(e[r]);
|
|
1353
1379
|
}
|
|
1354
1380
|
});
|
|
1355
|
-
return await Promise.all(
|
|
1381
|
+
return await Promise.all(o), s;
|
|
1356
1382
|
}
|
|
1357
|
-
function
|
|
1358
|
-
var n,
|
|
1359
|
-
const t = (
|
|
1360
|
-
return t != null &&
|
|
1383
|
+
function rn(e) {
|
|
1384
|
+
var n, s;
|
|
1385
|
+
const t = (s = (n = e.split(/[?#]/, 1)[0]) == null ? void 0 : n.split(".").pop()) == null ? void 0 : s.toLowerCase();
|
|
1386
|
+
return t != null && Zt.has(t);
|
|
1361
1387
|
}
|
|
1362
|
-
function
|
|
1363
|
-
return
|
|
1388
|
+
function ke(e) {
|
|
1389
|
+
return xe(e) ? e.includes(64) : !0;
|
|
1364
1390
|
}
|
|
1365
|
-
function
|
|
1366
|
-
return
|
|
1391
|
+
function sn(e) {
|
|
1392
|
+
return xe(e) ? on(e, [
|
|
1367
1393
|
"subLayers",
|
|
1368
1394
|
"references",
|
|
1369
1395
|
"payload",
|
|
@@ -1371,174 +1397,174 @@ function Qt(e) {
|
|
|
1371
1397
|
"clipAssetPaths"
|
|
1372
1398
|
]) : !0;
|
|
1373
1399
|
}
|
|
1374
|
-
function
|
|
1400
|
+
function xe(e) {
|
|
1375
1401
|
let t = e[0] === 239 && e[1] === 187 && e[2] === 191 ? 3 : 0;
|
|
1376
1402
|
for (; t < e.length && t < 64 && /\s/.test(String.fromCharCode(e[t])); ) t += 1;
|
|
1377
1403
|
return e[t] === 35 && e[t + 1] === 117 && e[t + 2] === 115 && e[t + 3] === 100 && e[t + 4] === 97;
|
|
1378
1404
|
}
|
|
1379
|
-
function
|
|
1405
|
+
function on(e, t) {
|
|
1380
1406
|
const n = /* @__PURE__ */ new Map();
|
|
1381
|
-
let
|
|
1382
|
-
for (const
|
|
1383
|
-
const r =
|
|
1384
|
-
n.set(r, [...n.get(r) ?? [],
|
|
1407
|
+
let s = 1;
|
|
1408
|
+
for (const o of t) {
|
|
1409
|
+
const r = o.charCodeAt(0);
|
|
1410
|
+
n.set(r, [...n.get(r) ?? [], o]), s = Math.max(s, o.length);
|
|
1385
1411
|
}
|
|
1386
|
-
const
|
|
1387
|
-
for (let
|
|
1388
|
-
const r = n.get(e[
|
|
1412
|
+
const a = e.length - s;
|
|
1413
|
+
for (let o = 0; o <= a; ++o) {
|
|
1414
|
+
const r = n.get(e[o]);
|
|
1389
1415
|
if (r)
|
|
1390
1416
|
for (const c of r) {
|
|
1391
|
-
let
|
|
1417
|
+
let i = !0;
|
|
1392
1418
|
for (let l = 1; l < c.length; ++l)
|
|
1393
|
-
if (e[
|
|
1394
|
-
|
|
1419
|
+
if (e[o + l] !== c.charCodeAt(l)) {
|
|
1420
|
+
i = !1;
|
|
1395
1421
|
break;
|
|
1396
1422
|
}
|
|
1397
|
-
if (
|
|
1423
|
+
if (i) return !0;
|
|
1398
1424
|
}
|
|
1399
1425
|
}
|
|
1400
1426
|
return !1;
|
|
1401
1427
|
}
|
|
1402
|
-
function
|
|
1428
|
+
function Oe(e, t) {
|
|
1403
1429
|
const n = new URL(e);
|
|
1404
1430
|
if (n.protocol !== t.protocol || n.host !== t.host) return n.href;
|
|
1405
|
-
const
|
|
1406
|
-
let
|
|
1407
|
-
for (;
|
|
1408
|
-
const r = [...
|
|
1431
|
+
const s = new URL(".", t).pathname.split("/").filter(Boolean), a = n.pathname.split("/").filter(Boolean);
|
|
1432
|
+
let o = 0;
|
|
1433
|
+
for (; o < s.length && s[o] === a[o]; ) o++;
|
|
1434
|
+
const r = [...s.slice(o).map(() => ".."), ...a.slice(o)].join("/");
|
|
1409
1435
|
return decodeURIComponent(r) + n.search + n.hash;
|
|
1410
1436
|
}
|
|
1411
|
-
function
|
|
1412
|
-
let
|
|
1437
|
+
function Te(e, t, n) {
|
|
1438
|
+
let s;
|
|
1413
1439
|
try {
|
|
1414
|
-
|
|
1440
|
+
s = new URL(e, new URL(t, n));
|
|
1415
1441
|
} catch {
|
|
1416
1442
|
return null;
|
|
1417
1443
|
}
|
|
1418
|
-
const
|
|
1444
|
+
const a = /^(?:[a-z][a-z\d+.-]*:|\/)/i.test(t), o = /^(?:[a-z][a-z\d+.-]*:|\/)/i.test(e), r = a || o;
|
|
1419
1445
|
return {
|
|
1420
|
-
resolved:
|
|
1446
|
+
resolved: s,
|
|
1421
1447
|
absolute: r,
|
|
1422
|
-
childIdentifier: r ?
|
|
1448
|
+
childIdentifier: r ? s.href : Oe(s.href, n)
|
|
1423
1449
|
};
|
|
1424
1450
|
}
|
|
1425
|
-
function
|
|
1426
|
-
const n = new URL(e),
|
|
1427
|
-
let
|
|
1451
|
+
function q(e, t) {
|
|
1452
|
+
const n = new URL(e), s = encodeURIComponent(`${n.protocol}//${n.host}`);
|
|
1453
|
+
let a = n.pathname.split("/").map((o) => decodeURIComponent(o).replaceAll("/", "%2F").replaceAll("\\", "%5C")).join("/");
|
|
1428
1454
|
if (n.search || n.hash) {
|
|
1429
|
-
const
|
|
1430
|
-
|
|
1455
|
+
const o = a.lastIndexOf("."), r = o > a.lastIndexOf("/") ? o : a.length;
|
|
1456
|
+
a = `${a.slice(0, r)}.__url_${encodeURIComponent(n.search + n.hash)}${a.slice(r)}`;
|
|
1431
1457
|
}
|
|
1432
|
-
return `${t}/${
|
|
1458
|
+
return `${t}/${s}${a}`;
|
|
1433
1459
|
}
|
|
1434
|
-
function
|
|
1460
|
+
function $e(e, t) {
|
|
1435
1461
|
if (!e || typeof e != "object" || ArrayBuffer.isView(e)) return;
|
|
1436
1462
|
const n = e;
|
|
1437
1463
|
if (typeof n.path == "string" && typeof n.resolvedPath == "string") {
|
|
1438
|
-
for (const
|
|
1439
|
-
const
|
|
1440
|
-
n[
|
|
1464
|
+
for (const s of ["path", "resolvedPath"]) {
|
|
1465
|
+
const a = n[s];
|
|
1466
|
+
n[s] = t.get(a) ?? a;
|
|
1441
1467
|
}
|
|
1442
1468
|
return;
|
|
1443
1469
|
}
|
|
1444
|
-
for (const
|
|
1470
|
+
for (const s of Object.values(e)) $e(s, t);
|
|
1445
1471
|
}
|
|
1446
|
-
function
|
|
1472
|
+
function Le(e, t, n) {
|
|
1447
1473
|
if (!e || typeof e != "object" || ArrayBuffer.isView(e)) return;
|
|
1448
|
-
const
|
|
1449
|
-
if (typeof
|
|
1450
|
-
const
|
|
1451
|
-
if (
|
|
1452
|
-
|
|
1474
|
+
const s = e;
|
|
1475
|
+
if (typeof s.path == "string" && typeof s.ownerLayer == "string") {
|
|
1476
|
+
const a = t.get(s.path);
|
|
1477
|
+
if (a)
|
|
1478
|
+
s.path = a, s.resolvedPath = a;
|
|
1453
1479
|
else {
|
|
1454
|
-
const
|
|
1455
|
-
if (
|
|
1456
|
-
const r =
|
|
1457
|
-
r && (
|
|
1480
|
+
const o = t.get(s.ownerLayer);
|
|
1481
|
+
if (o) {
|
|
1482
|
+
const r = Te(s.path, o, n);
|
|
1483
|
+
r && (s.path = r.childIdentifier, s.resolvedPath = r.childIdentifier);
|
|
1458
1484
|
}
|
|
1459
1485
|
}
|
|
1460
|
-
delete
|
|
1486
|
+
delete s.ownerLayer;
|
|
1461
1487
|
return;
|
|
1462
1488
|
}
|
|
1463
|
-
for (const
|
|
1489
|
+
for (const a of Object.values(e)) Le(a, t, n);
|
|
1464
1490
|
}
|
|
1465
|
-
function
|
|
1491
|
+
function Ce(e, t) {
|
|
1466
1492
|
if (e.analyzePath(t).exists) {
|
|
1467
1493
|
for (const n of e.readdir(t)) {
|
|
1468
1494
|
if (n === "." || n === "..") continue;
|
|
1469
|
-
const
|
|
1470
|
-
e.isDir(e.stat(
|
|
1495
|
+
const s = `${t}/${n}`;
|
|
1496
|
+
e.isDir(e.stat(s).mode) ? Ce(e, s) : e.unlink(s);
|
|
1471
1497
|
}
|
|
1472
1498
|
e.rmdir(t);
|
|
1473
1499
|
}
|
|
1474
1500
|
}
|
|
1475
|
-
function
|
|
1476
|
-
|
|
1501
|
+
function fe(e, t, n, s) {
|
|
1502
|
+
s.has(t) || (e.FS.mkdirTree(t.split("/").slice(0, -1).join("/") || "/"), e.FS.writeFile(t, n), s.add(t));
|
|
1477
1503
|
}
|
|
1478
|
-
function
|
|
1504
|
+
function Z(e) {
|
|
1479
1505
|
return `${e.primPath}\0${e.setName}`;
|
|
1480
1506
|
}
|
|
1481
|
-
async function
|
|
1507
|
+
async function Pe(e) {
|
|
1482
1508
|
return typeof e == "string" ? new TextEncoder().encode(e) : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : e instanceof ArrayBuffer ? new Uint8Array(e) : new Uint8Array(await e.arrayBuffer());
|
|
1483
1509
|
}
|
|
1484
|
-
async function
|
|
1510
|
+
async function an(e) {
|
|
1485
1511
|
if (!e) throw new Error("createSingleThreadUsd needs wasmUrl or wasmBinary.");
|
|
1486
1512
|
return (await fetch(e)).arrayBuffer();
|
|
1487
1513
|
}
|
|
1488
|
-
function
|
|
1514
|
+
function cn(e) {
|
|
1489
1515
|
if (e.length < 30) return null;
|
|
1490
|
-
const t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = (
|
|
1491
|
-
for (let
|
|
1492
|
-
if (e[
|
|
1516
|
+
const t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = (s, a) => {
|
|
1517
|
+
for (let o = 0; o < a.length; o += 1)
|
|
1518
|
+
if (e[s + o] !== a.charCodeAt(o)) return !1;
|
|
1493
1519
|
return !0;
|
|
1494
1520
|
};
|
|
1495
1521
|
if (e[0] === 137 && n(1, "PNG") && n(12, "IHDR"))
|
|
1496
|
-
return
|
|
1522
|
+
return K(t.getUint32(16), t.getUint32(20));
|
|
1497
1523
|
if (e[0] === 255 && e[1] === 216) {
|
|
1498
|
-
let
|
|
1499
|
-
for (;
|
|
1500
|
-
if (e[
|
|
1501
|
-
const
|
|
1502
|
-
if (
|
|
1503
|
-
return
|
|
1504
|
-
e[
|
|
1505
|
-
e[
|
|
1524
|
+
let s = 2;
|
|
1525
|
+
for (; s + 9 < e.length; ) {
|
|
1526
|
+
if (e[s] !== 255) return null;
|
|
1527
|
+
const a = e[s + 1], o = e[s + 2] << 8 | e[s + 3];
|
|
1528
|
+
if (a >= 192 && a <= 207 && a !== 196 && a !== 200 && a !== 204)
|
|
1529
|
+
return K(
|
|
1530
|
+
e[s + 7] << 8 | e[s + 8],
|
|
1531
|
+
e[s + 5] << 8 | e[s + 6]
|
|
1506
1532
|
);
|
|
1507
|
-
if (
|
|
1508
|
-
|
|
1533
|
+
if (o < 2) return null;
|
|
1534
|
+
s += 2 + o;
|
|
1509
1535
|
}
|
|
1510
1536
|
return null;
|
|
1511
1537
|
}
|
|
1512
1538
|
if (n(0, "RIFF") && n(8, "WEBP")) {
|
|
1513
1539
|
if (n(12, "VP8 "))
|
|
1514
|
-
return
|
|
1540
|
+
return K(
|
|
1515
1541
|
t.getUint16(26, !0) & 16383,
|
|
1516
1542
|
t.getUint16(28, !0) & 16383
|
|
1517
1543
|
);
|
|
1518
1544
|
if (n(12, "VP8L")) {
|
|
1519
|
-
const
|
|
1520
|
-
return
|
|
1545
|
+
const s = t.getUint32(21, !0);
|
|
1546
|
+
return K((s & 16383) + 1, (s >>> 14 & 16383) + 1);
|
|
1521
1547
|
}
|
|
1522
1548
|
if (n(12, "VP8X")) {
|
|
1523
|
-
const
|
|
1524
|
-
return
|
|
1549
|
+
const s = (a) => e[a] | e[a + 1] << 8 | e[a + 2] << 16;
|
|
1550
|
+
return K(s(24) + 1, s(27) + 1);
|
|
1525
1551
|
}
|
|
1526
1552
|
}
|
|
1527
1553
|
return null;
|
|
1528
1554
|
}
|
|
1529
|
-
function
|
|
1555
|
+
function un(e, t) {
|
|
1530
1556
|
const n = Math.max(e.width, e.height);
|
|
1531
1557
|
if (t <= 0 || n <= t) return e;
|
|
1532
|
-
const
|
|
1558
|
+
const s = t / n;
|
|
1533
1559
|
return {
|
|
1534
|
-
width: Math.max(1, Math.round(e.width *
|
|
1535
|
-
height: Math.max(1, Math.round(e.height *
|
|
1560
|
+
width: Math.max(1, Math.round(e.width * s)),
|
|
1561
|
+
height: Math.max(1, Math.round(e.height * s))
|
|
1536
1562
|
};
|
|
1537
1563
|
}
|
|
1538
|
-
function
|
|
1564
|
+
function K(e, t) {
|
|
1539
1565
|
return e > 0 && t > 0 ? { width: e, height: t } : null;
|
|
1540
1566
|
}
|
|
1541
|
-
function
|
|
1567
|
+
function Y(e) {
|
|
1542
1568
|
return e instanceof Error ? {
|
|
1543
1569
|
name: e.name,
|
|
1544
1570
|
message: e.message,
|
|
@@ -1546,55 +1572,55 @@ function Z(e) {
|
|
|
1546
1572
|
...e.stack ? { stack: e.stack } : {}
|
|
1547
1573
|
} : { name: "Error", message: String(e) };
|
|
1548
1574
|
}
|
|
1549
|
-
const
|
|
1550
|
-
let
|
|
1551
|
-
const
|
|
1575
|
+
const ee = globalThis;
|
|
1576
|
+
let ne = null, Q = null, re = null, se = null, le = !1, ln = 1;
|
|
1577
|
+
const te = /* @__PURE__ */ new Map();
|
|
1552
1578
|
function C(e, t) {
|
|
1553
|
-
|
|
1579
|
+
ee.postMessage(e, t);
|
|
1554
1580
|
}
|
|
1555
|
-
function
|
|
1556
|
-
const n =
|
|
1557
|
-
return new Promise((
|
|
1558
|
-
|
|
1581
|
+
function fn(e, t) {
|
|
1582
|
+
const n = ln++;
|
|
1583
|
+
return new Promise((s, a) => {
|
|
1584
|
+
te.set(n, { resolve: s, reject: a }), C({ type: "resource-request", id: n, url: e.href, identifier: t });
|
|
1559
1585
|
});
|
|
1560
1586
|
}
|
|
1561
|
-
function
|
|
1562
|
-
return
|
|
1587
|
+
function dn(e) {
|
|
1588
|
+
return ne ?? (ne = Yt(e)), ne;
|
|
1563
1589
|
}
|
|
1564
|
-
function
|
|
1590
|
+
function hn(e) {
|
|
1565
1591
|
const t = /* @__PURE__ */ new Set();
|
|
1566
1592
|
for (const n of e.elements)
|
|
1567
|
-
for (const
|
|
1568
|
-
ArrayBuffer.isView(
|
|
1593
|
+
for (const s of Object.values(n.geometry ?? {}))
|
|
1594
|
+
ArrayBuffer.isView(s) && t.add(s.buffer);
|
|
1569
1595
|
return [...t];
|
|
1570
1596
|
}
|
|
1571
|
-
async function
|
|
1572
|
-
if (!
|
|
1573
|
-
const t =
|
|
1574
|
-
return { type: "query-result", id: e.id, value: await t.apply(
|
|
1597
|
+
async function pn(e) {
|
|
1598
|
+
if (!re) throw new Error("USD worker has no live stage");
|
|
1599
|
+
const t = re[e.method];
|
|
1600
|
+
return { type: "query-result", id: e.id, value: await t.apply(re, e.args) };
|
|
1575
1601
|
}
|
|
1576
|
-
async function
|
|
1602
|
+
async function gn(e, t) {
|
|
1577
1603
|
if (typeof createImageBitmap != "function")
|
|
1578
1604
|
throw new Error("This browser cannot decode USD textures in a worker.");
|
|
1579
1605
|
const n = await fetch(e);
|
|
1580
1606
|
if (!n.ok) throw new Error(`HTTP ${n.status} for ${e}`);
|
|
1581
|
-
const
|
|
1607
|
+
const s = new Uint8Array(await n.arrayBuffer()), a = cn(s), o = {
|
|
1582
1608
|
imageOrientation: "flipY",
|
|
1583
1609
|
premultiplyAlpha: "none",
|
|
1584
1610
|
colorSpaceConversion: "none"
|
|
1585
1611
|
};
|
|
1586
|
-
if (
|
|
1587
|
-
const r = t > 0 ?
|
|
1588
|
-
(r.width !==
|
|
1612
|
+
if (a) {
|
|
1613
|
+
const r = t > 0 ? un(a, t) : a;
|
|
1614
|
+
(r.width !== a.width || r.height !== a.height) && (o.resizeWidth = r.width, o.resizeHeight = r.height, o.resizeQuality = "high");
|
|
1589
1615
|
}
|
|
1590
|
-
return createImageBitmap(new Blob([
|
|
1616
|
+
return createImageBitmap(new Blob([s]), o);
|
|
1591
1617
|
}
|
|
1592
|
-
|
|
1618
|
+
ee.onmessage = async (e) => {
|
|
1593
1619
|
const t = e.data;
|
|
1594
1620
|
if (t.type === "resource-result") {
|
|
1595
|
-
const n =
|
|
1621
|
+
const n = te.get(t.id);
|
|
1596
1622
|
if (!n) return;
|
|
1597
|
-
|
|
1623
|
+
te.delete(t.id), t.error ? n.reject(Object.assign(new Error(t.error.message), {
|
|
1598
1624
|
name: t.error.name,
|
|
1599
1625
|
...t.error.code ? { code: t.error.code } : {}
|
|
1600
1626
|
})) : n.resolve(t.bytes ?? new Uint8Array());
|
|
@@ -1602,15 +1628,15 @@ Q.onmessage = async (e) => {
|
|
|
1602
1628
|
}
|
|
1603
1629
|
if (t.type === "query") {
|
|
1604
1630
|
try {
|
|
1605
|
-
C(await
|
|
1631
|
+
C(await pn(t));
|
|
1606
1632
|
} catch (n) {
|
|
1607
|
-
C({ type: "error", id: t.id, error:
|
|
1633
|
+
C({ type: "error", id: t.id, error: Y(n) });
|
|
1608
1634
|
}
|
|
1609
1635
|
return;
|
|
1610
1636
|
}
|
|
1611
1637
|
if (t.type === "decode-texture") {
|
|
1612
1638
|
try {
|
|
1613
|
-
const n = await
|
|
1639
|
+
const n = await gn(t.url, t.maxDimension);
|
|
1614
1640
|
C({
|
|
1615
1641
|
type: "texture-decoded",
|
|
1616
1642
|
id: t.id,
|
|
@@ -1619,55 +1645,55 @@ Q.onmessage = async (e) => {
|
|
|
1619
1645
|
height: n.height
|
|
1620
1646
|
}, [n]);
|
|
1621
1647
|
} catch (n) {
|
|
1622
|
-
C({ type: "error", id: t.id, error:
|
|
1648
|
+
C({ type: "error", id: t.id, error: Y(n) });
|
|
1623
1649
|
}
|
|
1624
1650
|
return;
|
|
1625
1651
|
}
|
|
1626
1652
|
if (t.type === "dispose") {
|
|
1627
|
-
for (const n of
|
|
1628
|
-
|
|
1653
|
+
for (const n of te.values()) n.reject(new Error("USD worker disposed"));
|
|
1654
|
+
te.clear(), Q == null || Q(), re = null, se = null, le = !1, ne = null, Q = null, ee.close();
|
|
1629
1655
|
return;
|
|
1630
1656
|
}
|
|
1631
1657
|
if (t.type === "extract-physics") {
|
|
1632
|
-
if (
|
|
1633
|
-
|
|
1658
|
+
if (le || !se) return;
|
|
1659
|
+
le = !0;
|
|
1634
1660
|
try {
|
|
1635
1661
|
C({ type: "physics-ready", phase: await se() });
|
|
1636
1662
|
} catch (n) {
|
|
1637
|
-
C({ type: "physics-failed", error:
|
|
1663
|
+
C({ type: "physics-failed", error: Y(n) });
|
|
1638
1664
|
}
|
|
1639
1665
|
return;
|
|
1640
1666
|
}
|
|
1641
1667
|
if (t.type === "prepare") {
|
|
1642
1668
|
try {
|
|
1643
|
-
const n = await
|
|
1669
|
+
const n = await dn(t.runtime);
|
|
1644
1670
|
t.warmup && await n.warmup(), C({ type: "worker-ready" });
|
|
1645
1671
|
} catch (n) {
|
|
1646
|
-
C({ type: "error", error:
|
|
1672
|
+
C({ type: "error", error: Y(n) }), ee.close();
|
|
1647
1673
|
}
|
|
1648
1674
|
return;
|
|
1649
1675
|
}
|
|
1650
1676
|
try {
|
|
1651
|
-
if (!
|
|
1652
|
-
const
|
|
1677
|
+
if (!ne) throw new Error("USD worker was not prepared before load");
|
|
1678
|
+
const s = await (await ne).parseVisualSceneAsync(t.input, {
|
|
1653
1679
|
...t.options,
|
|
1654
1680
|
packagePaths: t.options.packagePaths,
|
|
1655
1681
|
readTextureBytes: t.options.readTextureBytes ?? !1,
|
|
1656
1682
|
loadTextures: !1,
|
|
1657
1683
|
convertZUp: !1,
|
|
1658
1684
|
loadLights: !1,
|
|
1659
|
-
resolveBytes:
|
|
1685
|
+
resolveBytes: fn,
|
|
1660
1686
|
onReferenceSkipped: (r) => C({ type: "event", event: "reference-skipped", identifier: r }),
|
|
1661
|
-
onResourceFailed: (r, c) => C({ type: "event", event: "resource-failed", identifier: r, error:
|
|
1687
|
+
onResourceFailed: (r, c) => C({ type: "event", event: "resource-failed", identifier: r, error: Y(c) })
|
|
1662
1688
|
});
|
|
1663
|
-
|
|
1664
|
-
const
|
|
1689
|
+
Q = s.release, re = Ne(s.stage, s.pxr), se = s.readPhysics;
|
|
1690
|
+
const a = s.data, o = hn(a);
|
|
1665
1691
|
C({
|
|
1666
1692
|
type: "visual-ready",
|
|
1667
|
-
data:
|
|
1668
|
-
textureURLs: [...
|
|
1669
|
-
},
|
|
1693
|
+
data: a,
|
|
1694
|
+
textureURLs: [...s.textureURLs ?? []]
|
|
1695
|
+
}, o);
|
|
1670
1696
|
} catch (n) {
|
|
1671
|
-
C({ type: "error", error:
|
|
1697
|
+
C({ type: "error", error: Y(n) }), ee.close();
|
|
1672
1698
|
}
|
|
1673
1699
|
};
|