three-usd-robot 0.5.0 → 0.7.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/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { p as UsdaFile, h as MetadataMap, o as UsdValue, P as PrimSpec, m as Specifier, k as RelationshipSpec, l as SdfPath, d as AttributeSpec, q as Variability, M as Mat4, R as RobotDescription, J as JointType, A as Axis } from './buildKinematicTree-3oKG00Sc.js';
2
- export { c as AssetPath, B as BuildTreeOptions, C as CompositionArc, D as DEG2RAD, a as JointDescription, e as JointDriveDescription, f as KinematicNode, K as KinematicTree, L as LinkDescription, g as ListOp, i as PropertySpec, Q as Quat, j as RAD2DEG, S as SampleChannel, T as TreeEdge, U as UsdDictionary, n as UsdMatrix, V as Vec2, b as Vec3, r as Vec4, s as buildKinematicTree, t as channelFromSamples, u as fromUsdMatrix, v as getTranslation, w as identity4, x as interpolate, y as invert, z as makeEuler, E as makeRotationFromQuat, F as makeRotationX, G as makeRotationY, H as makeRotationZ, I as makeScale, N as makeTranslation, O as multiply, W as multiplyAll } from './buildKinematicTree-3oKG00Sc.js';
1
+ import { U as UsdaFile, i as MetadataMap, q as UsdValue, P as PrimSpec, l as RelationshipSpec, m as SdfPath, f as AttributeSpec, r as Variability, n as Specifier, b as Vec3, V as Vec2, M as Mat4, L as LinkDescription, R as RobotDescription, J as JointType, A as Axis, d as LinkInertialDescription } from './buildKinematicTree-Ccd2DIKH.js';
2
+ export { e as AssetPath, B as BuildTreeOptions, C as CompositionArc, D as DEG2RAD, a as JointDescription, c as JointDriveDescription, g as KinematicNode, K as KinematicTree, h as ListOp, j as PropertySpec, Q as Quat, k as RAD2DEG, S as SampleChannel, T as TreeEdge, o as UsdDictionary, p as UsdMatrix, s as Vec4, t as buildKinematicTree, u as channelFromSamples, v as decomposeRigid, w as fromUsdMatrix, x as getTranslation, y as identity4, z as interpolate, E as invert, F as makeEuler, G as makeRotationFromQuat, H as makeRotationX, I as makeRotationY, N as makeRotationZ, O as makeScale, W as makeTranslation, X as multiply, Y as multiplyAll, Z as toUsdMatrix } from './buildKinematicTree-Ccd2DIKH.js';
3
3
  import { A as AssetResolver } from './AssetResolver-CpIJNgWZ.js';
4
4
  export { D as DefaultAssetResolver, c as createMemoryResolver, j as joinPosix } from './AssetResolver-CpIJNgWZ.js';
5
5
 
@@ -50,10 +50,32 @@ declare class ParseError extends Error {
50
50
  constructor(message: string, line: number, col: number);
51
51
  }
52
52
 
53
+ /**
54
+ * Serializes a {@link UsdaFile} AST back to USDA text — the write-direction
55
+ * counterpart of `parseUsda` (M12).
56
+ *
57
+ * Formatting follows `usdcat` conventions: 4-space indent, layer metadata in a
58
+ * parenthesized block, one property statement per line, multi-line
59
+ * dictionaries and time-sample blocks.
60
+ *
61
+ * Round-trip guarantee: for any `file` produced by `parseUsda`,
62
+ * `parseUsda(serializeUsda(file))` is structurally equal to `file` (source
63
+ * line numbers aside), and the serializer is idempotent from the first
64
+ * re-parse on. Spellings the parser normalizes away serialize in normalized
65
+ * form: list-op qualifiers on metadata keys are dropped (values emit as
66
+ * explicit lists), dictionary entry types are re-inferred from the value, and
67
+ * path-valued attribute defaults degrade to strings.
68
+ */
69
+
70
+ /** Serialize a parsed (or authored) USDA layer to text. */
71
+ declare function serializeUsda(file: UsdaFile): string;
72
+
53
73
  /** A parsed USDA layer (`SdfLayer`-like, read-only). */
54
74
  declare class Layer {
55
75
  private readonly _file;
56
76
  constructor(_file: UsdaFile);
77
+ /** Serialize this layer back to USDA text (`SdfLayer::ExportToString`-like). */
78
+ ExportToString(): string;
57
79
  GetVersion(): string;
58
80
  GetPseudoRootMetadata(): MetadataMap;
59
81
  GetMetadata(key: string): UsdValue | undefined;
@@ -61,43 +83,54 @@ declare class Layer {
61
83
  GetRootPrimSpecs(): PrimSpec[];
62
84
  }
63
85
 
64
- /** OpenUSD's fallback stage linear unit when `metersPerUnit` is unauthored. */
65
- declare const DEFAULT_METERS_PER_UNIT = 0.01;
66
- type UpAxis = "Y" | "Z";
67
86
  /**
68
- * A composed USD stage (`UsdStage`-like) backed by a single in-memory USDA
69
- * layer. Multi-layer composition (sublayers / references / payloads) arrives in
70
- * M8; for now a stage wraps exactly one parsed layer.
87
+ * A typed attribute on a prim (`UsdAttribute`-like).
88
+ *
89
+ * Mirrors the pxr USD API: `GetAttribute` always returns an `Attribute` object;
90
+ * call {@link Attribute.IsValid} to check whether the attribute is actually
91
+ * authored on the prim.
71
92
  */
72
- declare class Stage {
73
- private readonly _layer;
74
- private readonly _byPath;
75
- private readonly _pseudoRoot;
76
- private constructor();
77
- /** Parse and open a stage from USDA source text. */
78
- static OpenFromString(usda: string): Stage;
79
- /** Open a stage from an already-parsed layer. */
80
- static OpenFromFile(file: UsdaFile): Stage;
81
- private buildPrim;
82
- GetRootLayer(): Layer;
83
- GetPseudoRoot(): Prim;
84
- /** Returns the prim at the absolute path, or `null` if none exists. */
85
- GetPrimAtPath(path: string): Prim | null;
86
- /** The stage's default prim (from layer `defaultPrim` metadata), if any. */
87
- GetDefaultPrim(): Prim | null;
88
- /** Depth-first traversal of all prims (excludes the pseudo-root). */
89
- Traverse(): Prim[];
90
- GetMetadata(key: string): UsdValue | undefined;
91
- /** Stage up axis (`upAxis` metadata); defaults to `"Y"` per OpenUSD. */
92
- GetUpAxis(): UpAxis;
93
- /** Stage linear unit (`metersPerUnit` metadata); defaults to {@link DEFAULT_METERS_PER_UNIT}. */
94
- GetMetersPerUnit(): number;
95
- /** Animation start time code, if authored. */
96
- GetStartTimeCode(): number | undefined;
97
- /** Animation end time code, if authored. */
98
- GetEndTimeCode(): number | undefined;
99
- /** Time codes per second for playback; defaults to 24. */
100
- GetTimeCodesPerSecond(): number;
93
+ declare class Attribute {
94
+ private readonly _prim;
95
+ private readonly _name;
96
+ private readonly _spec;
97
+ constructor(_prim: Prim, _name: string, _spec: AttributeSpec | null);
98
+ IsValid(): boolean;
99
+ GetPrim(): Prim;
100
+ GetName(): string;
101
+ GetBaseName(): string;
102
+ GetNamespace(): string;
103
+ /** Scalar type name (without the `[]` suffix); pair with {@link IsArray}. */
104
+ GetTypeName(): string;
105
+ IsArray(): boolean;
106
+ GetVariability(): Variability;
107
+ IsCustom(): boolean;
108
+ /** True if a default value or any time sample is authored. */
109
+ HasValue(): boolean;
110
+ HasAuthoredValue(): boolean;
111
+ /**
112
+ * Resolve the attribute value. With no `time`, returns the default value (or
113
+ * the earliest time sample if only samples are authored). With a `time`,
114
+ * returns the exact sample if present, else the default, else the earliest
115
+ * sample. Returns `undefined` when nothing is authored.
116
+ */
117
+ Get(time?: number): UsdValue | undefined;
118
+ GetTimeSamples(): Map<number, UsdValue>;
119
+ GetConnections(): SdfPath[];
120
+ }
121
+ /** A relationship on a prim (`UsdRelationship`-like). */
122
+ declare class Relationship {
123
+ private readonly _prim;
124
+ private readonly _name;
125
+ private readonly _spec;
126
+ constructor(_prim: Prim, _name: string, _spec: RelationshipSpec | null);
127
+ IsValid(): boolean;
128
+ GetPrim(): Prim;
129
+ GetName(): string;
130
+ GetBaseName(): string;
131
+ GetNamespace(): string;
132
+ IsCustom(): boolean;
133
+ GetTargets(): SdfPath[];
101
134
  }
102
135
 
103
136
  /**
@@ -149,56 +182,199 @@ declare class Prim {
149
182
  HasAPI(schemaName: string): boolean;
150
183
  }
151
184
 
185
+ /** OpenUSD's fallback stage linear unit when `metersPerUnit` is unauthored. */
186
+ declare const DEFAULT_METERS_PER_UNIT = 0.01;
187
+ type UpAxis = "Y" | "Z";
152
188
  /**
153
- * A typed attribute on a prim (`UsdAttribute`-like).
154
- *
155
- * Mirrors the pxr USD API: `GetAttribute` always returns an `Attribute` object;
156
- * call {@link Attribute.IsValid} to check whether the attribute is actually
157
- * authored on the prim.
189
+ * A composed USD stage (`UsdStage`-like) backed by a single in-memory USDA
190
+ * layer. Multi-layer composition (sublayers / references / payloads) arrives in
191
+ * M8; for now a stage wraps exactly one parsed layer.
158
192
  */
159
- declare class Attribute {
160
- private readonly _prim;
161
- private readonly _name;
162
- private readonly _spec;
163
- constructor(_prim: Prim, _name: string, _spec: AttributeSpec | null);
164
- IsValid(): boolean;
165
- GetPrim(): Prim;
166
- GetName(): string;
167
- GetBaseName(): string;
168
- GetNamespace(): string;
169
- /** Scalar type name (without the `[]` suffix); pair with {@link IsArray}. */
170
- GetTypeName(): string;
171
- IsArray(): boolean;
172
- GetVariability(): Variability;
173
- IsCustom(): boolean;
174
- /** True if a default value or any time sample is authored. */
175
- HasValue(): boolean;
176
- HasAuthoredValue(): boolean;
193
+ declare class Stage {
194
+ private readonly _layer;
195
+ private readonly _byPath;
196
+ private readonly _pseudoRoot;
197
+ private constructor();
198
+ /** Parse and open a stage from USDA source text. */
199
+ static OpenFromString(usda: string): Stage;
200
+ /** Open a stage from an already-parsed layer. */
201
+ static OpenFromFile(file: UsdaFile): Stage;
202
+ private buildPrim;
203
+ GetRootLayer(): Layer;
177
204
  /**
178
- * Resolve the attribute value. With no `time`, returns the default value (or
179
- * the earliest time sample if only samples are authored). With a `time`,
180
- * returns the exact sample if present, else the default, else the earliest
181
- * sample. Returns `undefined` when nothing is authored.
205
+ * Serialize the stage's backing layer to USDA text. Loader-built stages wrap
206
+ * the fully composed layer, so this is a flattened (`usdcat --flatten`-like)
207
+ * export of everything that was read including binary-crate sources.
182
208
  */
183
- Get(time?: number): UsdValue | undefined;
184
- GetTimeSamples(): Map<number, UsdValue>;
185
- GetConnections(): SdfPath[];
186
- }
187
- /** A relationship on a prim (`UsdRelationship`-like). */
188
- declare class Relationship {
189
- private readonly _prim;
190
- private readonly _name;
191
- private readonly _spec;
192
- constructor(_prim: Prim, _name: string, _spec: RelationshipSpec | null);
193
- IsValid(): boolean;
194
- GetPrim(): Prim;
195
- GetName(): string;
196
- GetBaseName(): string;
197
- GetNamespace(): string;
198
- IsCustom(): boolean;
199
- GetTargets(): SdfPath[];
209
+ ExportToString(): string;
210
+ GetPseudoRoot(): Prim;
211
+ /** Returns the prim at the absolute path, or `null` if none exists. */
212
+ GetPrimAtPath(path: string): Prim | null;
213
+ /** The stage's default prim (from layer `defaultPrim` metadata), if any. */
214
+ GetDefaultPrim(): Prim | null;
215
+ /** Depth-first traversal of all prims (excludes the pseudo-root). */
216
+ Traverse(): Prim[];
217
+ GetMetadata(key: string): UsdValue | undefined;
218
+ /** Stage up axis (`upAxis` metadata); defaults to `"Y"` per OpenUSD. */
219
+ GetUpAxis(): UpAxis;
220
+ /** Stage linear unit (`metersPerUnit` metadata); defaults to {@link DEFAULT_METERS_PER_UNIT}. */
221
+ GetMetersPerUnit(): number;
222
+ /** Animation start time code, if authored. */
223
+ GetStartTimeCode(): number | undefined;
224
+ /** Animation end time code, if authored. */
225
+ GetEndTimeCode(): number | undefined;
226
+ /** Time codes per second for playback; defaults to 24. */
227
+ GetTimeCodesPerSecond(): number;
200
228
  }
201
229
 
230
+ /**
231
+ * Geometry access for the robot exporter (M13).
232
+ *
233
+ * `exportRobotUsda` is geometry-agnostic: a {@link RobotGeometryProvider}
234
+ * supplies each link's meshes as plain data. {@link stageGeometryProvider}
235
+ * reads them back off a loaded {@link Stage} for round-trip export; the
236
+ * Three.js authoring side (M14) supplies one backed by `BufferGeometry`.
237
+ */
238
+
239
+ /** Texture channels a `UsdPreviewSurface` network can reference (M15). */
240
+ type TextureChannel = "color" | "opacity" | "normal" | "roughness" | "metalness" | "occlusion" | "emissive";
241
+ /**
242
+ * PBR parameters for a mesh, written as a `UsdPreviewSurface` material (M14).
243
+ * `textures` holds per-channel image **asset paths** (M15) — emitted as a
244
+ * `UsdUVTexture` + `UsdPrimvarReader_float2` network; sampler details
245
+ * (wrap/scale/bias/transform) are not carried. Bundle the image bytes
246
+ * themselves with `writeUsdz` under the same paths.
247
+ */
248
+ type ExportMaterial = {
249
+ /** Material identity: meshes sharing a name share one Material prim. */
250
+ name: string;
251
+ diffuseColor?: Vec3;
252
+ metallic?: number;
253
+ roughness?: number;
254
+ /** Sub-unit opacity renders as a translucent blend. */
255
+ opacity?: number;
256
+ emissiveColor?: Vec3;
257
+ /** Per-channel texture asset paths. */
258
+ textures?: Partial<Record<TextureChannel, string>>;
259
+ };
260
+ /** `UsdPhysicsMaterialAPI` parameters, bound via `material:binding:physics` (M16). */
261
+ type ExportPhysicsMaterial = {
262
+ /** Identity: meshes sharing a name share one physics-material prim. */
263
+ name: string;
264
+ staticFriction?: number;
265
+ dynamicFriction?: number;
266
+ restitution?: number;
267
+ density?: number;
268
+ };
269
+ /** `physics:approximation` tokens of `UsdPhysicsMeshCollisionAPI`. */
270
+ type CollisionApproximation = "none" | "convexHull" | "convexDecomposition" | "boundingSphere" | "boundingCube" | "meshSimplification";
271
+ /** One mesh of a link, as plain exportable data (stage units, link-relative). */
272
+ type ExportMesh = {
273
+ /** Prim-name hint; the exporter sanitizes and uniquifies it. */
274
+ name: string;
275
+ kind: "visual" | "collision";
276
+ points: Vec3[];
277
+ /** Authored polygon topology (not re-triangulated). */
278
+ faceVertexCounts: number[];
279
+ faceVertexIndices: number[];
280
+ /** Per-vertex normals (only written when one per point). */
281
+ normals?: Vec3[];
282
+ /** `primvars:st` UVs, vertex interpolation (one per point). */
283
+ st?: Vec2[];
284
+ displayColor?: Vec3;
285
+ doubleSided?: boolean;
286
+ /** Transform relative to the link frame (column-major); identity when omitted. */
287
+ transform?: Mat4;
288
+ /** Bound material constants, if any. */
289
+ material?: ExportMaterial;
290
+ /** Collision approximation token (collision meshes only, M16). */
291
+ collisionApproximation?: CollisionApproximation;
292
+ /** Bound physics material (collision meshes only, M16). */
293
+ physicsMaterial?: ExportPhysicsMaterial;
294
+ };
295
+ /** Supplies the meshes of a link for export. */
296
+ type RobotGeometryProvider = (linkKey: string, link: LinkDescription) => ExportMesh[];
297
+ /** Provider that reads each link's visual/collision Mesh prims from a stage. */
298
+ declare function stageGeometryProvider(stage: Stage): RobotGeometryProvider;
299
+
300
+ /**
301
+ * Robot IR → USDA layer (M13).
302
+ *
303
+ * Builds a self-contained UsdPhysics robot layer from a {@link RobotDescription}:
304
+ * one `Xform` prim per link placed at its **zero-pose** world transform
305
+ * (folding joint frames root-down, `T_child = T_parent · frame0 · frame1⁻¹` —
306
+ * see docs/export-design.md §4), one `Physics*Joint` prim per joint, and the
307
+ * link meshes supplied by a {@link RobotGeometryProvider}. Initial joint values
308
+ * author as `PhysicsJointStateAPI` opinions rather than being baked into link
309
+ * transforms, so a re-import applies them exactly once. Values convert back
310
+ * from SI to authored units (angular radians → degrees).
311
+ */
312
+
313
+ type ExportRobotOptions = {
314
+ /** Supplies each link's meshes; omit for a kinematics-only layer. */
315
+ geometry?: RobotGeometryProvider;
316
+ /** Root prim name; defaults to the (sanitized) robot name. */
317
+ robotName?: string;
318
+ /**
319
+ * Author `physxArticulation:enabledSelfCollisions` on the articulation root
320
+ * (M16). `false` is the common Isaac stabilizer for adjacent-link contact.
321
+ */
322
+ enabledSelfCollisions?: boolean;
323
+ /**
324
+ * Apply the Isaac Sim Robot Schema (M16): `IsaacRobotAPI` on the root with
325
+ * ordered `isaac:physics:robotLinks` / `robotJoints` relationships,
326
+ * `IsaacLinkAPI` per link, and `IsaacJointAPI` (+ DOF order) per joint.
327
+ */
328
+ isaacRobotSchema?: boolean;
329
+ /** Receives non-fatal export diagnostics. */
330
+ onWarn?: (message: string) => void;
331
+ };
332
+ /** Serialize a robot IR into a single-layer USDA AST (pass to `serializeUsda`). */
333
+ declare function exportRobotUsda(desc: RobotDescription, options?: ExportRobotOptions): UsdaFile;
334
+
335
+ /**
336
+ * USDZ package writer (M15) — the write-direction counterpart of `openUsdz`.
337
+ *
338
+ * A `.usdz` is a **stored** (uncompressed) zip whose entries' file data must
339
+ * start on 64-byte boundaries; alignment is achieved with padding placed in a
340
+ * local-header extra field (the fflate-sanctioned trick, as used by Three.js's
341
+ * USDZExporter). The first entry is the package's root USD layer — `openUsdz`
342
+ * and other USDZ readers open that one.
343
+ */
344
+ /**
345
+ * Pack entries into USDZ bytes. `entries` maps archive paths to file contents
346
+ * (strings are UTF-8 encoded — pass the `serializeUsda` output directly). One
347
+ * entry must be a USD layer (`.usda`/`.usdc`/`.usd`); the first such entry
348
+ * becomes the package root and is moved to the front of the archive.
349
+ */
350
+ declare function writeUsdz(entries: Record<string, Uint8Array | string>): Uint8Array;
351
+
352
+ /**
353
+ * Simulation-readiness checks for a {@link RobotDescription} (M16).
354
+ *
355
+ * Validates what Isaac Sim's Asset Validator cares about that is visible from
356
+ * the IR (plus, optionally, the export geometry): graph connectivity, limit
357
+ * sanity, mass properties, and collision setup. `error` issues break
358
+ * simulation; `warning` issues are quality gaps a physics engine tolerates
359
+ * but misbehaves on.
360
+ */
361
+
362
+ type ValidationSeverity = "error" | "warning";
363
+ type ValidationIssue = {
364
+ severity: ValidationSeverity;
365
+ /** Stable machine-readable code (e.g. `unknown-link`, `no-collision`). */
366
+ code: string;
367
+ message: string;
368
+ /** Link or joint key the issue refers to, when applicable. */
369
+ subject?: string;
370
+ };
371
+ type ValidateRobotOptions = {
372
+ /** Enables mesh-level checks (collision presence / approximation). */
373
+ geometry?: RobotGeometryProvider;
374
+ };
375
+ /** Check a robot IR for simulation-readiness; returns errors first. */
376
+ declare function validateRobotDescription(desc: RobotDescription, options?: ValidateRobotOptions): ValidationIssue[];
377
+
202
378
  /**
203
379
  * Minimal USD composition: flattens references, payloads, sublayers, variant
204
380
  * selections, and internal (intra-layer) reference/inherit arcs into a single
@@ -217,10 +393,47 @@ type ComposeOptions = {
217
393
  /** Guard against pathological recursion (default 64). */
218
394
  maxDepth?: number;
219
395
  };
396
+ /**
397
+ * Composed external layers, keyed by resolved URL, shared across one
398
+ * composition run. Real assets reference the same mesh layer from dozens of
399
+ * prims; without this each one would refetch and recompose it.
400
+ */
401
+ type LayerCache = Map<string, Promise<UsdaFile | null>>;
220
402
  /** Parse USDA text and fully compose it. */
221
- declare function composeLayer(text: string, baseUrl: string, resolver: AssetResolver, options?: ComposeOptions, stack?: ReadonlySet<string>): Promise<UsdaFile>;
403
+ declare function composeLayer(text: string, baseUrl: string, resolver: AssetResolver, options?: ComposeOptions, stack?: ReadonlySet<string>, cache?: LayerCache): Promise<UsdaFile>;
222
404
  /** Compose an already-parsed layer (used by the binary-crate path too). */
223
- declare function composeFile(file: UsdaFile, baseUrl: string, resolver: AssetResolver, options?: ComposeOptions, stack?: ReadonlySet<string>): Promise<UsdaFile>;
405
+ declare function composeFile(file: UsdaFile, baseUrl: string, resolver: AssetResolver, options?: ComposeOptions, stack?: ReadonlySet<string>, cache?: LayerCache): Promise<UsdaFile>;
406
+
407
+ /**
408
+ * Resolves a prim's `xformOpOrder` into a single local transform matrix.
409
+ *
410
+ * Supports `translate`, `scale`, `orient` (quat), `transform` (matrix4d),
411
+ * single-axis `rotateX|Y|Z`, and the six `rotate<ORDER>` Euler ops, plus the
412
+ * `!invert!` op prefix and the `!resetXformStack!` sentinel. Rotation op values
413
+ * are in degrees and converted to radians here.
414
+ */
415
+
416
+ type ResolvedXform = {
417
+ /** Local-to-parent transform (column-major {@link Mat4}). */
418
+ matrix: Mat4;
419
+ /**
420
+ * True if `xformOpOrder` began with `!resetXformStack!`, meaning this prim
421
+ * does not inherit its parent's transform. Honored by FK in M5.
422
+ */
423
+ resetsXformStack: boolean;
424
+ };
425
+ /**
426
+ * Compute a prim's local transform from its `xformOpOrder`. Returns identity
427
+ * when the prim authors no `xformOpOrder`.
428
+ */
429
+ /**
430
+ * Accumulated transform from the stage root down to `prim` — the prim's world
431
+ * placement as authored (`UsdGeomXformCache::GetLocalToWorldTransform`-like).
432
+ */
433
+ declare function computeWorldTransform(prim: Prim): Mat4;
434
+ declare function computeLocalTransform(prim: Prim): ResolvedXform;
435
+ /** Extract the op type token from an op attribute name (`xformOp:translate:pivot` → `translate`). */
436
+ declare function parseOpType(opName: string): string;
224
437
 
225
438
  /**
226
439
  * USDZ (zipped USD package) support.
@@ -314,6 +527,12 @@ declare class CrateReader {
314
527
  private readFloat32s;
315
528
  private readFloat64s;
316
529
  private readVec3fArray;
530
+ /**
531
+ * Read an `SdfVariantSelectionMap`: `[u64 count]` then `count` pairs of
532
+ * string indexes (`variantSetName → variantName`). Surfaces as a dictionary
533
+ * so it maps straight onto the USDA `variants = { ... }` metadatum.
534
+ */
535
+ private readVariantSelectionMap;
317
536
  /** Read a `[u64 count][count × uint32|int32 index]` vector → resolved strings. */
318
537
  private readIndexVector;
319
538
  /** Read an SdfListOp; returns the effective (explicit ∪ prepended ∪ added ∪ appended) items. */
@@ -334,32 +553,6 @@ declare class CrateReader {
334
553
 
335
554
  declare function crateToUsdaFile(crate: CrateReader): UsdaFile;
336
555
 
337
- /**
338
- * Resolves a prim's `xformOpOrder` into a single local transform matrix.
339
- *
340
- * Supports `translate`, `scale`, `orient` (quat), `transform` (matrix4d),
341
- * single-axis `rotateX|Y|Z`, and the six `rotate<ORDER>` Euler ops, plus the
342
- * `!invert!` op prefix and the `!resetXformStack!` sentinel. Rotation op values
343
- * are in degrees and converted to radians here.
344
- */
345
-
346
- type ResolvedXform = {
347
- /** Local-to-parent transform (column-major {@link Mat4}). */
348
- matrix: Mat4;
349
- /**
350
- * True if `xformOpOrder` began with `!resetXformStack!`, meaning this prim
351
- * does not inherit its parent's transform. Honored by FK in M5.
352
- */
353
- resetsXformStack: boolean;
354
- };
355
- /**
356
- * Compute a prim's local transform from its `xformOpOrder`. Returns identity
357
- * when the prim authors no `xformOpOrder`.
358
- */
359
- declare function computeLocalTransform(prim: Prim): ResolvedXform;
360
- /** Extract the op type token from an op attribute name (`xformOp:translate:pivot` → `translate`). */
361
- declare function parseOpType(opName: string): string;
362
-
363
556
  /**
364
557
  * Extracts a {@link RobotDescription} from a USD {@link Stage}.
365
558
  *
@@ -391,6 +584,8 @@ declare function normalizeJointLimits(type: JointType, rawLower: number | undefi
391
584
  };
392
585
  /** Convert an authored joint value to SI (angular degrees → radians). */
393
586
  declare function jointValueToSI(angular: boolean, raw: number): number;
587
+ /** Convert an SI joint value back to authored units (angular radians → degrees, M13 export). */
588
+ declare function jointValueFromSI(angular: boolean, si: number): number;
394
589
  /**
395
590
  * A revolute joint with no finite limits is a continuous (unbounded) joint.
396
591
  * Returns the refined joint type.
@@ -418,6 +613,9 @@ declare function gatherMeshDescendants(prim: Prim): string[];
418
613
  declare const ARTICULATION_ROOT_API = "PhysicsArticulationRootAPI";
419
614
  declare const RIGID_BODY_API = "PhysicsRigidBodyAPI";
420
615
  declare const COLLISION_API = "PhysicsCollisionAPI";
616
+ declare const MASS_API = "PhysicsMassAPI";
617
+ declare const MESH_COLLISION_API = "PhysicsMeshCollisionAPI";
618
+ declare const PHYSICS_MATERIAL_API = "PhysicsMaterialAPI";
421
619
  /** Base joint type from the prim's schema type, or `null` if not a joint. */
422
620
  declare function getJointType(prim: Prim): JointType | null;
423
621
  /** Resolve `physics:body0` / `physics:body1` target paths (first target each). */
@@ -451,5 +649,7 @@ declare function getJointDrive(prim: Prim, kind: "angular" | "linear"): {
451
649
  };
452
650
  /** Read `PhysicsJointStateAPI` position for the given instance, as authored. */
453
651
  declare function getJointStatePosition(prim: Prim, kind: "angular" | "linear"): number | undefined;
652
+ /** Read `UsdPhysicsMassAPI` properties, or `undefined` when none are authored (M16). */
653
+ declare function getMassProperties(prim: Prim): LinkInertialDescription | undefined;
454
654
 
455
- export { ARTICULATION_ROOT_API, AssetResolver, Attribute, AttributeSpec, Axis, COLLISION_API, type ComposeOptions, CrateReader, DEFAULT_METERS_PER_UNIT, type ExtractOptions, JointType, Layer, Mat4, MetadataMap, PACKAGE_NAME, ParseError, Prim, PrimSpec, RIGID_BODY_API, Relationship, RelationshipSpec, type ResolvedXform, RobotDescription, SdfPath, Specifier, Stage, TokenizeError, type UpAxis, UsdValue, UsdaFile, type UsdzPackage, VERSION, Variability, composeFile, composeLayer, computeLocalTransform, crateToUsdaFile, driveKindFor, extractRobotDescription, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isMesh, isScope, isXform, iterDescendants, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, tokenize };
655
+ export { ARTICULATION_ROOT_API, AssetResolver, Attribute, AttributeSpec, Axis, COLLISION_API, type CollisionApproximation, type ComposeOptions, CrateReader, DEFAULT_METERS_PER_UNIT, type ExportMaterial, type ExportMesh, type ExportPhysicsMaterial, type ExportRobotOptions, type ExtractOptions, JointType, Layer, LinkDescription, LinkInertialDescription, MASS_API, MESH_COLLISION_API, Mat4, MetadataMap, PACKAGE_NAME, PHYSICS_MATERIAL_API, ParseError, Prim, PrimSpec, RIGID_BODY_API, Relationship, RelationshipSpec, type ResolvedXform, RobotDescription, type RobotGeometryProvider, SdfPath, Specifier, Stage, type TextureChannel, TokenizeError, type UpAxis, UsdValue, UsdaFile, type UsdzPackage, VERSION, type ValidateRobotOptions, type ValidationIssue, type ValidationSeverity, Variability, Vec2, Vec3, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, driveKindFor, exportRobotUsda, extractRobotDescription, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isMesh, isScope, isXform, iterDescendants, jointValueFromSI, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, serializeUsda, stageGeometryProvider, tokenize, validateRobotDescription, writeUsdz };
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
- export { PACKAGE_NAME, VERSION } from './chunk-OFUMT72H.js';
2
- export { ARTICULATION_ROOT_API, AssetPath, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, DEG2RAD, DefaultAssetResolver, Layer, ParseError, Prim, Quat, RAD2DEG, RIGID_BODY_API, Relationship, Stage, TokenizeError, UsdMatrix, buildKinematicTree, channelFromSamples, composeFile, composeLayer, computeLocalTransform, crateToUsdaFile, createMemoryResolver, driveKindFor, extractRobotDescription, fromUsdMatrix, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getTranslation, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, identity4, interpolate, invert, isMesh, isScope, isXform, iterDescendants, joinPosix, jointValueToSI, makeEuler, makeRotationFromQuat, makeRotationX, makeRotationY, makeRotationZ, makeScale, makeTranslation, multiply, multiplyAll, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, tokenize } from './chunk-36T6YOEX.js';
1
+ export { PACKAGE_NAME, VERSION, exportRobotUsda, stageGeometryProvider, validateRobotDescription, writeUsdz } from './chunk-O7XP5FQ4.js';
2
+ export { ARTICULATION_ROOT_API, AssetPath, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, DEG2RAD, DefaultAssetResolver, Layer, MASS_API, MESH_COLLISION_API, PHYSICS_MATERIAL_API, ParseError, Prim, Quat, RAD2DEG, RIGID_BODY_API, Relationship, Stage, TokenizeError, UsdMatrix, buildKinematicTree, channelFromSamples, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, createMemoryResolver, decomposeRigid, driveKindFor, extractRobotDescription, fromUsdMatrix, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, getTranslation, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, identity4, interpolate, invert, isMesh, isScope, isXform, iterDescendants, joinPosix, jointValueFromSI, jointValueToSI, makeEuler, makeRotationFromQuat, makeRotationX, makeRotationY, makeRotationZ, makeScale, makeTranslation, multiply, multiplyAll, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, serializeUsda, toUsdMatrix, tokenize } from './chunk-4GPCBXUS.js';
3
3
  //# sourceMappingURL=core.js.map
4
4
  //# sourceMappingURL=core.js.map
package/dist/extras.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { T as ThreeUsdRobot } from './ThreeUsdRobot-D9AOUaVh.js';
1
+ import { T as ThreeUsdRobot } from './ThreeUsdRobot-Ljh4PDVD.js';
2
2
  import 'three';
3
- import './buildKinematicTree-3oKG00Sc.js';
3
+ import './buildKinematicTree-Ccd2DIKH.js';
4
4
 
5
5
  /**
6
6
  * `three-usd-robot/extras`
package/dist/helpers.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as THREE from 'three';
2
- import { J as JointObject, T as ThreeUsdRobot } from './ThreeUsdRobot-D9AOUaVh.js';
3
- import './buildKinematicTree-3oKG00Sc.js';
2
+ import { J as JointObject, T as ThreeUsdRobot } from './ThreeUsdRobot-Ljh4PDVD.js';
3
+ import './buildKinematicTree-Ccd2DIKH.js';
4
4
 
5
5
  /**
6
6
  * An arrow drawn along a joint's motion axis (the rotation axis for