three-usd-robot 0.13.0 → 0.14.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 +19 -1
- package/dist/{MeshBinding-B_8RhuQE.d.ts → MeshBinding-5Dad1EOh.d.ts} +16 -4
- package/dist/{ThreeUsdRobot-X1zbpRZo.d.ts → ThreeUsdRobot-CurQqRqu.d.ts} +78 -2
- package/dist/{ThreeUsdRobotLoader-u3d1yoLM.d.ts → ThreeUsdRobotLoader-DrYXpMta.d.ts} +28 -4
- package/dist/chunk-ALC7RBKC.js +68 -0
- package/dist/chunk-ALC7RBKC.js.map +1 -0
- package/dist/{chunk-JN2QPDB3.js → chunk-HDZGWL6P.js} +36 -3
- package/dist/chunk-HDZGWL6P.js.map +1 -0
- package/dist/{chunk-YGJ23CG3.js → chunk-IAOPNN6V.js} +3 -66
- package/dist/chunk-IAOPNN6V.js.map +1 -0
- package/dist/{chunk-5ZPHZ5ZH.js → chunk-IT5RWB7A.js} +5 -4
- package/dist/chunk-IT5RWB7A.js.map +1 -0
- package/dist/{chunk-FUVHAORT.js → chunk-KRT4NL3H.js} +190 -126
- package/dist/chunk-KRT4NL3H.js.map +1 -0
- package/dist/{chunk-GRJGPHLW.js → chunk-WQRP5IDJ.js} +382 -59
- package/dist/chunk-WQRP5IDJ.js.map +1 -0
- package/dist/chunk-ZQXYVBQI.js +154 -0
- package/dist/chunk-ZQXYVBQI.js.map +1 -0
- package/dist/core.d.ts +5 -4
- 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 +61 -8
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/nodes.d.ts +4 -4
- package/dist/{parseMdl-vfzBGoMr.d.ts → parseMdl-M862hSal.d.ts} +1 -29
- package/dist/react.d.ts +5 -5
- package/dist/react.js +6 -4
- package/dist/react.js.map +1 -1
- package/dist/rendering.d.ts +114 -0
- package/dist/rendering.js +174 -0
- package/dist/rendering.js.map +1 -0
- package/dist/usdGeomCamera-BEsGuz7m.d.ts +53 -0
- package/dist/{buildKinematicTree-Q9JOjAjM.d.ts → usdLux-BqQlSOwG.d.ts} +108 -1
- package/package.json +5 -1
- package/dist/chunk-5ZPHZ5ZH.js.map +0 -1
- package/dist/chunk-FUVHAORT.js.map +0 -1
- package/dist/chunk-GRJGPHLW.js.map +0 -1
- package/dist/chunk-JN2QPDB3.js.map +0 -1
- package/dist/chunk-YGJ23CG3.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { multiply, makeTranslation, makeRotationFromQuat, identity4, invert, makeEuler, DEG2RAD, makeRotationZ, makeRotationY, makeRotationX, fromUsdMatrix, makeScale, RAD2DEG } from './chunk-YGJ23CG3.js';
|
|
2
1
|
import { parseMdl, joinPosix } from './chunk-PPPRB6KE.js';
|
|
3
|
-
import {
|
|
2
|
+
import { computeWorldTransform } from './chunk-ZQXYVBQI.js';
|
|
3
|
+
import { multiply, makeTranslation, makeRotationFromQuat, DEG2RAD, RAD2DEG } from './chunk-IAOPNN6V.js';
|
|
4
|
+
import { AssetPath, Quat, UsdMatrix } from './chunk-JGIVJXBU.js';
|
|
4
5
|
import { unzipSync } from 'fflate';
|
|
5
6
|
|
|
6
7
|
// src/schemas/usdGeom.ts
|
|
@@ -87,6 +88,137 @@ function gatherGprimDescendants(prim) {
|
|
|
87
88
|
return paths;
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
// src/schemas/usdLux.ts
|
|
92
|
+
var LIGHT_KIND_BY_TYPE = /* @__PURE__ */ new Map([
|
|
93
|
+
["DistantLight", "distant"],
|
|
94
|
+
["SphereLight", "sphere"],
|
|
95
|
+
["RectLight", "rect"],
|
|
96
|
+
["DiskLight", "disk"],
|
|
97
|
+
["CylinderLight", "cylinder"],
|
|
98
|
+
["DomeLight", "dome"],
|
|
99
|
+
["DomeLight_1", "dome"]
|
|
100
|
+
]);
|
|
101
|
+
var UNSUPPORTED_LIGHT_TYPES = /* @__PURE__ */ new Set([
|
|
102
|
+
"PortalLight",
|
|
103
|
+
"GeometryLight",
|
|
104
|
+
"PluginLight"
|
|
105
|
+
]);
|
|
106
|
+
function isLight(prim) {
|
|
107
|
+
return LIGHT_KIND_BY_TYPE.has(prim.GetTypeName());
|
|
108
|
+
}
|
|
109
|
+
function isUnsupportedLight(prim) {
|
|
110
|
+
return UNSUPPORTED_LIGHT_TYPES.has(prim.GetTypeName());
|
|
111
|
+
}
|
|
112
|
+
function getLightKind(prim) {
|
|
113
|
+
return LIGHT_KIND_BY_TYPE.get(prim.GetTypeName()) ?? null;
|
|
114
|
+
}
|
|
115
|
+
function readLightDescription(prim) {
|
|
116
|
+
const kind = getLightKind(prim);
|
|
117
|
+
if (!kind) return null;
|
|
118
|
+
const intensity = inputNumber(prim, "intensity") ?? (kind === "distant" ? 5e4 : 1);
|
|
119
|
+
const exposure = inputNumber(prim, "exposure") ?? 0;
|
|
120
|
+
let color = inputVec3(prim, "color") ?? [1, 1, 1];
|
|
121
|
+
if (inputBoolean(prim, "enableColorTemperature") === true) {
|
|
122
|
+
const tint = colorTemperatureToRgb(inputNumber(prim, "colorTemperature") ?? 6500);
|
|
123
|
+
color = [color[0] * tint[0], color[1] * tint[1], color[2] * tint[2]];
|
|
124
|
+
}
|
|
125
|
+
const shadowAuthoredValue = inputBoolean(prim, "shadow:enable");
|
|
126
|
+
const desc = {
|
|
127
|
+
primPath: prim.GetPath(),
|
|
128
|
+
name: prim.GetName(),
|
|
129
|
+
kind,
|
|
130
|
+
color,
|
|
131
|
+
intensity: intensity * 2 ** exposure,
|
|
132
|
+
normalize: inputBoolean(prim, "normalize") ?? false,
|
|
133
|
+
shadowEnabled: shadowAuthoredValue ?? true,
|
|
134
|
+
shadowAuthored: shadowAuthoredValue !== void 0
|
|
135
|
+
};
|
|
136
|
+
const coneAngle = inputNumber(prim, "shaping:cone:angle");
|
|
137
|
+
if (coneAngle !== void 0 && coneAngle < 90) {
|
|
138
|
+
desc.cone = { angleDeg: coneAngle, softness: inputNumber(prim, "shaping:cone:softness") ?? 0 };
|
|
139
|
+
}
|
|
140
|
+
switch (kind) {
|
|
141
|
+
case "distant": {
|
|
142
|
+
const angle = inputNumber(prim, "angle");
|
|
143
|
+
if (angle !== void 0) desc.angle = angle;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
case "sphere": {
|
|
147
|
+
desc.radius = inputNumber(prim, "radius") ?? 0.5;
|
|
148
|
+
const asPoint = inputBoolean(prim, "treatAsPoint");
|
|
149
|
+
if (asPoint !== void 0) desc.treatAsPoint = asPoint;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
case "rect": {
|
|
153
|
+
desc.width = inputNumber(prim, "width") ?? 1;
|
|
154
|
+
desc.height = inputNumber(prim, "height") ?? 1;
|
|
155
|
+
const file = inputAssetPath(prim, "texture:file");
|
|
156
|
+
if (file) desc.textureFile = file;
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
case "disk":
|
|
160
|
+
desc.radius = inputNumber(prim, "radius") ?? 0.5;
|
|
161
|
+
break;
|
|
162
|
+
case "cylinder":
|
|
163
|
+
desc.radius = inputNumber(prim, "radius") ?? 0.5;
|
|
164
|
+
desc.length = inputNumber(prim, "length") ?? 1;
|
|
165
|
+
break;
|
|
166
|
+
case "dome": {
|
|
167
|
+
const file = inputAssetPath(prim, "texture:file");
|
|
168
|
+
if (file) desc.textureFile = file;
|
|
169
|
+
const format = inputString(prim, "texture:format");
|
|
170
|
+
if (format) desc.textureFormat = format;
|
|
171
|
+
const poleAxis = inputString(prim, "poleAxis");
|
|
172
|
+
if (poleAxis) desc.poleAxis = poleAxis;
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return desc;
|
|
177
|
+
}
|
|
178
|
+
function inputValue(prim, name) {
|
|
179
|
+
const namespaced = prim.GetAttribute(`inputs:${name}`).Get();
|
|
180
|
+
if (namespaced !== void 0) return namespaced;
|
|
181
|
+
return prim.GetAttribute(name).Get();
|
|
182
|
+
}
|
|
183
|
+
function inputNumber(prim, name) {
|
|
184
|
+
const v = inputValue(prim, name);
|
|
185
|
+
return typeof v === "number" ? v : void 0;
|
|
186
|
+
}
|
|
187
|
+
function inputBoolean(prim, name) {
|
|
188
|
+
const v = inputValue(prim, name);
|
|
189
|
+
if (typeof v === "boolean") return v;
|
|
190
|
+
if (v === 0 || v === 1) return v === 1;
|
|
191
|
+
return void 0;
|
|
192
|
+
}
|
|
193
|
+
function inputString(prim, name) {
|
|
194
|
+
const v = inputValue(prim, name);
|
|
195
|
+
return typeof v === "string" ? v : void 0;
|
|
196
|
+
}
|
|
197
|
+
function inputVec3(prim, name) {
|
|
198
|
+
const v = inputValue(prim, name);
|
|
199
|
+
if (Array.isArray(v) && v.length === 3 && typeof v[0] === "number" && typeof v[1] === "number" && typeof v[2] === "number") {
|
|
200
|
+
return [v[0], v[1], v[2]];
|
|
201
|
+
}
|
|
202
|
+
return void 0;
|
|
203
|
+
}
|
|
204
|
+
function inputAssetPath(prim, name) {
|
|
205
|
+
const v = inputValue(prim, name);
|
|
206
|
+
return v instanceof AssetPath && v.path ? v.path : void 0;
|
|
207
|
+
}
|
|
208
|
+
function colorTemperatureToRgb(kelvin) {
|
|
209
|
+
const raw = blackbodyRgb(kelvin);
|
|
210
|
+
const white = blackbodyRgb(6500);
|
|
211
|
+
return [raw[0] / white[0], raw[1] / white[1], raw[2] / white[2]];
|
|
212
|
+
}
|
|
213
|
+
function blackbodyRgb(kelvin) {
|
|
214
|
+
const t = Math.min(Math.max(kelvin, 1e3), 4e4) / 100;
|
|
215
|
+
const r = t <= 66 ? 255 : 329.698727446 * (t - 60) ** -0.1332047592;
|
|
216
|
+
const g = t <= 66 ? 99.4708025861 * Math.log(t) - 161.1195681661 : 288.1221695283 * (t - 60) ** -0.0755148492;
|
|
217
|
+
const b = t >= 66 ? 255 : t <= 19 ? 0 : 138.5177312231 * Math.log(t - 10) - 305.0447927307;
|
|
218
|
+
const clamp = (v) => Math.min(Math.max(v, 0), 255) / 255;
|
|
219
|
+
return [clamp(r), clamp(g), clamp(b)];
|
|
220
|
+
}
|
|
221
|
+
|
|
90
222
|
// src/schemas/usdPhysics.ts
|
|
91
223
|
var JOINT_TYPE_BY_SCHEMA = {
|
|
92
224
|
PhysicsFixedJoint: "fixed",
|
|
@@ -156,27 +288,35 @@ function getJointDrive(prim, kind) {
|
|
|
156
288
|
function getJointStatePosition(prim, kind) {
|
|
157
289
|
return readNumber(prim, `state:${kind}:physics:position`);
|
|
158
290
|
}
|
|
159
|
-
function
|
|
291
|
+
function physxMimicDof(type, axis) {
|
|
292
|
+
if (type === "fixed") return void 0;
|
|
293
|
+
return `${type === "prismatic" ? "trans" : "rot"}${axis}`;
|
|
294
|
+
}
|
|
295
|
+
function getJointMimic(prim, dof) {
|
|
160
296
|
if (prim.HasAPI(NEWTON_MIMIC_API)) {
|
|
161
297
|
if (prim.GetAttribute("newton:mimicEnabled").Get() === false) return void 0;
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
298
|
+
const referencePath2 = prim.GetRelationship("newton:mimicJoint").GetTargets()[0];
|
|
299
|
+
if (referencePath2 === void 0) return void 0;
|
|
164
300
|
return {
|
|
165
|
-
referencePath,
|
|
301
|
+
referencePath: referencePath2,
|
|
166
302
|
multiplier: readNumber(prim, "newton:mimicCoef1") ?? 1,
|
|
167
303
|
offset: readNumber(prim, "newton:mimicCoef0") ?? 0
|
|
168
304
|
};
|
|
169
305
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
306
|
+
if (dof === void 0) return void 0;
|
|
307
|
+
const referencePath = prim.GetRelationship(`physxMimicJoint:${dof}:referenceJoint`).GetTargets()[0];
|
|
308
|
+
if (referencePath === void 0) return void 0;
|
|
309
|
+
const gearing = readNumber(prim, `physxMimicJoint:${dof}:gearing`) ?? 1;
|
|
310
|
+
const offset = readNumber(prim, `physxMimicJoint:${dof}:offset`) ?? 0;
|
|
311
|
+
const referenceDof = prim.GetAttribute(`physxMimicJoint:${dof}:referenceJointAxis`).Get();
|
|
312
|
+
return {
|
|
313
|
+
referencePath,
|
|
314
|
+
multiplier: -gearing,
|
|
315
|
+
offset: -offset,
|
|
316
|
+
...typeof referenceDof === "string" ? { referenceDof } : {}
|
|
317
|
+
};
|
|
178
318
|
}
|
|
179
|
-
function
|
|
319
|
+
function getPhysxMimicDofs(prim) {
|
|
180
320
|
const out = /* @__PURE__ */ new Set();
|
|
181
321
|
for (const schema of prim.GetAppliedSchemas()) {
|
|
182
322
|
if (schema.startsWith(`${PHYSX_MIMIC_API}:`)) out.add(schema.slice(PHYSX_MIMIC_API.length + 1));
|
|
@@ -220,103 +360,6 @@ function readQuat(prim, name, def) {
|
|
|
220
360
|
return v instanceof Quat ? v : def;
|
|
221
361
|
}
|
|
222
362
|
|
|
223
|
-
// src/usd/xformOps.ts
|
|
224
|
-
var INVERT_PREFIX = "!invert!";
|
|
225
|
-
var RESET_STACK = "!resetXformStack!";
|
|
226
|
-
var ROTATE_ORDERS = /* @__PURE__ */ new Set([
|
|
227
|
-
"rotateXYZ",
|
|
228
|
-
"rotateXZY",
|
|
229
|
-
"rotateYXZ",
|
|
230
|
-
"rotateYZX",
|
|
231
|
-
"rotateZXY",
|
|
232
|
-
"rotateZYX"
|
|
233
|
-
]);
|
|
234
|
-
function computeWorldTransform(prim) {
|
|
235
|
-
const chain = [];
|
|
236
|
-
for (let p = prim; p && !p.IsPseudoRoot(); p = p.GetParent()) chain.push(p);
|
|
237
|
-
let m = identity4();
|
|
238
|
-
for (let i = chain.length - 1; i >= 0; i--) {
|
|
239
|
-
m = multiply(m, computeLocalTransform(chain[i]).matrix);
|
|
240
|
-
}
|
|
241
|
-
return m;
|
|
242
|
-
}
|
|
243
|
-
function computeLocalTransform(prim) {
|
|
244
|
-
const orderAttr = prim.GetAttribute("xformOpOrder");
|
|
245
|
-
const order = orderAttr.Get();
|
|
246
|
-
if (!Array.isArray(order)) {
|
|
247
|
-
return { matrix: identity4(), resetsXformStack: false };
|
|
248
|
-
}
|
|
249
|
-
let matrix = identity4();
|
|
250
|
-
let resetsXformStack = false;
|
|
251
|
-
for (const entry of order) {
|
|
252
|
-
if (typeof entry !== "string") continue;
|
|
253
|
-
if (entry === RESET_STACK) {
|
|
254
|
-
resetsXformStack = true;
|
|
255
|
-
continue;
|
|
256
|
-
}
|
|
257
|
-
let opName = entry;
|
|
258
|
-
let doInvert = false;
|
|
259
|
-
if (opName.startsWith(INVERT_PREFIX)) {
|
|
260
|
-
doInvert = true;
|
|
261
|
-
opName = opName.slice(INVERT_PREFIX.length);
|
|
262
|
-
}
|
|
263
|
-
const attr = prim.GetAttribute(opName);
|
|
264
|
-
if (!attr.IsValid()) continue;
|
|
265
|
-
const opValue = attr.Get();
|
|
266
|
-
if (opValue === void 0) continue;
|
|
267
|
-
let opMatrix = opMatrixFor(parseOpType(opName), opValue, `${prim.GetPath()}.${opName}`);
|
|
268
|
-
if (doInvert) opMatrix = invert(opMatrix);
|
|
269
|
-
matrix = multiply(matrix, opMatrix);
|
|
270
|
-
}
|
|
271
|
-
return { matrix, resetsXformStack };
|
|
272
|
-
}
|
|
273
|
-
function parseOpType(opName) {
|
|
274
|
-
const body = opName.startsWith("xformOp:") ? opName.slice("xformOp:".length) : opName;
|
|
275
|
-
return body.split(":")[0] ?? body;
|
|
276
|
-
}
|
|
277
|
-
function opMatrixFor(opType, value, where) {
|
|
278
|
-
switch (opType) {
|
|
279
|
-
case "translate":
|
|
280
|
-
return makeTranslation(asVec3(value, where));
|
|
281
|
-
case "scale":
|
|
282
|
-
return makeScale(asVec3(value, where));
|
|
283
|
-
case "orient":
|
|
284
|
-
return makeRotationFromQuat(asQuat(value, where));
|
|
285
|
-
case "transform":
|
|
286
|
-
return fromUsdMatrix(asMatrix(value, where));
|
|
287
|
-
case "rotateX":
|
|
288
|
-
return makeRotationX(asNumber(value, where) * DEG2RAD);
|
|
289
|
-
case "rotateY":
|
|
290
|
-
return makeRotationY(asNumber(value, where) * DEG2RAD);
|
|
291
|
-
case "rotateZ":
|
|
292
|
-
return makeRotationZ(asNumber(value, where) * DEG2RAD);
|
|
293
|
-
default:
|
|
294
|
-
if (ROTATE_ORDERS.has(opType)) {
|
|
295
|
-
const [x, y, z] = asVec3(value, where);
|
|
296
|
-
return makeEuler([x * DEG2RAD, y * DEG2RAD, z * DEG2RAD], opType.slice("rotate".length));
|
|
297
|
-
}
|
|
298
|
-
throw new Error(`${where}: unsupported xformOp type "${opType}"`);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
function asVec3(v, where) {
|
|
302
|
-
if (Array.isArray(v) && v.length === 3 && v.every((n) => typeof n === "number")) {
|
|
303
|
-
return v;
|
|
304
|
-
}
|
|
305
|
-
throw new Error(`${where}: expected a 3-component value`);
|
|
306
|
-
}
|
|
307
|
-
function asNumber(v, where) {
|
|
308
|
-
if (typeof v === "number") return v;
|
|
309
|
-
throw new Error(`${where}: expected a number`);
|
|
310
|
-
}
|
|
311
|
-
function asQuat(v, where) {
|
|
312
|
-
if (v && typeof v === "object" && "real" in v && "imaginary" in v) return v;
|
|
313
|
-
throw new Error(`${where}: expected a quaternion`);
|
|
314
|
-
}
|
|
315
|
-
function asMatrix(v, where) {
|
|
316
|
-
if (v && typeof v === "object" && "values" in v && "dim" in v) return v;
|
|
317
|
-
throw new Error(`${where}: expected a matrix`);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
363
|
// src/robot/buildKinematicTree.ts
|
|
321
364
|
var WORLD = "";
|
|
322
365
|
function buildKinematicTree(robot, options = {}) {
|
|
@@ -578,16 +621,37 @@ function buildJoint(prim, linkKeyByPath, jointKeyByPath, warn) {
|
|
|
578
621
|
});
|
|
579
622
|
joint.valueSamples = { times, values };
|
|
580
623
|
}
|
|
581
|
-
const
|
|
624
|
+
const dof = physxMimicDof(type, joint.axis);
|
|
625
|
+
const mimic = getJointMimic(prim, dof);
|
|
582
626
|
if (mimic) {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
627
|
+
const leaderDof = jointDof(prim, mimic.referencePath);
|
|
628
|
+
if (mimic.referenceDof !== void 0 && leaderDof !== void 0 && mimic.referenceDof !== leaderDof) {
|
|
629
|
+
warn(
|
|
630
|
+
`${path}: mimic reads "${mimic.referencePath}" on \`${mimic.referenceDof}\`, which is not the dof it moves about (\`${leaderDof}\`); ignoring`
|
|
631
|
+
);
|
|
632
|
+
} else {
|
|
633
|
+
joint.mimic = {
|
|
634
|
+
joint: jointKeyByPath.get(mimic.referencePath) ?? mimic.referencePath,
|
|
635
|
+
multiplier: mimic.multiplier,
|
|
636
|
+
offset: jointValueToSI(angular, mimic.offset)
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
} else if (dof !== void 0) {
|
|
640
|
+
const authored = getPhysxMimicDofs(prim).filter((d) => d !== dof);
|
|
641
|
+
if (authored.length > 0) {
|
|
642
|
+
warn(
|
|
643
|
+
`${path}: mimic authored on \`${authored.join("`, `")}\` but the joint moves about \`${dof}\`; ignoring`
|
|
644
|
+
);
|
|
645
|
+
}
|
|
588
646
|
}
|
|
589
647
|
return joint;
|
|
590
648
|
}
|
|
649
|
+
function jointDof(from, path) {
|
|
650
|
+
const prim = from.GetStage().GetPrimAtPath(path);
|
|
651
|
+
if (!prim) return void 0;
|
|
652
|
+
const type = getJointType(prim);
|
|
653
|
+
return type ? physxMimicDof(type, getJointAxis(prim)) : void 0;
|
|
654
|
+
}
|
|
591
655
|
function dropInvalidMimics(joints, warn) {
|
|
592
656
|
for (const [key, joint] of Object.entries(joints)) {
|
|
593
657
|
const mimic = joint.mimic;
|
|
@@ -2885,7 +2949,7 @@ function crateToUsdaFile(crate) {
|
|
|
2885
2949
|
if (spec.specType !== SPEC_PRIM) continue;
|
|
2886
2950
|
const fm = fieldsOf(spec.fieldSetIndex);
|
|
2887
2951
|
primByPath.set(path, {
|
|
2888
|
-
specifier: SPECIFIERS2[
|
|
2952
|
+
specifier: SPECIFIERS2[asNumber(crate, fm.get("specifier")) ?? 0] ?? "def",
|
|
2889
2953
|
typeName: asString(crate, fm.get("typeName")) ?? "",
|
|
2890
2954
|
name: leaf(path),
|
|
2891
2955
|
metadata: buildPrimMetadata(crate, fm),
|
|
@@ -2939,7 +3003,7 @@ function buildAttribute(crate, name, fm) {
|
|
|
2939
3003
|
name,
|
|
2940
3004
|
typeName: isArrayType ? rawType.slice(0, -2) : rawType,
|
|
2941
3005
|
isArray: isArrayType || (defaultRep !== void 0 ? decodeRepBits(defaultRep).isArray : false),
|
|
2942
|
-
variability:
|
|
3006
|
+
variability: asNumber(crate, fm.get("variability")) === 1 ? "uniform" : "varying",
|
|
2943
3007
|
custom: customRep !== void 0 && crate.getValue(customRep) === true,
|
|
2944
3008
|
metadata: {},
|
|
2945
3009
|
line: 0
|
|
@@ -3011,10 +3075,10 @@ function buildLayerMetadata(crate, fm) {
|
|
|
3011
3075
|
if (upAxis !== void 0) meta.upAxis = upAxis;
|
|
3012
3076
|
const defaultPrim2 = asString(crate, fm.get("defaultPrim"));
|
|
3013
3077
|
if (defaultPrim2 !== void 0) meta.defaultPrim = defaultPrim2;
|
|
3014
|
-
const metersPerUnit =
|
|
3078
|
+
const metersPerUnit = asNumber(crate, fm.get("metersPerUnit"));
|
|
3015
3079
|
if (metersPerUnit !== void 0) meta.metersPerUnit = metersPerUnit;
|
|
3016
3080
|
for (const key of ["startTimeCode", "endTimeCode", "timeCodesPerSecond", "framesPerSecond"]) {
|
|
3017
|
-
const value =
|
|
3081
|
+
const value = asNumber(crate, fm.get(key));
|
|
3018
3082
|
if (value !== void 0) meta[key] = value;
|
|
3019
3083
|
}
|
|
3020
3084
|
const customLayerData = fm.has("customLayerData") ? crate.getValue(fm.get("customLayerData")) : void 0;
|
|
@@ -3028,7 +3092,7 @@ function asString(crate, rep) {
|
|
|
3028
3092
|
const v = crate.getValue(rep);
|
|
3029
3093
|
return typeof v === "string" ? v : void 0;
|
|
3030
3094
|
}
|
|
3031
|
-
function
|
|
3095
|
+
function asNumber(crate, rep) {
|
|
3032
3096
|
if (rep === void 0) return void 0;
|
|
3033
3097
|
const v = crate.getValue(rep);
|
|
3034
3098
|
return typeof v === "number" ? v : void 0;
|
|
@@ -3408,6 +3472,6 @@ function openUsdz(bytes) {
|
|
|
3408
3472
|
return { rootEntry, resolver };
|
|
3409
3473
|
}
|
|
3410
3474
|
|
|
3411
|
-
export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, Layer, MASS_API, MESH_COLLISION_API, NEWTON_MIMIC_API, PHYSICS_MATERIAL_API, ParseError, Prim, RIGID_BODY_API, Relationship, Stage, TokenizeError, buildKinematicTree, collectMdlAssetPaths, composeFile, composeLayer,
|
|
3412
|
-
//# sourceMappingURL=chunk-
|
|
3413
|
-
//# sourceMappingURL=chunk-
|
|
3475
|
+
export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, Layer, MASS_API, MESH_COLLISION_API, NEWTON_MIMIC_API, PHYSICS_MATERIAL_API, ParseError, Prim, RIGID_BODY_API, Relationship, Stage, TokenizeError, buildKinematicTree, collectMdlAssetPaths, colorTemperatureToRgb, composeFile, composeLayer, crateToUsdaFile, driveKindFor, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getLightKind, getMassProperties, getMaterialSubsets, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isBasisCurves, isLight, isMesh, isNonVisualPurpose, isPoints, isRenderableGprim, isScope, isSolidGprim, isUnsupportedGprim, isUnsupportedLight, isXform, isZip, iterDescendants, jointValueFromSI, jointValueToSI, loadMdlModules, normalizeJointLimits, openUsdz, parseUsda, readLightDescription, refineJointType, serializeUsda, toBytes, tokenize };
|
|
3476
|
+
//# sourceMappingURL=chunk-KRT4NL3H.js.map
|
|
3477
|
+
//# sourceMappingURL=chunk-KRT4NL3H.js.map
|