three-usd-robot 0.8.1 → 0.10.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 +20 -9
- package/dist/{ThreeUsdRobot-BZ_vlr1R.d.ts → ThreeUsdRobot-B7Z4oORO.d.ts} +7 -1
- package/dist/{ThreeUsdRobotLoader-HteyMZf1.d.ts → ThreeUsdRobotLoader-NdFAVN96.d.ts} +9 -2
- package/dist/{buildKinematicTree-D4R0hEtN.d.ts → buildKinematicTree-BCySuZZn.d.ts} +168 -1
- package/dist/chunk-CDQPWWMQ.js +951 -0
- package/dist/chunk-CDQPWWMQ.js.map +1 -0
- package/dist/{chunk-PHHMWMCA.js → chunk-NFKK5LJK.js} +460 -49
- package/dist/chunk-NFKK5LJK.js.map +1 -0
- package/dist/{chunk-P6CHTMGW.js → chunk-SSSDVLUK.js} +3 -3
- package/dist/{chunk-P6CHTMGW.js.map → chunk-SSSDVLUK.js.map} +1 -1
- package/dist/{chunk-FUPFJOXW.js → chunk-WROYLUSS.js} +8 -2
- package/dist/chunk-WROYLUSS.js.map +1 -0
- package/dist/core.d.ts +47 -162
- package/dist/core.js +2 -2
- package/dist/extras.d.ts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/helpers.js +1 -1
- package/dist/index.d.ts +80 -17
- package/dist/index.js +6 -6
- package/dist/react.d.ts +3 -3
- package/dist/react.js +3 -3
- package/package.json +3 -3
- package/dist/chunk-FUPFJOXW.js.map +0 -1
- package/dist/chunk-JHOX3VUW.js +0 -508
- package/dist/chunk-JHOX3VUW.js.map +0 -1
- package/dist/chunk-PHHMWMCA.js.map +0 -1
package/README.md
CHANGED
|
@@ -23,10 +23,13 @@ exported back to `.usda` / `.usdz` in the browser.
|
|
|
23
23
|
instanceable prims are composed for you.
|
|
24
24
|
- **Robots** — links, joints (fixed / revolute / continuous / prismatic), limits,
|
|
25
25
|
drives and the initial pose become a `setJointValue`-able hierarchy.
|
|
26
|
-
- **Rendering** — meshes
|
|
27
|
-
`Capsule` / `Cone`)
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
- **Rendering** — meshes, solid gprims (`Cube` / `Sphere` / `Cylinder` /
|
|
27
|
+
`Capsule` / `Cone`), point clouds (`Points`) and curves (`BasisCurves`:
|
|
28
|
+
linear / bezier / bspline / catmullRom, periodic wrap, and an opt-in
|
|
29
|
+
`curveTubes` mode that turns authored widths into tube meshes) with
|
|
30
|
+
`UsdShade` materials (UsdPreviewSurface / OmniPBR) and textures; up-axis
|
|
31
|
+
and units normalized automatically. Articulation-free stages load as
|
|
32
|
+
static scenes.
|
|
30
33
|
- **Animation** — plays back time-sampled joint trajectories.
|
|
31
34
|
- **Export** — write robots and whole cells back to `.usda` / `.usdz`,
|
|
32
35
|
simulation-ready for Isaac Sim.
|
|
@@ -50,8 +53,15 @@ The CDN is public and CORS-enabled, so this works in the browser too. Try
|
|
|
50
53
|
FK check, and a re-export to one self-contained file), or open the Vite example
|
|
51
54
|
and pick a robot from the preset list.
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
Materials target **UsdPreviewSurface fidelity plus an OmniPBR mapping**:
|
|
57
|
+
constant and textured inputs, faceVarying / indexed UVs, multiple UV sets,
|
|
58
|
+
per-vertex display colors, physical extensions (`ior` / `clearcoat` /
|
|
59
|
+
specular workflow → `MeshPhysicalMaterial`), packed ORM maps,
|
|
60
|
+
`sourceColorSpace`, and purpose/strength-aware bindings. Executing MDL or
|
|
61
|
+
MaterialX shader graphs is out of scope. Not yet supported:
|
|
62
|
+
collection-based material bindings, and the exotic curve schemas
|
|
63
|
+
(`NurbsCurves`, `HermiteCurves`, `NurbsPatch`) which load with a warning and
|
|
64
|
+
are skipped.
|
|
55
65
|
|
|
56
66
|
## Install
|
|
57
67
|
|
|
@@ -303,9 +313,10 @@ and `.usdz` packages to ASCII USDA.
|
|
|
303
313
|
|
|
304
314
|
[`examples/`](./examples) holds runnable Vite demos:
|
|
305
315
|
|
|
306
|
-
- **`vite-
|
|
307
|
-
vanilla Three.js + `lil-gui`, with a robot picker,
|
|
308
|
-
|
|
316
|
+
- **`vite-usd-inspector`** — the [live demo](https://three-usd-robot.vercel.app):
|
|
317
|
+
vanilla Three.js + `lil-gui`, with a robot picker, a USD structure panel
|
|
318
|
+
(prim tree + attribute inspector), a transform gizmo, joint sliders,
|
|
319
|
+
animation playback and USD export.
|
|
309
320
|
- **`vite-basic-viewer`** — the same thing through React Three Fiber.
|
|
310
321
|
|
|
311
322
|
Both take `?asset=<url>` for any asset, or `?isaac=<path under Isaac/>` to pull
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import { J as JointType, A as Axis, a as JointDescription, L as LinkDescription, R as RobotDescription, K as KinematicTree } from './buildKinematicTree-
|
|
2
|
+
import { J as JointType, A as Axis, a as JointDescription, L as LinkDescription, R as RobotDescription, K as KinematicTree, S as Stage } from './buildKinematicTree-BCySuZZn.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The articulated "motion" node of a joint, inserted between the joint's two
|
|
@@ -87,6 +87,12 @@ declare class ThreeUsdRobot extends THREE.Object3D {
|
|
|
87
87
|
readonly robot: RobotDescription;
|
|
88
88
|
readonly tree: KinematicTree;
|
|
89
89
|
readonly clampJointLimits: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* The composed USD stage this robot was built from — the full prim tree, for
|
|
92
|
+
* inspection tooling (structure panels, attribute browsers). Attached by
|
|
93
|
+
* {@link ThreeUsdRobotLoader}; `undefined` for programmatically-built robots.
|
|
94
|
+
*/
|
|
95
|
+
stage?: Stage;
|
|
90
96
|
private readonly linkObjects;
|
|
91
97
|
private readonly jointObjects;
|
|
92
98
|
private readonly linkKeyByPath;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { R as RobotDescription } from './buildKinematicTree-
|
|
1
|
+
import { R as RobotDescription } from './buildKinematicTree-BCySuZZn.js';
|
|
2
2
|
import { A as AssetResolver, U as UsdSource, B as BinarySource } from './bytes-MOJ2oN-u.js';
|
|
3
|
-
import { W as WorldUpAxis, T as ThreeUsdRobot } from './ThreeUsdRobot-
|
|
3
|
+
import { W as WorldUpAxis, T as ThreeUsdRobot } from './ThreeUsdRobot-B7Z4oORO.js';
|
|
4
4
|
|
|
5
5
|
type ThreeUsdRobotLoaderOptions = {
|
|
6
6
|
/** Resolver for references / payloads / sublayers (default {@link DefaultAssetResolver}). */
|
|
@@ -18,6 +18,11 @@ type ThreeUsdRobotLoaderOptions = {
|
|
|
18
18
|
loadSceneGeometry?: boolean;
|
|
19
19
|
/** Load diffuse textures referenced by materials (default `true`). */
|
|
20
20
|
loadTextures?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Render `BasisCurves` that author `widths` as tube meshes instead of
|
|
23
|
+
* 1-px lines (default `false`, M18).
|
|
24
|
+
*/
|
|
25
|
+
curveTubes?: boolean;
|
|
21
26
|
/**
|
|
22
27
|
* Target world up-axis. Any stage (Y-up or Z-up) is normalized into this
|
|
23
28
|
* convention: `"Y"` for a standard three.js scene (the default behavior),
|
|
@@ -82,6 +87,8 @@ declare class ThreeUsdRobotLoader {
|
|
|
82
87
|
private openSource;
|
|
83
88
|
private openUsdzStage;
|
|
84
89
|
private buildFromStage;
|
|
90
|
+
/** Surface recognized-but-unrenderable gprim schemas instead of silence (M18). */
|
|
91
|
+
private warnUnsupportedGprims;
|
|
85
92
|
private composeStage;
|
|
86
93
|
/** Compose a layer from raw bytes, sniffing binary crate vs USDA text. */
|
|
87
94
|
private composeStageFromBytes;
|
|
@@ -317,6 +317,173 @@ type JointDriveDescription = {
|
|
|
317
317
|
maxForce?: number;
|
|
318
318
|
};
|
|
319
319
|
|
|
320
|
+
/** A parsed USDA layer (`SdfLayer`-like, read-only). */
|
|
321
|
+
declare class Layer {
|
|
322
|
+
private readonly _file;
|
|
323
|
+
constructor(_file: UsdaFile);
|
|
324
|
+
/** Serialize this layer back to USDA text (`SdfLayer::ExportToString`-like). */
|
|
325
|
+
ExportToString(): string;
|
|
326
|
+
GetVersion(): string;
|
|
327
|
+
GetPseudoRootMetadata(): MetadataMap;
|
|
328
|
+
GetMetadata(key: string): UsdValue | undefined;
|
|
329
|
+
GetDefaultPrimName(): string | undefined;
|
|
330
|
+
GetRootPrimSpecs(): PrimSpec[];
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* A typed attribute on a prim (`UsdAttribute`-like).
|
|
335
|
+
*
|
|
336
|
+
* Mirrors the pxr USD API: `GetAttribute` always returns an `Attribute` object;
|
|
337
|
+
* call {@link Attribute.IsValid} to check whether the attribute is actually
|
|
338
|
+
* authored on the prim.
|
|
339
|
+
*/
|
|
340
|
+
declare class Attribute {
|
|
341
|
+
private readonly _prim;
|
|
342
|
+
private readonly _name;
|
|
343
|
+
private readonly _spec;
|
|
344
|
+
constructor(_prim: Prim, _name: string, _spec: AttributeSpec | null);
|
|
345
|
+
IsValid(): boolean;
|
|
346
|
+
GetPrim(): Prim;
|
|
347
|
+
GetName(): string;
|
|
348
|
+
GetBaseName(): string;
|
|
349
|
+
GetNamespace(): string;
|
|
350
|
+
/** Scalar type name (without the `[]` suffix); pair with {@link IsArray}. */
|
|
351
|
+
GetTypeName(): string;
|
|
352
|
+
IsArray(): boolean;
|
|
353
|
+
GetVariability(): Variability;
|
|
354
|
+
IsCustom(): boolean;
|
|
355
|
+
/** True if a default value or any time sample is authored. */
|
|
356
|
+
HasValue(): boolean;
|
|
357
|
+
HasAuthoredValue(): boolean;
|
|
358
|
+
/**
|
|
359
|
+
* Resolve the attribute value. With no `time`, returns the default value (or
|
|
360
|
+
* the earliest time sample if only samples are authored). With a `time`,
|
|
361
|
+
* returns the exact sample if present, else the default, else the earliest
|
|
362
|
+
* sample. Returns `undefined` when nothing is authored.
|
|
363
|
+
*/
|
|
364
|
+
Get(time?: number): UsdValue | undefined;
|
|
365
|
+
GetTimeSamples(): Map<number, UsdValue>;
|
|
366
|
+
GetConnections(): SdfPath[];
|
|
367
|
+
/** Authored attribute metadata (`interpolation`, `elementSize`, …). */
|
|
368
|
+
GetMetadata(key: string): UsdValue | undefined;
|
|
369
|
+
}
|
|
370
|
+
/** A relationship on a prim (`UsdRelationship`-like). */
|
|
371
|
+
declare class Relationship {
|
|
372
|
+
private readonly _prim;
|
|
373
|
+
private readonly _name;
|
|
374
|
+
private readonly _spec;
|
|
375
|
+
constructor(_prim: Prim, _name: string, _spec: RelationshipSpec | null);
|
|
376
|
+
IsValid(): boolean;
|
|
377
|
+
GetPrim(): Prim;
|
|
378
|
+
GetName(): string;
|
|
379
|
+
GetBaseName(): string;
|
|
380
|
+
GetNamespace(): string;
|
|
381
|
+
IsCustom(): boolean;
|
|
382
|
+
GetTargets(): SdfPath[];
|
|
383
|
+
/** Authored relationship metadata (`bindMaterialAs`, …). */
|
|
384
|
+
GetMetadata(key: string): UsdValue | undefined;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* A composed prim on a {@link Stage} (`UsdPrim`-like).
|
|
389
|
+
*
|
|
390
|
+
* The pseudo-root (path `/`) is represented by a Prim with a `null` spec; its
|
|
391
|
+
* children are the stage's root prims.
|
|
392
|
+
*/
|
|
393
|
+
declare class Prim {
|
|
394
|
+
private readonly _stage;
|
|
395
|
+
private readonly _spec;
|
|
396
|
+
private readonly _path;
|
|
397
|
+
private readonly _parent;
|
|
398
|
+
private readonly _children;
|
|
399
|
+
private _attributes?;
|
|
400
|
+
private _relationships?;
|
|
401
|
+
constructor(_stage: Stage, _spec: PrimSpec | null, _path: string, _parent: Prim | null);
|
|
402
|
+
/** @internal Used by {@link Stage} while building the prim tree. */
|
|
403
|
+
_addChild(child: Prim): void;
|
|
404
|
+
GetStage(): Stage;
|
|
405
|
+
IsValid(): boolean;
|
|
406
|
+
IsPseudoRoot(): boolean;
|
|
407
|
+
GetName(): string;
|
|
408
|
+
GetPath(): string;
|
|
409
|
+
GetTypeName(): string;
|
|
410
|
+
GetSpecifier(): Specifier | null;
|
|
411
|
+
GetParent(): Prim | null;
|
|
412
|
+
GetChildren(): Prim[];
|
|
413
|
+
GetChild(name: string): Prim | null;
|
|
414
|
+
private attrMap;
|
|
415
|
+
/** Always returns an Attribute; check {@link Attribute.IsValid}. */
|
|
416
|
+
GetAttribute(name: string): Attribute;
|
|
417
|
+
HasAttribute(name: string): boolean;
|
|
418
|
+
GetAttributes(): Attribute[];
|
|
419
|
+
private relMap;
|
|
420
|
+
/** Always returns a Relationship; check {@link Relationship.IsValid}. */
|
|
421
|
+
GetRelationship(name: string): Relationship;
|
|
422
|
+
HasRelationship(name: string): boolean;
|
|
423
|
+
GetRelationships(): Relationship[];
|
|
424
|
+
GetMetadata(key: string): UsdValue | undefined;
|
|
425
|
+
GetAllMetadata(): MetadataMap;
|
|
426
|
+
/**
|
|
427
|
+
* Model-hierarchy kind from the `kind` metadata — `"component"`, `"group"`,
|
|
428
|
+
* `"assembly"`, `"subcomponent"`, … — or `""` when unauthored. The standard
|
|
429
|
+
* signal for selection granularity (usdview's "select by kind").
|
|
430
|
+
*/
|
|
431
|
+
GetKind(): string;
|
|
432
|
+
/** Applied API schema names from `apiSchemas` (e.g. `PhysicsArticulationRootAPI`). */
|
|
433
|
+
GetAppliedSchemas(): string[];
|
|
434
|
+
/**
|
|
435
|
+
* Whether the given API schema is applied. Matches the bare schema name as
|
|
436
|
+
* well as multi-apply instances (e.g. `HasAPI("PhysicsDriveAPI")` is true for
|
|
437
|
+
* an applied `PhysicsDriveAPI:angular`).
|
|
438
|
+
*/
|
|
439
|
+
HasAPI(schemaName: string): boolean;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/** OpenUSD's fallback stage linear unit when `metersPerUnit` is unauthored. */
|
|
443
|
+
declare const DEFAULT_METERS_PER_UNIT = 0.01;
|
|
444
|
+
type UpAxis = "Y" | "Z";
|
|
445
|
+
/**
|
|
446
|
+
* A composed USD stage (`UsdStage`-like) backed by a single in-memory USDA
|
|
447
|
+
* layer. Multi-layer composition (sublayers / references / payloads) arrives in
|
|
448
|
+
* M8; for now a stage wraps exactly one parsed layer.
|
|
449
|
+
*/
|
|
450
|
+
declare class Stage {
|
|
451
|
+
private readonly _layer;
|
|
452
|
+
private readonly _byPath;
|
|
453
|
+
private readonly _pseudoRoot;
|
|
454
|
+
private constructor();
|
|
455
|
+
/** Parse and open a stage from USDA source text. */
|
|
456
|
+
static OpenFromString(usda: string): Stage;
|
|
457
|
+
/** Open a stage from an already-parsed layer. */
|
|
458
|
+
static OpenFromFile(file: UsdaFile): Stage;
|
|
459
|
+
private buildPrim;
|
|
460
|
+
GetRootLayer(): Layer;
|
|
461
|
+
/**
|
|
462
|
+
* Serialize the stage's backing layer to USDA text. Loader-built stages wrap
|
|
463
|
+
* the fully composed layer, so this is a flattened (`usdcat --flatten`-like)
|
|
464
|
+
* export of everything that was read — including binary-crate sources.
|
|
465
|
+
*/
|
|
466
|
+
ExportToString(): string;
|
|
467
|
+
GetPseudoRoot(): Prim;
|
|
468
|
+
/** Returns the prim at the absolute path, or `null` if none exists. */
|
|
469
|
+
GetPrimAtPath(path: string): Prim | null;
|
|
470
|
+
/** The stage's default prim (from layer `defaultPrim` metadata), if any. */
|
|
471
|
+
GetDefaultPrim(): Prim | null;
|
|
472
|
+
/** Depth-first traversal of all prims (excludes the pseudo-root). */
|
|
473
|
+
Traverse(): Prim[];
|
|
474
|
+
GetMetadata(key: string): UsdValue | undefined;
|
|
475
|
+
/** Stage up axis (`upAxis` metadata); defaults to `"Y"` per OpenUSD. */
|
|
476
|
+
GetUpAxis(): UpAxis;
|
|
477
|
+
/** Stage linear unit (`metersPerUnit` metadata); defaults to {@link DEFAULT_METERS_PER_UNIT}. */
|
|
478
|
+
GetMetersPerUnit(): number;
|
|
479
|
+
/** Animation start time code, if authored. */
|
|
480
|
+
GetStartTimeCode(): number | undefined;
|
|
481
|
+
/** Animation end time code, if authored. */
|
|
482
|
+
GetEndTimeCode(): number | undefined;
|
|
483
|
+
/** Time codes per second for playback; defaults to 24. */
|
|
484
|
+
GetTimeCodesPerSecond(): number;
|
|
485
|
+
}
|
|
486
|
+
|
|
320
487
|
/**
|
|
321
488
|
* Builds a kinematic spanning tree from a {@link RobotDescription}.
|
|
322
489
|
*
|
|
@@ -361,4 +528,4 @@ type BuildTreeOptions = {
|
|
|
361
528
|
};
|
|
362
529
|
declare function buildKinematicTree(robot: RobotDescription, options?: BuildTreeOptions): KinematicTree;
|
|
363
530
|
|
|
364
|
-
export { type Axis as A, type BuildTreeOptions as B, type CompositionArc as C,
|
|
531
|
+
export { makeRotationZ as $, type Axis as A, type BuildTreeOptions as B, type CompositionArc as C, DEFAULT_METERS_PER_UNIT as D, buildKinematicTree as E, channelFromSamples as F, decomposeRigid as G, fromUsdMatrix as H, getTranslation as I, type JointType as J, type KinematicTree as K, type LinkDescription as L, type Mat4 as M, identity4 as N, interpolate as O, Prim as P, Quat as Q, type RobotDescription as R, Stage as S, type TreeEdge as T, type UsdaFile as U, type Vec2 as V, invert as W, makeEuler as X, makeRotationFromQuat as Y, makeRotationX as Z, makeRotationY as _, type JointDescription as a, makeScale as a0, makeTranslation as a1, multiply as a2, multiplyAll as a3, toUsdMatrix as a4, type Vec3 as b, type JointDriveDescription as c, type LinkInertialDescription as d, AssetPath as e, Attribute as f, type AttributeSpec as g, DEG2RAD as h, type KinematicNode as i, Layer as j, type ListOp as k, type MetadataMap as l, type PrimSpec as m, type PropertySpec as n, RAD2DEG as o, Relationship as p, type RelationshipSpec as q, type SampleChannel as r, type SdfPath as s, type Specifier as t, type UpAxis as u, type UsdDictionary as v, UsdMatrix as w, type UsdValue as x, type Variability as y, type Vec4 as z };
|