three-usd-robot 0.11.0 → 0.12.0
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/README.md +48 -7
- package/dist/MeshBinding-DQKXuYNr.d.ts +288 -0
- package/dist/{ThreeUsdRobot-BxnCluuK.d.ts → ThreeUsdRobot-C3N6-XBJ.d.ts} +1 -1
- package/dist/{ThreeUsdRobotLoader-C-E9uwEe.d.ts → ThreeUsdRobotLoader-D2fEo9_p.d.ts} +11 -3
- package/dist/{buildKinematicTree-BCySuZZn.d.ts → buildKinematicTree-iFqaw0Jl.d.ts} +1 -1
- package/dist/bytes-CxGRGry_.d.ts +14 -0
- package/dist/{chunk-AXPMXEQC.js → chunk-6W4LQVEQ.js} +13 -715
- package/dist/chunk-6W4LQVEQ.js.map +1 -0
- package/dist/{chunk-5SVRTKS4.js → chunk-7GGSIA6M.js} +18 -11
- package/dist/chunk-7GGSIA6M.js.map +1 -0
- package/dist/{chunk-BCRRXGNB.js → chunk-CK5MTMYR.js} +6 -4
- package/dist/chunk-CK5MTMYR.js.map +1 -0
- package/dist/chunk-JGIVJXBU.js +54 -0
- package/dist/chunk-JGIVJXBU.js.map +1 -0
- package/dist/{chunk-ENWFOYHU.js → chunk-KYBHWDX5.js} +3 -3
- package/dist/{chunk-ENWFOYHU.js.map → chunk-KYBHWDX5.js.map} +1 -1
- package/dist/chunk-PPPRB6KE.js +963 -0
- package/dist/chunk-PPPRB6KE.js.map +1 -0
- package/dist/{chunk-LDO5FKQS.js → chunk-YGJ23CG3.js} +4 -53
- package/dist/chunk-YGJ23CG3.js.map +1 -0
- package/dist/core.d.ts +6 -63
- package/dist/core.js +5 -3
- package/dist/extras.d.ts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/helpers.js +3 -2
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +11 -262
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/nodes.d.ts +49 -0
- package/dist/nodes.js +439 -0
- package/dist/nodes.js.map +1 -0
- package/dist/parseMdl-vfzBGoMr.d.ts +87 -0
- package/dist/react.d.ts +6 -4
- package/dist/react.js +6 -4
- package/dist/react.js.map +1 -1
- package/package.json +6 -2
- package/dist/bytes-MOJ2oN-u.d.ts +0 -42
- package/dist/chunk-5SVRTKS4.js.map +0 -1
- package/dist/chunk-AXPMXEQC.js.map +0 -1
- package/dist/chunk-BCRRXGNB.js.map +0 -1
- package/dist/chunk-LDO5FKQS.js.map +0 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { multiply, makeTranslation, makeRotationFromQuat, identity4, invert, makeEuler, DEG2RAD, makeRotationZ, makeRotationY, makeRotationX, fromUsdMatrix, makeScale, RAD2DEG } from './chunk-YGJ23CG3.js';
|
|
2
|
+
import { parseMdl, joinPosix } from './chunk-PPPRB6KE.js';
|
|
3
|
+
import { Quat, AssetPath, UsdMatrix } from './chunk-JGIVJXBU.js';
|
|
2
4
|
import { unzipSync } from 'fflate';
|
|
3
5
|
|
|
4
6
|
// src/schemas/usdGeom.ts
|
|
@@ -282,710 +284,6 @@ function asMatrix(v, where) {
|
|
|
282
284
|
throw new Error(`${where}: expected a matrix`);
|
|
283
285
|
}
|
|
284
286
|
|
|
285
|
-
// src/usd/AssetResolver.ts
|
|
286
|
-
var DefaultAssetResolver = class {
|
|
287
|
-
resolve(assetPath, baseUrl) {
|
|
288
|
-
try {
|
|
289
|
-
return new URL(assetPath, baseUrl || void 0).href;
|
|
290
|
-
} catch {
|
|
291
|
-
return joinPosix(baseUrl, assetPath);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
async fetchText(url) {
|
|
295
|
-
const res = await fetch(url);
|
|
296
|
-
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
|
|
297
|
-
return res.text();
|
|
298
|
-
}
|
|
299
|
-
async fetchBytes(url) {
|
|
300
|
-
const res = await fetch(url);
|
|
301
|
-
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
|
|
302
|
-
return new Uint8Array(await res.arrayBuffer());
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
function createMemoryResolver(files) {
|
|
306
|
-
const decoder = new TextDecoder();
|
|
307
|
-
const encoder = new TextEncoder();
|
|
308
|
-
return {
|
|
309
|
-
resolve(assetPath, baseUrl) {
|
|
310
|
-
return joinPosix(baseUrl, assetPath);
|
|
311
|
-
},
|
|
312
|
-
fetchText(url) {
|
|
313
|
-
const v = files[url];
|
|
314
|
-
if (v === void 0) return Promise.reject(new Error(`asset not found: ${url}`));
|
|
315
|
-
return Promise.resolve(typeof v === "string" ? v : decoder.decode(v));
|
|
316
|
-
},
|
|
317
|
-
fetchBytes(url) {
|
|
318
|
-
const v = files[url];
|
|
319
|
-
if (v === void 0) return Promise.reject(new Error(`asset not found: ${url}`));
|
|
320
|
-
return Promise.resolve(typeof v === "string" ? encoder.encode(v) : v);
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
function joinPosix(baseUrl, rel) {
|
|
325
|
-
if (rel.startsWith("/")) return normalizePosix(rel);
|
|
326
|
-
const dir = baseUrl.slice(0, baseUrl.lastIndexOf("/") + 1);
|
|
327
|
-
return normalizePosix(dir + rel);
|
|
328
|
-
}
|
|
329
|
-
function normalizePosix(path) {
|
|
330
|
-
const isAbsolute = path.startsWith("/");
|
|
331
|
-
const out = [];
|
|
332
|
-
for (const part of path.split("/")) {
|
|
333
|
-
if (part === "" || part === ".") continue;
|
|
334
|
-
if (part === "..") out.pop();
|
|
335
|
-
else out.push(part);
|
|
336
|
-
}
|
|
337
|
-
return (isAbsolute ? "/" : "") + out.join("/");
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
// src/usd/mdl/parseMdl.ts
|
|
341
|
-
function isMdlTexture(value) {
|
|
342
|
-
return typeof value === "object" && value !== null && !Array.isArray(value) && "assetPath" in value;
|
|
343
|
-
}
|
|
344
|
-
function parseMdl(text) {
|
|
345
|
-
const src = stripNoise(text);
|
|
346
|
-
const materials = /* @__PURE__ */ new Map();
|
|
347
|
-
const declRe = /\bexport\s+material\s+([A-Za-z_]\w*)\s*\(/g;
|
|
348
|
-
let match = declRe.exec(src);
|
|
349
|
-
while (match) {
|
|
350
|
-
const open = match.index + match[0].length - 1;
|
|
351
|
-
const close = matchParen(src, open);
|
|
352
|
-
if (close === -1) break;
|
|
353
|
-
const decl = {
|
|
354
|
-
name: match[1],
|
|
355
|
-
defaults: parseParamDefaults(src.slice(open + 1, close - 1)),
|
|
356
|
-
args: /* @__PURE__ */ new Map()
|
|
357
|
-
};
|
|
358
|
-
let next = close;
|
|
359
|
-
let i = close;
|
|
360
|
-
while (i < src.length && /\s/.test(src[i])) i++;
|
|
361
|
-
if (src[i] === "=") {
|
|
362
|
-
const end = statementEnd(src, i + 1);
|
|
363
|
-
const body = parseWrapperBody(src.slice(i + 1, end));
|
|
364
|
-
if (body.base) decl.base = body.base;
|
|
365
|
-
decl.args = body.args;
|
|
366
|
-
next = end;
|
|
367
|
-
}
|
|
368
|
-
materials.set(decl.name, decl);
|
|
369
|
-
declRe.lastIndex = next;
|
|
370
|
-
match = declRe.exec(src);
|
|
371
|
-
}
|
|
372
|
-
return { materials };
|
|
373
|
-
}
|
|
374
|
-
var NUMBER_RE = /^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?[fFdD]?$/;
|
|
375
|
-
var CALL_RE = /^(?:::)?([A-Za-z_]\w*(?:::[A-Za-z_]\w*)*)\s*\(/;
|
|
376
|
-
var VECTOR_RE = /^(?:color|(?:float|double|int)([234]))$/;
|
|
377
|
-
var IDENTIFIER_RE = /^[A-Za-z_]\w*$/;
|
|
378
|
-
function parseMdlLiteral(src) {
|
|
379
|
-
const s = src.trim();
|
|
380
|
-
if (s === "true") return true;
|
|
381
|
-
if (s === "false") return false;
|
|
382
|
-
if (NUMBER_RE.test(s)) return Number.parseFloat(s.replace(/[fFdD]$/, ""));
|
|
383
|
-
if (s.startsWith('"')) {
|
|
384
|
-
if (skipString(s, 0) !== s.length) return void 0;
|
|
385
|
-
return s.slice(1, -1).replace(/\\(.)/g, "$1");
|
|
386
|
-
}
|
|
387
|
-
const call = CALL_RE.exec(s);
|
|
388
|
-
if (!call) return void 0;
|
|
389
|
-
const open = call[0].length - 1;
|
|
390
|
-
if (matchParen(s, open) !== s.length) return void 0;
|
|
391
|
-
const name = call[1].split("::").pop();
|
|
392
|
-
const args = splitTopLevel(s.slice(open + 1, s.length - 1), ",").map((a) => a.trim()).filter((a) => a.length > 0);
|
|
393
|
-
if (name === "texture_2d") {
|
|
394
|
-
const path = args[0] === void 0 ? void 0 : parseMdlLiteral(args[0]);
|
|
395
|
-
if (typeof path !== "string" || path.length === 0) return void 0;
|
|
396
|
-
const texture = { assetPath: path };
|
|
397
|
-
const gamma = args.slice(1).join(",");
|
|
398
|
-
if (gamma.includes("gamma_srgb")) texture.sourceColorSpace = "sRGB";
|
|
399
|
-
else if (gamma.includes("gamma_linear")) texture.sourceColorSpace = "raw";
|
|
400
|
-
return texture;
|
|
401
|
-
}
|
|
402
|
-
const vector = VECTOR_RE.exec(name);
|
|
403
|
-
if (vector) {
|
|
404
|
-
const width = vector[1] ? Number(vector[1]) : 3;
|
|
405
|
-
const values = args.map((a) => parseMdlLiteral(a));
|
|
406
|
-
if (values.length === 0 || !values.every((v) => typeof v === "number")) return void 0;
|
|
407
|
-
if (values.length === 1) return new Array(width).fill(values[0]);
|
|
408
|
-
return values.length === width ? values : void 0;
|
|
409
|
-
}
|
|
410
|
-
return void 0;
|
|
411
|
-
}
|
|
412
|
-
function parseParamDefaults(src) {
|
|
413
|
-
const defaults = /* @__PURE__ */ new Map();
|
|
414
|
-
const body = src.trim();
|
|
415
|
-
if (body === "" || body === "*") return defaults;
|
|
416
|
-
for (const param of splitTopLevel(src, ",")) {
|
|
417
|
-
const assign = topLevelAssign(param);
|
|
418
|
-
if (assign === -1) continue;
|
|
419
|
-
const name = param.slice(0, assign).trim().split(/\s+/).pop();
|
|
420
|
-
if (!name || !IDENTIFIER_RE.test(name)) continue;
|
|
421
|
-
const value = parseMdlLiteral(param.slice(assign + 1));
|
|
422
|
-
if (value !== void 0) defaults.set(name, value);
|
|
423
|
-
}
|
|
424
|
-
return defaults;
|
|
425
|
-
}
|
|
426
|
-
function parseWrapperBody(src) {
|
|
427
|
-
const args = /* @__PURE__ */ new Map();
|
|
428
|
-
const body = src.trim();
|
|
429
|
-
const call = CALL_RE.exec(body);
|
|
430
|
-
if (!call) return { args };
|
|
431
|
-
const open = call[0].length - 1;
|
|
432
|
-
if (matchParen(body, open) !== body.length) return { args };
|
|
433
|
-
const base = call[1].split("::").pop();
|
|
434
|
-
if (base === "material") return { args };
|
|
435
|
-
for (const arg of splitTopLevel(body.slice(open + 1, body.length - 1), ",")) {
|
|
436
|
-
const colon = topLevelColon(arg);
|
|
437
|
-
if (colon === -1) continue;
|
|
438
|
-
const name = arg.slice(0, colon).trim();
|
|
439
|
-
if (!IDENTIFIER_RE.test(name)) continue;
|
|
440
|
-
const value = parseMdlLiteral(arg.slice(colon + 1));
|
|
441
|
-
if (value !== void 0) args.set(name, value);
|
|
442
|
-
}
|
|
443
|
-
return { base, args };
|
|
444
|
-
}
|
|
445
|
-
function stripNoise(src) {
|
|
446
|
-
let out = "";
|
|
447
|
-
let i = 0;
|
|
448
|
-
while (i < src.length) {
|
|
449
|
-
const c = src[i];
|
|
450
|
-
if (c === '"') {
|
|
451
|
-
const end = skipString(src, i);
|
|
452
|
-
out += src.slice(i, end);
|
|
453
|
-
i = end;
|
|
454
|
-
} else if (c === "/" && src[i + 1] === "/") {
|
|
455
|
-
while (i < src.length && src[i] !== "\n") i++;
|
|
456
|
-
} else if (c === "/" && src[i + 1] === "*") {
|
|
457
|
-
const end = src.indexOf("*/", i + 2);
|
|
458
|
-
i = end === -1 ? src.length : end + 2;
|
|
459
|
-
out += " ";
|
|
460
|
-
} else if (c === "[" && src[i + 1] === "[") {
|
|
461
|
-
i = skipAnnotation(src, i);
|
|
462
|
-
out += " ";
|
|
463
|
-
} else {
|
|
464
|
-
out += c;
|
|
465
|
-
i++;
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
return out;
|
|
469
|
-
}
|
|
470
|
-
function skipString(src, i) {
|
|
471
|
-
let j = i + 1;
|
|
472
|
-
while (j < src.length) {
|
|
473
|
-
if (src[j] === "\\") j += 2;
|
|
474
|
-
else if (src[j] === '"') return j + 1;
|
|
475
|
-
else j++;
|
|
476
|
-
}
|
|
477
|
-
return j;
|
|
478
|
-
}
|
|
479
|
-
function skipAnnotation(src, i) {
|
|
480
|
-
let depth = 0;
|
|
481
|
-
let j = i;
|
|
482
|
-
while (j < src.length) {
|
|
483
|
-
if (src[j] === '"') {
|
|
484
|
-
j = skipString(src, j);
|
|
485
|
-
} else if (src[j] === "[" && src[j + 1] === "[") {
|
|
486
|
-
depth++;
|
|
487
|
-
j += 2;
|
|
488
|
-
} else if (src[j] === "]" && src[j + 1] === "]") {
|
|
489
|
-
depth--;
|
|
490
|
-
j += 2;
|
|
491
|
-
if (depth === 0) return j;
|
|
492
|
-
} else {
|
|
493
|
-
j++;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
return j;
|
|
497
|
-
}
|
|
498
|
-
function matchParen(src, open) {
|
|
499
|
-
let depth = 0;
|
|
500
|
-
let i = open;
|
|
501
|
-
while (i < src.length) {
|
|
502
|
-
const c = src[i];
|
|
503
|
-
if (c === '"') {
|
|
504
|
-
i = skipString(src, i);
|
|
505
|
-
continue;
|
|
506
|
-
}
|
|
507
|
-
if (c === "(") depth++;
|
|
508
|
-
else if (c === ")") {
|
|
509
|
-
depth--;
|
|
510
|
-
if (depth === 0) return i + 1;
|
|
511
|
-
}
|
|
512
|
-
i++;
|
|
513
|
-
}
|
|
514
|
-
return -1;
|
|
515
|
-
}
|
|
516
|
-
function isOpener(c) {
|
|
517
|
-
return c === "(" || c === "[" || c === "{";
|
|
518
|
-
}
|
|
519
|
-
function isCloser(c) {
|
|
520
|
-
return c === ")" || c === "]" || c === "}";
|
|
521
|
-
}
|
|
522
|
-
function splitTopLevel(src, separator) {
|
|
523
|
-
const parts = [];
|
|
524
|
-
let depth = 0;
|
|
525
|
-
let start = 0;
|
|
526
|
-
let i = 0;
|
|
527
|
-
while (i < src.length) {
|
|
528
|
-
const c = src[i];
|
|
529
|
-
if (c === '"') {
|
|
530
|
-
i = skipString(src, i);
|
|
531
|
-
continue;
|
|
532
|
-
}
|
|
533
|
-
if (isOpener(c)) depth++;
|
|
534
|
-
else if (isCloser(c)) depth--;
|
|
535
|
-
else if (c === separator && depth === 0) {
|
|
536
|
-
parts.push(src.slice(start, i));
|
|
537
|
-
start = i + 1;
|
|
538
|
-
}
|
|
539
|
-
i++;
|
|
540
|
-
}
|
|
541
|
-
parts.push(src.slice(start));
|
|
542
|
-
return parts;
|
|
543
|
-
}
|
|
544
|
-
function statementEnd(src, from) {
|
|
545
|
-
let depth = 0;
|
|
546
|
-
let i = from;
|
|
547
|
-
while (i < src.length) {
|
|
548
|
-
const c = src[i];
|
|
549
|
-
if (c === '"') {
|
|
550
|
-
i = skipString(src, i);
|
|
551
|
-
continue;
|
|
552
|
-
}
|
|
553
|
-
if (isOpener(c)) depth++;
|
|
554
|
-
else if (isCloser(c)) depth--;
|
|
555
|
-
else if (c === ";" && depth === 0) return i;
|
|
556
|
-
i++;
|
|
557
|
-
}
|
|
558
|
-
return src.length;
|
|
559
|
-
}
|
|
560
|
-
function topLevelAssign(src) {
|
|
561
|
-
let depth = 0;
|
|
562
|
-
let i = 0;
|
|
563
|
-
while (i < src.length) {
|
|
564
|
-
const c = src[i];
|
|
565
|
-
if (c === '"') {
|
|
566
|
-
i = skipString(src, i);
|
|
567
|
-
continue;
|
|
568
|
-
}
|
|
569
|
-
if (isOpener(c)) depth++;
|
|
570
|
-
else if (isCloser(c)) depth--;
|
|
571
|
-
else if (c === "=" && depth === 0 && src[i + 1] !== "=" && !"<>!=".includes(src[i - 1] ?? "")) {
|
|
572
|
-
return i;
|
|
573
|
-
}
|
|
574
|
-
i++;
|
|
575
|
-
}
|
|
576
|
-
return -1;
|
|
577
|
-
}
|
|
578
|
-
function topLevelColon(src) {
|
|
579
|
-
let depth = 0;
|
|
580
|
-
let i = 0;
|
|
581
|
-
while (i < src.length) {
|
|
582
|
-
const c = src[i];
|
|
583
|
-
if (c === '"') {
|
|
584
|
-
i = skipString(src, i);
|
|
585
|
-
continue;
|
|
586
|
-
}
|
|
587
|
-
if (isOpener(c)) depth++;
|
|
588
|
-
else if (isCloser(c)) depth--;
|
|
589
|
-
else if (c === ":" && depth === 0) {
|
|
590
|
-
if (src[i + 1] === ":") {
|
|
591
|
-
i += 2;
|
|
592
|
-
continue;
|
|
593
|
-
}
|
|
594
|
-
return i;
|
|
595
|
-
}
|
|
596
|
-
i++;
|
|
597
|
-
}
|
|
598
|
-
return -1;
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
// src/three/MaterialBinding.ts
|
|
602
|
-
var DIFFUSE_INPUTS = [
|
|
603
|
-
"diffuseColor",
|
|
604
|
-
// UsdPreviewSurface
|
|
605
|
-
"diffuse_color_constant",
|
|
606
|
-
// OmniPBR
|
|
607
|
-
"diffuse_tint",
|
|
608
|
-
"base_color",
|
|
609
|
-
"baseColor"
|
|
610
|
-
];
|
|
611
|
-
var OPACITY_INPUTS = ["opacity", "opacity_constant"];
|
|
612
|
-
var OPACITY_THRESHOLD_INPUTS = ["opacityThreshold", "opacity_threshold"];
|
|
613
|
-
var METALLIC_INPUTS = ["metallic", "metallic_constant"];
|
|
614
|
-
var ROUGHNESS_INPUTS = ["roughness", "reflection_roughness_constant"];
|
|
615
|
-
var EMISSIVE_INPUTS = ["emissiveColor", "emissive_color"];
|
|
616
|
-
var SURFACE_OUTPUTS = ["outputs:surface", "outputs:mdl:surface"];
|
|
617
|
-
var TEXTURE_LOOKUPS = {
|
|
618
|
-
color: {
|
|
619
|
-
surface: ["diffuseColor"],
|
|
620
|
-
direct: ["diffuse_texture", "diffuse_color_texture", "glass_color_texture"]
|
|
621
|
-
},
|
|
622
|
-
opacity: {
|
|
623
|
-
surface: ["opacity"],
|
|
624
|
-
direct: ["opacity_texture", "opacity_color_texture"]
|
|
625
|
-
},
|
|
626
|
-
normal: {
|
|
627
|
-
surface: ["normal"],
|
|
628
|
-
direct: ["normalmap_texture", "normal_texture", "normal_map_texture"]
|
|
629
|
-
},
|
|
630
|
-
roughness: {
|
|
631
|
-
surface: ["roughness"],
|
|
632
|
-
direct: ["reflectionroughness_texture", "roughness_texture"]
|
|
633
|
-
},
|
|
634
|
-
metalness: {
|
|
635
|
-
surface: ["metallic"],
|
|
636
|
-
direct: ["metallic_texture"]
|
|
637
|
-
},
|
|
638
|
-
occlusion: {
|
|
639
|
-
surface: ["occlusion"],
|
|
640
|
-
direct: ["ao_texture", "occlusion_texture"]
|
|
641
|
-
},
|
|
642
|
-
emissive: {
|
|
643
|
-
surface: ["emissiveColor"],
|
|
644
|
-
direct: ["emissive_color_texture", "emissive_mask_texture"]
|
|
645
|
-
}
|
|
646
|
-
};
|
|
647
|
-
function resolveBoundMaterial(stage, prim, options = {}) {
|
|
648
|
-
const materialPath = findBinding(prim);
|
|
649
|
-
if (!materialPath) return void 0;
|
|
650
|
-
const material = stage.GetPrimAtPath(materialPath);
|
|
651
|
-
if (!material) return void 0;
|
|
652
|
-
const shader = findSurfaceShader(material);
|
|
653
|
-
if (!shader) return void 0;
|
|
654
|
-
const mdlSource = readMdlShaderSource(shader, options.mdl);
|
|
655
|
-
if (mdlSource && !mdlSource.family) {
|
|
656
|
-
options.onWarn?.(
|
|
657
|
-
`${material.GetPath()}: unknown MDL material "${mdlSource.id}" (${mdlSource.assetPath}); applying the best-effort OmniPBR mapping`
|
|
658
|
-
);
|
|
659
|
-
}
|
|
660
|
-
const sv = { shader };
|
|
661
|
-
if (mdlSource?.values) sv.mdl = mdlSource.values;
|
|
662
|
-
if (mdlSource) sv.mdlAssetPath = mdlSource.assetPath;
|
|
663
|
-
const result = { name: material.GetName() };
|
|
664
|
-
const color = firstColor(sv, DIFFUSE_INPUTS);
|
|
665
|
-
if (color) result.color = color;
|
|
666
|
-
const opacity = firstNumber(sv, OPACITY_INPUTS);
|
|
667
|
-
if (opacity !== void 0) result.opacity = opacity;
|
|
668
|
-
const opacityThreshold = firstNumber(sv, OPACITY_THRESHOLD_INPUTS);
|
|
669
|
-
if (opacityThreshold !== void 0) result.opacityThreshold = opacityThreshold;
|
|
670
|
-
const metalness = firstNumber(sv, METALLIC_INPUTS);
|
|
671
|
-
if (metalness !== void 0) result.metalness = metalness;
|
|
672
|
-
const roughness = firstNumber(sv, ROUGHNESS_INPUTS);
|
|
673
|
-
if (roughness !== void 0) result.roughness = roughness;
|
|
674
|
-
const emissive = firstColor(sv, EMISSIVE_INPUTS);
|
|
675
|
-
if (emissive && svBoolean(sv, "enable_emission") !== false) {
|
|
676
|
-
result.emissiveColor = emissive;
|
|
677
|
-
const intensity = svNumber(sv, "emissive_intensity");
|
|
678
|
-
if (intensity !== void 0) result.emissiveIntensity = intensity;
|
|
679
|
-
}
|
|
680
|
-
const ior = svNumber(sv, "ior");
|
|
681
|
-
if (ior !== void 0) result.ior = ior;
|
|
682
|
-
const clearcoat = svNumber(sv, "clearcoat");
|
|
683
|
-
if (clearcoat !== void 0) result.clearcoat = clearcoat;
|
|
684
|
-
const clearcoatRoughness = svNumber(sv, "clearcoatRoughness");
|
|
685
|
-
if (clearcoatRoughness !== void 0) result.clearcoatRoughness = clearcoatRoughness;
|
|
686
|
-
if (svNumber(sv, "useSpecularWorkflow") === 1) {
|
|
687
|
-
const specular = svColor(sv, "specularColor");
|
|
688
|
-
if (specular) result.specularColor = specular;
|
|
689
|
-
}
|
|
690
|
-
const colorTex = findTexture(sv, TEXTURE_LOOKUPS.color);
|
|
691
|
-
if (colorTex !== void 0) result.colorTexture = colorTex;
|
|
692
|
-
const opacityTex = findTexture(sv, TEXTURE_LOOKUPS.opacity);
|
|
693
|
-
if (opacityTex !== void 0) result.opacityTexture = opacityTex;
|
|
694
|
-
const normal = findTexture(sv, TEXTURE_LOOKUPS.normal);
|
|
695
|
-
if (normal !== void 0) result.normalTexture = normal;
|
|
696
|
-
const roughTex = findTexture(sv, TEXTURE_LOOKUPS.roughness);
|
|
697
|
-
if (roughTex !== void 0) result.roughnessTexture = roughTex;
|
|
698
|
-
const metalTex = findTexture(sv, TEXTURE_LOOKUPS.metalness);
|
|
699
|
-
if (metalTex !== void 0) result.metalnessTexture = metalTex;
|
|
700
|
-
const aoTex = findTexture(sv, TEXTURE_LOOKUPS.occlusion);
|
|
701
|
-
if (aoTex !== void 0) result.occlusionTexture = aoTex;
|
|
702
|
-
const emissiveTex = findTexture(sv, TEXTURE_LOOKUPS.emissive);
|
|
703
|
-
if (emissiveTex !== void 0) result.emissiveTexture = emissiveTex;
|
|
704
|
-
const orm = directTexture(sv, "ORM_texture") ?? mdlValueTexture(sv, "ORM_texture");
|
|
705
|
-
if (svBoolean(sv, "enable_ORM_texture") === true && orm) {
|
|
706
|
-
result.occlusionTexture = { ...orm, outputChannel: "r" };
|
|
707
|
-
result.roughnessTexture = { ...orm, outputChannel: "g" };
|
|
708
|
-
result.metalnessTexture = { ...orm, outputChannel: "b" };
|
|
709
|
-
}
|
|
710
|
-
switch (mdlSource?.family) {
|
|
711
|
-
case "glass":
|
|
712
|
-
readOmniGlass(sv, result);
|
|
713
|
-
break;
|
|
714
|
-
case "clearcoat":
|
|
715
|
-
readOmniClearCoat(sv, result);
|
|
716
|
-
break;
|
|
717
|
-
case "surface":
|
|
718
|
-
readOmniSurface(sv, result);
|
|
719
|
-
break;
|
|
720
|
-
}
|
|
721
|
-
return result;
|
|
722
|
-
}
|
|
723
|
-
function classifyOmniMdl(name) {
|
|
724
|
-
if (!name) return void 0;
|
|
725
|
-
if (name.startsWith("OmniGlass")) return "glass";
|
|
726
|
-
if (name.startsWith("OmniPBR_ClearCoat")) return "clearcoat";
|
|
727
|
-
if (name.startsWith("OmniPBR")) return "pbr";
|
|
728
|
-
if (name.startsWith("OmniSurface")) return "surface";
|
|
729
|
-
return void 0;
|
|
730
|
-
}
|
|
731
|
-
function readMdlShaderSource(shader, provider) {
|
|
732
|
-
const asset = shader.GetAttribute("info:mdl:sourceAsset").Get();
|
|
733
|
-
if (!(asset instanceof AssetPath) || !asset.path) return void 0;
|
|
734
|
-
const sub = shader.GetAttribute("info:mdl:sourceAsset:subIdentifier").Get();
|
|
735
|
-
const stem = (asset.path.split("/").pop() ?? "").replace(/\.mdl$/i, "");
|
|
736
|
-
const id = typeof sub === "string" && sub.length > 0 ? sub : stem;
|
|
737
|
-
const decl = provider?.(asset.path)?.materials.get(id);
|
|
738
|
-
const family = classifyOmniMdl(decl?.base) ?? classifyOmniMdl(id) ?? classifyOmniMdl(stem);
|
|
739
|
-
const source = { assetPath: asset.path, id };
|
|
740
|
-
if (family) source.family = family;
|
|
741
|
-
if (decl && (decl.defaults.size > 0 || decl.args.size > 0)) {
|
|
742
|
-
source.values = new Map([...decl.defaults, ...decl.args]);
|
|
743
|
-
}
|
|
744
|
-
return source;
|
|
745
|
-
}
|
|
746
|
-
function readOmniGlass(sv, result) {
|
|
747
|
-
result.transmission = 1;
|
|
748
|
-
result.metalness = 0;
|
|
749
|
-
result.color = svColor(sv, "glass_color") ?? [1, 1, 1];
|
|
750
|
-
result.ior = svNumber(sv, "glass_ior") ?? 1.491;
|
|
751
|
-
result.roughness = svNumber(sv, "frosting_roughness") ?? 0;
|
|
752
|
-
const depth = svNumber(sv, "depth");
|
|
753
|
-
if (svBoolean(sv, "thin_walled") !== true && depth !== void 0) result.thickness = depth;
|
|
754
|
-
const cutout = svNumber(sv, "cutout_opacity");
|
|
755
|
-
if (cutout !== void 0 && cutout < 1) result.opacity = cutout;
|
|
756
|
-
}
|
|
757
|
-
function readOmniClearCoat(sv, result) {
|
|
758
|
-
if (svBoolean(sv, "enable_clearcoat") === false) return;
|
|
759
|
-
result.clearcoat = 1;
|
|
760
|
-
const roughness = svNumber(sv, "clearcoat_reflection_roughness");
|
|
761
|
-
if (roughness !== void 0) result.clearcoatRoughness = roughness;
|
|
762
|
-
const normal = directTexture(sv, "clearcoat_normalmap_texture") ?? mdlValueTexture(sv, "clearcoat_normalmap_texture");
|
|
763
|
-
if (normal && svBoolean(sv, "enable_clearcoat_normalmap_texture") !== false) {
|
|
764
|
-
result.clearcoatNormalTexture = normal;
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
function readOmniSurface(sv, result) {
|
|
768
|
-
const color = svColor(sv, "diffuse_reflection_color");
|
|
769
|
-
if (color) result.color = color;
|
|
770
|
-
const metalness = svNumber(sv, "metalness");
|
|
771
|
-
if (metalness !== void 0) result.metalness = metalness;
|
|
772
|
-
const roughness = svNumber(sv, "specular_reflection_roughness");
|
|
773
|
-
if (roughness !== void 0) result.roughness = roughness;
|
|
774
|
-
const ior = svNumber(sv, "specular_reflection_ior");
|
|
775
|
-
if (ior !== void 0) result.ior = ior;
|
|
776
|
-
const coat = svNumber(sv, "coat_weight");
|
|
777
|
-
if (coat !== void 0 && coat > 0) {
|
|
778
|
-
result.clearcoat = coat;
|
|
779
|
-
const coatRoughness = svNumber(sv, "coat_roughness");
|
|
780
|
-
if (coatRoughness !== void 0) result.clearcoatRoughness = coatRoughness;
|
|
781
|
-
}
|
|
782
|
-
const emissionWeight = svNumber(sv, "emission_weight");
|
|
783
|
-
const emissionColor = svColor(sv, "emission_color");
|
|
784
|
-
if (emissionWeight !== void 0 && emissionWeight > 0 && emissionColor) {
|
|
785
|
-
result.emissiveColor = emissionColor;
|
|
786
|
-
result.emissiveIntensity = emissionWeight;
|
|
787
|
-
}
|
|
788
|
-
if (svBoolean(sv, "enable_opacity") === true) {
|
|
789
|
-
const opacity = svNumber(sv, "geometry_opacity");
|
|
790
|
-
if (opacity !== void 0) result.opacity = opacity;
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
function authored(sv, name) {
|
|
794
|
-
return sv.shader.GetAttribute(`inputs:${name}`).Get();
|
|
795
|
-
}
|
|
796
|
-
function asNumber2(v) {
|
|
797
|
-
return typeof v === "number" ? v : void 0;
|
|
798
|
-
}
|
|
799
|
-
function asBoolean(v) {
|
|
800
|
-
return typeof v === "boolean" ? v : void 0;
|
|
801
|
-
}
|
|
802
|
-
function asVec(v, length) {
|
|
803
|
-
if (Array.isArray(v) && v.length >= length && v.every((n) => typeof n === "number")) {
|
|
804
|
-
return v.slice(0, length);
|
|
805
|
-
}
|
|
806
|
-
return void 0;
|
|
807
|
-
}
|
|
808
|
-
function svNumber(sv, name) {
|
|
809
|
-
return asNumber2(authored(sv, name)) ?? asNumber2(sv.mdl?.get(name));
|
|
810
|
-
}
|
|
811
|
-
function svBoolean(sv, name) {
|
|
812
|
-
return asBoolean(authored(sv, name)) ?? asBoolean(sv.mdl?.get(name));
|
|
813
|
-
}
|
|
814
|
-
function svColor(sv, name) {
|
|
815
|
-
const v = asVec(authored(sv, name), 3) ?? asVec(sv.mdl?.get(name), 3);
|
|
816
|
-
return v ? v : void 0;
|
|
817
|
-
}
|
|
818
|
-
function svVec2(sv, name) {
|
|
819
|
-
const v = asVec(authored(sv, name), 2) ?? asVec(sv.mdl?.get(name), 2);
|
|
820
|
-
return v ? v : void 0;
|
|
821
|
-
}
|
|
822
|
-
function firstNumber(sv, names) {
|
|
823
|
-
for (const name of names) {
|
|
824
|
-
const v = asNumber2(authored(sv, name));
|
|
825
|
-
if (v !== void 0) return v;
|
|
826
|
-
}
|
|
827
|
-
for (const name of names) {
|
|
828
|
-
const v = asNumber2(sv.mdl?.get(name));
|
|
829
|
-
if (v !== void 0) return v;
|
|
830
|
-
}
|
|
831
|
-
return void 0;
|
|
832
|
-
}
|
|
833
|
-
function firstColor(sv, names) {
|
|
834
|
-
for (const name of names) {
|
|
835
|
-
const v = asVec(authored(sv, name), 3);
|
|
836
|
-
if (v) return v;
|
|
837
|
-
}
|
|
838
|
-
for (const name of names) {
|
|
839
|
-
const v = asVec(sv.mdl?.get(name), 3);
|
|
840
|
-
if (v) return v;
|
|
841
|
-
}
|
|
842
|
-
return void 0;
|
|
843
|
-
}
|
|
844
|
-
function directTexture(sv, name) {
|
|
845
|
-
const v = authored(sv, name);
|
|
846
|
-
if (v instanceof AssetPath && v.path) return withMdlTransform(sv, { path: v.path });
|
|
847
|
-
return void 0;
|
|
848
|
-
}
|
|
849
|
-
function mdlValueTexture(sv, name) {
|
|
850
|
-
const v = sv.mdl?.get(name);
|
|
851
|
-
if (!isMdlTexture(v)) return void 0;
|
|
852
|
-
const texture = { path: resolveMdlRelative(sv.mdlAssetPath, v.assetPath) };
|
|
853
|
-
if (v.sourceColorSpace) texture.sourceColorSpace = v.sourceColorSpace;
|
|
854
|
-
return withMdlTransform(sv, texture);
|
|
855
|
-
}
|
|
856
|
-
function resolveMdlRelative(modulePath, path) {
|
|
857
|
-
if (!modulePath || path.startsWith("/") || /^[a-z][a-z0-9+.-]*:/i.test(path)) return path;
|
|
858
|
-
return joinPosix(modulePath, path);
|
|
859
|
-
}
|
|
860
|
-
function withMdlTransform(sv, texture) {
|
|
861
|
-
const transform = mdlTextureTransform(sv);
|
|
862
|
-
return transform ? { ...texture, transform } : texture;
|
|
863
|
-
}
|
|
864
|
-
function findTexture(sv, lookup) {
|
|
865
|
-
for (const name of lookup.direct) {
|
|
866
|
-
const texture = directTexture(sv, name);
|
|
867
|
-
if (texture) return texture;
|
|
868
|
-
}
|
|
869
|
-
for (const name of lookup.surface) {
|
|
870
|
-
const conn = sv.shader.GetAttribute(`inputs:${name}`).GetConnections()[0];
|
|
871
|
-
if (!conn) continue;
|
|
872
|
-
const texPrim = sv.shader.GetStage().GetPrimAtPath(conn.split(".")[0]);
|
|
873
|
-
if (!texPrim) continue;
|
|
874
|
-
const file = texPrim.GetAttribute("inputs:file").Get();
|
|
875
|
-
if (file instanceof AssetPath && file.path) {
|
|
876
|
-
const tex = readUvTexture(texPrim, file.path);
|
|
877
|
-
const channel = outputChannelOf(conn);
|
|
878
|
-
if (channel) tex.outputChannel = channel;
|
|
879
|
-
return tex;
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
for (const name of lookup.direct) {
|
|
883
|
-
const texture = mdlValueTexture(sv, name);
|
|
884
|
-
if (texture) return texture;
|
|
885
|
-
}
|
|
886
|
-
return void 0;
|
|
887
|
-
}
|
|
888
|
-
function outputChannelOf(connection) {
|
|
889
|
-
const m = /\.outputs:(\w+)$/.exec(connection);
|
|
890
|
-
switch (m?.[1]) {
|
|
891
|
-
case "r":
|
|
892
|
-
case "g":
|
|
893
|
-
case "b":
|
|
894
|
-
case "a":
|
|
895
|
-
return m[1];
|
|
896
|
-
case "rgb":
|
|
897
|
-
case "rgba":
|
|
898
|
-
return "rgb";
|
|
899
|
-
default:
|
|
900
|
-
return void 0;
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
function mdlTextureTransform(sv) {
|
|
904
|
-
const transform = {};
|
|
905
|
-
const translation = svVec2(sv, "texture_translate");
|
|
906
|
-
if (translation) transform.translation = translation;
|
|
907
|
-
const scale = svVec2(sv, "texture_scale");
|
|
908
|
-
if (scale) transform.scale = scale;
|
|
909
|
-
const rotation = svNumber(sv, "texture_rotate");
|
|
910
|
-
if (rotation !== void 0) transform.rotation = rotation;
|
|
911
|
-
return Object.keys(transform).length > 0 ? transform : void 0;
|
|
912
|
-
}
|
|
913
|
-
var WRAP_VALUES = /* @__PURE__ */ new Set(["repeat", "clamp", "mirror", "black"]);
|
|
914
|
-
function readUvTexture(texPrim, path) {
|
|
915
|
-
const tex = { path };
|
|
916
|
-
const wrapS = texPrim.GetAttribute("inputs:wrapS").Get();
|
|
917
|
-
if (typeof wrapS === "string" && WRAP_VALUES.has(wrapS)) tex.wrapS = wrapS;
|
|
918
|
-
const wrapT = texPrim.GetAttribute("inputs:wrapT").Get();
|
|
919
|
-
if (typeof wrapT === "string" && WRAP_VALUES.has(wrapT)) tex.wrapT = wrapT;
|
|
920
|
-
const scale = numArray(texPrim, "inputs:scale", 4);
|
|
921
|
-
if (scale) tex.scale = scale;
|
|
922
|
-
const bias = numArray(texPrim, "inputs:bias", 4);
|
|
923
|
-
if (bias) tex.bias = bias;
|
|
924
|
-
const sourceColorSpace = texPrim.GetAttribute("inputs:sourceColorSpace").Get();
|
|
925
|
-
if (sourceColorSpace === "raw" || sourceColorSpace === "sRGB" || sourceColorSpace === "auto") {
|
|
926
|
-
tex.sourceColorSpace = sourceColorSpace;
|
|
927
|
-
}
|
|
928
|
-
const st = readStChain(texPrim);
|
|
929
|
-
if (st.transform) tex.transform = st.transform;
|
|
930
|
-
if (st.uvSet) tex.uvSet = st.uvSet;
|
|
931
|
-
return tex;
|
|
932
|
-
}
|
|
933
|
-
function connectedPrim(prim, input) {
|
|
934
|
-
const conn = prim.GetAttribute(input).GetConnections()[0];
|
|
935
|
-
if (!conn) return null;
|
|
936
|
-
return prim.GetStage().GetPrimAtPath(conn.split(".")[0]);
|
|
937
|
-
}
|
|
938
|
-
function readStChain(texPrim) {
|
|
939
|
-
const out = {};
|
|
940
|
-
let node = connectedPrim(texPrim, "inputs:st");
|
|
941
|
-
if (node && node.GetAttribute("info:id").Get() === "UsdTransform2d") {
|
|
942
|
-
const transform = {};
|
|
943
|
-
const translation = numArray(node, "inputs:translation", 2);
|
|
944
|
-
if (translation) transform.translation = translation;
|
|
945
|
-
const scale = numArray(node, "inputs:scale", 2);
|
|
946
|
-
if (scale) transform.scale = scale;
|
|
947
|
-
const rotation = node.GetAttribute("inputs:rotation").Get();
|
|
948
|
-
if (typeof rotation === "number") transform.rotation = rotation;
|
|
949
|
-
if (Object.keys(transform).length > 0) out.transform = transform;
|
|
950
|
-
node = connectedPrim(node, "inputs:in");
|
|
951
|
-
}
|
|
952
|
-
if (node && node.GetAttribute("info:id").Get() === "UsdPrimvarReader_float2") {
|
|
953
|
-
const varname = node.GetAttribute("inputs:varname").Get();
|
|
954
|
-
if (typeof varname === "string" && varname.length > 0) out.uvSet = varname;
|
|
955
|
-
}
|
|
956
|
-
return out;
|
|
957
|
-
}
|
|
958
|
-
function numArray(prim, name, length) {
|
|
959
|
-
return asVec(prim.GetAttribute(name).Get(), length);
|
|
960
|
-
}
|
|
961
|
-
function findBinding(prim) {
|
|
962
|
-
let chosen;
|
|
963
|
-
let p = prim;
|
|
964
|
-
while (p) {
|
|
965
|
-
for (const name of ["material:binding:preview", "material:binding"]) {
|
|
966
|
-
const rel = p.GetRelationship(name);
|
|
967
|
-
const target = rel.GetTargets()[0];
|
|
968
|
-
if (!target) continue;
|
|
969
|
-
const stronger = rel.GetMetadata("bindMaterialAs") === "strongerThanDescendants";
|
|
970
|
-
if (chosen === void 0 || stronger) chosen = target;
|
|
971
|
-
break;
|
|
972
|
-
}
|
|
973
|
-
p = p.GetParent();
|
|
974
|
-
}
|
|
975
|
-
return chosen;
|
|
976
|
-
}
|
|
977
|
-
function findSurfaceShader(material) {
|
|
978
|
-
for (const out of SURFACE_OUTPUTS) {
|
|
979
|
-
const conn = material.GetAttribute(out).GetConnections()[0];
|
|
980
|
-
if (conn) {
|
|
981
|
-
const shaderPath = conn.split(".")[0];
|
|
982
|
-
const shader = material.GetStage().GetPrimAtPath(shaderPath);
|
|
983
|
-
if (shader) return shader;
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
return material.GetChildren().find((c) => c.GetTypeName() === "Shader") ?? void 0;
|
|
987
|
-
}
|
|
988
|
-
|
|
989
287
|
// src/robot/buildKinematicTree.ts
|
|
990
288
|
var WORLD = "";
|
|
991
289
|
function buildKinematicTree(robot, options = {}) {
|
|
@@ -1352,7 +650,7 @@ var TokenizeError = class extends Error {
|
|
|
1352
650
|
};
|
|
1353
651
|
var IDENT_START = /[A-Za-z_]/;
|
|
1354
652
|
var IDENT_CONT = /[A-Za-z0-9_:]/;
|
|
1355
|
-
var
|
|
653
|
+
var NUMBER_RE = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/;
|
|
1356
654
|
var INF_NAN_RE = /^[-+]?(?:inf|nan)\b/i;
|
|
1357
655
|
function tokenize(src) {
|
|
1358
656
|
const tokens = [];
|
|
@@ -1424,7 +722,7 @@ function tokenize(src) {
|
|
|
1424
722
|
continue;
|
|
1425
723
|
}
|
|
1426
724
|
if (/[0-9]/.test(c) || (c === "-" || c === "+" || c === ".") && /[0-9.]/.test(src[i + 1] ?? "")) {
|
|
1427
|
-
const m =
|
|
725
|
+
const m = NUMBER_RE.exec(src.slice(i));
|
|
1428
726
|
if (m) {
|
|
1429
727
|
const text = m[0];
|
|
1430
728
|
push("number", text, startCol, Number(text));
|
|
@@ -3525,7 +2823,7 @@ function crateToUsdaFile(crate) {
|
|
|
3525
2823
|
if (spec.specType !== SPEC_PRIM) continue;
|
|
3526
2824
|
const fm = fieldsOf(spec.fieldSetIndex);
|
|
3527
2825
|
primByPath.set(path, {
|
|
3528
|
-
specifier: SPECIFIERS2[
|
|
2826
|
+
specifier: SPECIFIERS2[asNumber2(crate, fm.get("specifier")) ?? 0] ?? "def",
|
|
3529
2827
|
typeName: asString(crate, fm.get("typeName")) ?? "",
|
|
3530
2828
|
name: leaf(path),
|
|
3531
2829
|
metadata: buildPrimMetadata(crate, fm),
|
|
@@ -3579,7 +2877,7 @@ function buildAttribute(crate, name, fm) {
|
|
|
3579
2877
|
name,
|
|
3580
2878
|
typeName: isArrayType ? rawType.slice(0, -2) : rawType,
|
|
3581
2879
|
isArray: isArrayType || (defaultRep !== void 0 ? decodeRepBits(defaultRep).isArray : false),
|
|
3582
|
-
variability:
|
|
2880
|
+
variability: asNumber2(crate, fm.get("variability")) === 1 ? "uniform" : "varying",
|
|
3583
2881
|
custom: customRep !== void 0 && crate.getValue(customRep) === true,
|
|
3584
2882
|
metadata: {},
|
|
3585
2883
|
line: 0
|
|
@@ -3651,10 +2949,10 @@ function buildLayerMetadata(crate, fm) {
|
|
|
3651
2949
|
if (upAxis !== void 0) meta.upAxis = upAxis;
|
|
3652
2950
|
const defaultPrim2 = asString(crate, fm.get("defaultPrim"));
|
|
3653
2951
|
if (defaultPrim2 !== void 0) meta.defaultPrim = defaultPrim2;
|
|
3654
|
-
const metersPerUnit =
|
|
2952
|
+
const metersPerUnit = asNumber2(crate, fm.get("metersPerUnit"));
|
|
3655
2953
|
if (metersPerUnit !== void 0) meta.metersPerUnit = metersPerUnit;
|
|
3656
2954
|
for (const key of ["startTimeCode", "endTimeCode", "timeCodesPerSecond", "framesPerSecond"]) {
|
|
3657
|
-
const value =
|
|
2955
|
+
const value = asNumber2(crate, fm.get(key));
|
|
3658
2956
|
if (value !== void 0) meta[key] = value;
|
|
3659
2957
|
}
|
|
3660
2958
|
const customLayerData = fm.has("customLayerData") ? crate.getValue(fm.get("customLayerData")) : void 0;
|
|
@@ -3668,7 +2966,7 @@ function asString(crate, rep) {
|
|
|
3668
2966
|
const v = crate.getValue(rep);
|
|
3669
2967
|
return typeof v === "string" ? v : void 0;
|
|
3670
2968
|
}
|
|
3671
|
-
function
|
|
2969
|
+
function asNumber2(crate, rep) {
|
|
3672
2970
|
if (rep === void 0) return void 0;
|
|
3673
2971
|
const v = crate.getValue(rep);
|
|
3674
2972
|
return typeof v === "number" ? v : void 0;
|
|
@@ -4048,6 +3346,6 @@ function openUsdz(bytes) {
|
|
|
4048
3346
|
return { rootEntry, resolver };
|
|
4049
3347
|
}
|
|
4050
3348
|
|
|
4051
|
-
export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT,
|
|
4052
|
-
//# sourceMappingURL=chunk-
|
|
4053
|
-
//# sourceMappingURL=chunk-
|
|
3349
|
+
export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, Layer, MASS_API, MESH_COLLISION_API, PHYSICS_MATERIAL_API, ParseError, Prim, RIGID_BODY_API, Relationship, Stage, TokenizeError, buildKinematicTree, collectMdlAssetPaths, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, driveKindFor, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, getMaterialSubsets, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isBasisCurves, isMesh, isNonVisualPurpose, isPoints, isRenderableGprim, isScope, isSolidGprim, isUnsupportedGprim, isXform, isZip, iterDescendants, jointValueFromSI, jointValueToSI, loadMdlModules, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, serializeUsda, toBytes, tokenize };
|
|
3350
|
+
//# sourceMappingURL=chunk-6W4LQVEQ.js.map
|
|
3351
|
+
//# sourceMappingURL=chunk-6W4LQVEQ.js.map
|