three-usd-robot 0.4.0 → 0.6.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,7 @@
1
- import { o as UsdaFile, g as MetadataMap, n as UsdValue, P as PrimSpec, l as Specifier, j as RelationshipSpec, k as SdfPath, c as AttributeSpec, p as Variability, M as Mat4, R as RobotDescription, J as JointType, A as Axis } from './buildKinematicTree-CZjBMA1I.js';
2
- export { b as AssetPath, B as BuildTreeOptions, C as CompositionArc, D as DEG2RAD, a as JointDescription, d as JointDriveDescription, e as KinematicNode, K as KinematicTree, L as LinkDescription, f as ListOp, h as PropertySpec, Q as Quat, i as RAD2DEG, S as SampleChannel, T as TreeEdge, U as UsdDictionary, m as UsdMatrix, q as Vec2, V 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-CZjBMA1I.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-wtZPzy0B.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-wtZPzy0B.js';
3
+ import { A as AssetResolver } from './AssetResolver-CpIJNgWZ.js';
4
+ export { D as DefaultAssetResolver, c as createMemoryResolver, j as joinPosix } from './AssetResolver-CpIJNgWZ.js';
3
5
 
4
6
  /** Package identity. Kept in one place so every entry point can re-export it. */
5
7
  declare const PACKAGE_NAME = "three-usd-robot";
@@ -48,10 +50,32 @@ declare class ParseError extends Error {
48
50
  constructor(message: string, line: number, col: number);
49
51
  }
50
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
+
51
73
  /** A parsed USDA layer (`SdfLayer`-like, read-only). */
52
74
  declare class Layer {
53
75
  private readonly _file;
54
76
  constructor(_file: UsdaFile);
77
+ /** Serialize this layer back to USDA text (`SdfLayer::ExportToString`-like). */
78
+ ExportToString(): string;
55
79
  GetVersion(): string;
56
80
  GetPseudoRootMetadata(): MetadataMap;
57
81
  GetMetadata(key: string): UsdValue | undefined;
@@ -59,43 +83,54 @@ declare class Layer {
59
83
  GetRootPrimSpecs(): PrimSpec[];
60
84
  }
61
85
 
62
- /** OpenUSD's fallback stage linear unit when `metersPerUnit` is unauthored. */
63
- declare const DEFAULT_METERS_PER_UNIT = 0.01;
64
- type UpAxis = "Y" | "Z";
65
86
  /**
66
- * A composed USD stage (`UsdStage`-like) backed by a single in-memory USDA
67
- * layer. Multi-layer composition (sublayers / references / payloads) arrives in
68
- * 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.
69
92
  */
70
- declare class Stage {
71
- private readonly _layer;
72
- private readonly _byPath;
73
- private readonly _pseudoRoot;
74
- private constructor();
75
- /** Parse and open a stage from USDA source text. */
76
- static OpenFromString(usda: string): Stage;
77
- /** Open a stage from an already-parsed layer. */
78
- static OpenFromFile(file: UsdaFile): Stage;
79
- private buildPrim;
80
- GetRootLayer(): Layer;
81
- GetPseudoRoot(): Prim;
82
- /** Returns the prim at the absolute path, or `null` if none exists. */
83
- GetPrimAtPath(path: string): Prim | null;
84
- /** The stage's default prim (from layer `defaultPrim` metadata), if any. */
85
- GetDefaultPrim(): Prim | null;
86
- /** Depth-first traversal of all prims (excludes the pseudo-root). */
87
- Traverse(): Prim[];
88
- GetMetadata(key: string): UsdValue | undefined;
89
- /** Stage up axis (`upAxis` metadata); defaults to `"Y"` per OpenUSD. */
90
- GetUpAxis(): UpAxis;
91
- /** Stage linear unit (`metersPerUnit` metadata); defaults to {@link DEFAULT_METERS_PER_UNIT}. */
92
- GetMetersPerUnit(): number;
93
- /** Animation start time code, if authored. */
94
- GetStartTimeCode(): number | undefined;
95
- /** Animation end time code, if authored. */
96
- GetEndTimeCode(): number | undefined;
97
- /** Time codes per second for playback; defaults to 24. */
98
- 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[];
99
134
  }
100
135
 
101
136
  /**
@@ -147,83 +182,198 @@ declare class Prim {
147
182
  HasAPI(schemaName: string): boolean;
148
183
  }
149
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";
150
188
  /**
151
- * A typed attribute on a prim (`UsdAttribute`-like).
152
- *
153
- * Mirrors the pxr USD API: `GetAttribute` always returns an `Attribute` object;
154
- * call {@link Attribute.IsValid} to check whether the attribute is actually
155
- * 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.
156
192
  */
157
- declare class Attribute {
158
- private readonly _prim;
159
- private readonly _name;
160
- private readonly _spec;
161
- constructor(_prim: Prim, _name: string, _spec: AttributeSpec | null);
162
- IsValid(): boolean;
163
- GetPrim(): Prim;
164
- GetName(): string;
165
- GetBaseName(): string;
166
- GetNamespace(): string;
167
- /** Scalar type name (without the `[]` suffix); pair with {@link IsArray}. */
168
- GetTypeName(): string;
169
- IsArray(): boolean;
170
- GetVariability(): Variability;
171
- IsCustom(): boolean;
172
- /** True if a default value or any time sample is authored. */
173
- HasValue(): boolean;
174
- 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;
175
204
  /**
176
- * Resolve the attribute value. With no `time`, returns the default value (or
177
- * the earliest time sample if only samples are authored). With a `time`,
178
- * returns the exact sample if present, else the default, else the earliest
179
- * 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.
180
208
  */
181
- Get(time?: number): UsdValue | undefined;
182
- GetTimeSamples(): Map<number, UsdValue>;
183
- GetConnections(): SdfPath[];
184
- }
185
- /** A relationship on a prim (`UsdRelationship`-like). */
186
- declare class Relationship {
187
- private readonly _prim;
188
- private readonly _name;
189
- private readonly _spec;
190
- constructor(_prim: Prim, _name: string, _spec: RelationshipSpec | null);
191
- IsValid(): boolean;
192
- GetPrim(): Prim;
193
- GetName(): string;
194
- GetBaseName(): string;
195
- GetNamespace(): string;
196
- IsCustom(): boolean;
197
- 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;
198
228
  }
199
229
 
200
230
  /**
201
- * Resolves USD asset paths (from references / payloads / sublayers) to URLs and
202
- * fetches their text. Composition (`composition.ts`) is I/O-agnostic and goes
203
- * through an {@link AssetResolver}, so the same engine works in the browser, in
204
- * Node, or against an in-memory file map in tests.
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`.
205
237
  */
206
- interface AssetResolver {
207
- /** Resolve an authored asset path against the layer's base URL to an absolute key. */
208
- resolve(assetPath: string, baseUrl: string): string;
209
- /** Fetch the text of a resolved asset; rejects if it cannot be read. */
210
- fetchText(url: string): Promise<string>;
211
- /** Fetch the raw bytes of a resolved asset (for binary USDC / USDZ). Optional. */
212
- fetchBytes?(url: string): Promise<Uint8Array>;
213
- }
214
- /** URL-based resolver using the global `fetch` (browser / Node 18+). */
215
- declare class DefaultAssetResolver implements AssetResolver {
216
- resolve(assetPath: string, baseUrl: string): string;
217
- fetchText(url: string): Promise<string>;
218
- fetchBytes(url: string): Promise<Uint8Array>;
219
- }
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
+
220
300
  /**
221
- * Resolver over an in-memory `{ path: contents }` map (text or bytes), with
222
- * posix-style joins. Useful for tests and bundled assets.
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).
223
311
  */
224
- declare function createMemoryResolver(files: Record<string, string | Uint8Array>): AssetResolver;
225
- /** Resolve `rel` against `baseUrl` using posix semantics, normalizing `.`/`..`. */
226
- declare function joinPosix(baseUrl: string, rel: string): string;
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[];
227
377
 
228
378
  /**
229
379
  * Minimal USD composition: flattens references, payloads, sublayers, variant
@@ -248,6 +398,37 @@ declare function composeLayer(text: string, baseUrl: string, resolver: AssetReso
248
398
  /** Compose an already-parsed layer (used by the binary-crate path too). */
249
399
  declare function composeFile(file: UsdaFile, baseUrl: string, resolver: AssetResolver, options?: ComposeOptions, stack?: ReadonlySet<string>): Promise<UsdaFile>;
250
400
 
401
+ /**
402
+ * Resolves a prim's `xformOpOrder` into a single local transform matrix.
403
+ *
404
+ * Supports `translate`, `scale`, `orient` (quat), `transform` (matrix4d),
405
+ * single-axis `rotateX|Y|Z`, and the six `rotate<ORDER>` Euler ops, plus the
406
+ * `!invert!` op prefix and the `!resetXformStack!` sentinel. Rotation op values
407
+ * are in degrees and converted to radians here.
408
+ */
409
+
410
+ type ResolvedXform = {
411
+ /** Local-to-parent transform (column-major {@link Mat4}). */
412
+ matrix: Mat4;
413
+ /**
414
+ * True if `xformOpOrder` began with `!resetXformStack!`, meaning this prim
415
+ * does not inherit its parent's transform. Honored by FK in M5.
416
+ */
417
+ resetsXformStack: boolean;
418
+ };
419
+ /**
420
+ * Compute a prim's local transform from its `xformOpOrder`. Returns identity
421
+ * when the prim authors no `xformOpOrder`.
422
+ */
423
+ /**
424
+ * Accumulated transform from the stage root down to `prim` — the prim's world
425
+ * placement as authored (`UsdGeomXformCache::GetLocalToWorldTransform`-like).
426
+ */
427
+ declare function computeWorldTransform(prim: Prim): Mat4;
428
+ declare function computeLocalTransform(prim: Prim): ResolvedXform;
429
+ /** Extract the op type token from an op attribute name (`xformOp:translate:pivot` → `translate`). */
430
+ declare function parseOpType(opName: string): string;
431
+
251
432
  /**
252
433
  * USDZ (zipped USD package) support.
253
434
  *
@@ -255,14 +436,15 @@ declare function composeFile(file: UsdaFile, baseUrl: string, resolver: AssetRes
255
436
  * {@link openUsdz} unzips it (via `fflate`) and returns the root layer entry
256
437
  * plus an {@link AssetResolver} that serves the package's other entries, so
257
438
  * references inside the package resolve through the normal composition path.
258
- * USDC (binary crate) entries are not decodable yet (M10).
439
+ * Layers must be read through `fetchBytes` the root entry is typically a
440
+ * binary crate (`.usdc`), which composition sniffs and decodes (M10).
259
441
  */
260
442
 
261
443
  type UsdzPackage = {
262
444
  /** Archive path of the root layer to open. */
263
445
  rootEntry: string;
264
- /** Resolver over the package's entries. */
265
- resolver: AssetResolver;
446
+ /** Resolver over the package's entries (`fetchBytes` is always present). */
447
+ resolver: Required<AssetResolver>;
266
448
  };
267
449
  /** Unzip a `.usdz` package and build a resolver over its entries. */
268
450
  declare function openUsdz(bytes: Uint8Array): UsdzPackage;
@@ -359,32 +541,6 @@ declare class CrateReader {
359
541
 
360
542
  declare function crateToUsdaFile(crate: CrateReader): UsdaFile;
361
543
 
362
- /**
363
- * Resolves a prim's `xformOpOrder` into a single local transform matrix.
364
- *
365
- * Supports `translate`, `scale`, `orient` (quat), `transform` (matrix4d),
366
- * single-axis `rotateX|Y|Z`, and the six `rotate<ORDER>` Euler ops, plus the
367
- * `!invert!` op prefix and the `!resetXformStack!` sentinel. Rotation op values
368
- * are in degrees and converted to radians here.
369
- */
370
-
371
- type ResolvedXform = {
372
- /** Local-to-parent transform (column-major {@link Mat4}). */
373
- matrix: Mat4;
374
- /**
375
- * True if `xformOpOrder` began with `!resetXformStack!`, meaning this prim
376
- * does not inherit its parent's transform. Honored by FK in M5.
377
- */
378
- resetsXformStack: boolean;
379
- };
380
- /**
381
- * Compute a prim's local transform from its `xformOpOrder`. Returns identity
382
- * when the prim authors no `xformOpOrder`.
383
- */
384
- declare function computeLocalTransform(prim: Prim): ResolvedXform;
385
- /** Extract the op type token from an op attribute name (`xformOp:translate:pivot` → `translate`). */
386
- declare function parseOpType(opName: string): string;
387
-
388
544
  /**
389
545
  * Extracts a {@link RobotDescription} from a USD {@link Stage}.
390
546
  *
@@ -416,6 +572,8 @@ declare function normalizeJointLimits(type: JointType, rawLower: number | undefi
416
572
  };
417
573
  /** Convert an authored joint value to SI (angular degrees → radians). */
418
574
  declare function jointValueToSI(angular: boolean, raw: number): number;
575
+ /** Convert an SI joint value back to authored units (angular radians → degrees, M13 export). */
576
+ declare function jointValueFromSI(angular: boolean, si: number): number;
419
577
  /**
420
578
  * A revolute joint with no finite limits is a continuous (unbounded) joint.
421
579
  * Returns the refined joint type.
@@ -443,6 +601,9 @@ declare function gatherMeshDescendants(prim: Prim): string[];
443
601
  declare const ARTICULATION_ROOT_API = "PhysicsArticulationRootAPI";
444
602
  declare const RIGID_BODY_API = "PhysicsRigidBodyAPI";
445
603
  declare const COLLISION_API = "PhysicsCollisionAPI";
604
+ declare const MASS_API = "PhysicsMassAPI";
605
+ declare const MESH_COLLISION_API = "PhysicsMeshCollisionAPI";
606
+ declare const PHYSICS_MATERIAL_API = "PhysicsMaterialAPI";
446
607
  /** Base joint type from the prim's schema type, or `null` if not a joint. */
447
608
  declare function getJointType(prim: Prim): JointType | null;
448
609
  /** Resolve `physics:body0` / `physics:body1` target paths (first target each). */
@@ -476,5 +637,7 @@ declare function getJointDrive(prim: Prim, kind: "angular" | "linear"): {
476
637
  };
477
638
  /** Read `PhysicsJointStateAPI` position for the given instance, as authored. */
478
639
  declare function getJointStatePosition(prim: Prim, kind: "angular" | "linear"): number | undefined;
640
+ /** Read `UsdPhysicsMassAPI` properties, or `undefined` when none are authored (M16). */
641
+ declare function getMassProperties(prim: Prim): LinkInertialDescription | undefined;
479
642
 
480
- export { ARTICULATION_ROOT_API, type AssetResolver, Attribute, AttributeSpec, Axis, COLLISION_API, type ComposeOptions, CrateReader, DEFAULT_METERS_PER_UNIT, DefaultAssetResolver, 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, createMemoryResolver, driveKindFor, extractRobotDescription, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isMesh, isScope, isXform, iterDescendants, joinPosix, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, tokenize };
643
+ 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,3 +1,4 @@
1
- export { ARTICULATION_ROOT_API, AssetPath, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, DEG2RAD, DefaultAssetResolver, Layer, PACKAGE_NAME, ParseError, Prim, Quat, RAD2DEG, RIGID_BODY_API, Relationship, Stage, TokenizeError, UsdMatrix, VERSION, 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-FYVZ7YPW.js';
1
+ export { PACKAGE_NAME, VERSION, exportRobotUsda, stageGeometryProvider, validateRobotDescription, writeUsdz } from './chunk-JZMCABQO.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-4MEZM763.js';
2
3
  //# sourceMappingURL=core.js.map
3
4
  //# sourceMappingURL=core.js.map
package/dist/extras.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { T as ThreeUsdRobot } from './ThreeUsdRobot-Deoh7zam.js';
1
+ import { T as ThreeUsdRobot } from './ThreeUsdRobot-CajXJqYU.js';
2
2
  import 'three';
3
- import './buildKinematicTree-CZjBMA1I.js';
3
+ import './buildKinematicTree-wtZPzy0B.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-Deoh7zam.js';
3
- import './buildKinematicTree-CZjBMA1I.js';
2
+ import { J as JointObject, T as ThreeUsdRobot } from './ThreeUsdRobot-CajXJqYU.js';
3
+ import './buildKinematicTree-wtZPzy0B.js';
4
4
 
5
5
  /**
6
6
  * An arrow drawn along a joint's motion axis (the rotation axis for