three-usd-robot 0.8.1 → 0.9.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 +4 -3
- package/dist/{ThreeUsdRobot-BZ_vlr1R.d.ts → ThreeUsdRobot-BAh-48DD.d.ts} +7 -1
- package/dist/{ThreeUsdRobotLoader-HteyMZf1.d.ts → ThreeUsdRobotLoader-DYtvelif.d.ts} +2 -2
- package/dist/{buildKinematicTree-D4R0hEtN.d.ts → buildKinematicTree-DQ4Vr4sJ.d.ts} +164 -1
- package/dist/{chunk-PHHMWMCA.js → chunk-2UD32EGU.js} +11 -2
- package/dist/chunk-2UD32EGU.js.map +1 -0
- package/dist/{chunk-P6CHTMGW.js → chunk-TE4MPP5Q.js} +3 -3
- package/dist/{chunk-P6CHTMGW.js.map → chunk-TE4MPP5Q.js.map} +1 -1
- package/dist/{chunk-FUPFJOXW.js → chunk-WROYLUSS.js} +8 -2
- package/dist/chunk-WROYLUSS.js.map +1 -0
- package/dist/{chunk-JHOX3VUW.js → chunk-XEXFGL7R.js} +29 -8
- package/dist/chunk-XEXFGL7R.js.map +1 -0
- package/dist/core.d.ts +3 -160
- 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 +13 -10
- 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.map +0 -1
- package/dist/chunk-PHHMWMCA.js.map +0 -1
package/README.md
CHANGED
|
@@ -303,9 +303,10 @@ and `.usdz` packages to ASCII USDA.
|
|
|
303
303
|
|
|
304
304
|
[`examples/`](./examples) holds runnable Vite demos:
|
|
305
305
|
|
|
306
|
-
- **`vite-
|
|
307
|
-
vanilla Three.js + `lil-gui`, with a robot picker,
|
|
308
|
-
|
|
306
|
+
- **`vite-usd-inspector`** — the [live demo](https://three-usd-robot.vercel.app):
|
|
307
|
+
vanilla Three.js + `lil-gui`, with a robot picker, a USD structure panel
|
|
308
|
+
(prim tree + attribute inspector), a transform gizmo, joint sliders,
|
|
309
|
+
animation playback and USD export.
|
|
309
310
|
- **`vite-basic-viewer`** — the same thing through React Three Fiber.
|
|
310
311
|
|
|
311
312
|
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-DQ4Vr4sJ.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-DQ4Vr4sJ.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-BAh-48DD.js';
|
|
4
4
|
|
|
5
5
|
type ThreeUsdRobotLoaderOptions = {
|
|
6
6
|
/** Resolver for references / payloads / sublayers (default {@link DefaultAssetResolver}). */
|
|
@@ -317,6 +317,169 @@ 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
|
+
}
|
|
368
|
+
/** A relationship on a prim (`UsdRelationship`-like). */
|
|
369
|
+
declare class Relationship {
|
|
370
|
+
private readonly _prim;
|
|
371
|
+
private readonly _name;
|
|
372
|
+
private readonly _spec;
|
|
373
|
+
constructor(_prim: Prim, _name: string, _spec: RelationshipSpec | null);
|
|
374
|
+
IsValid(): boolean;
|
|
375
|
+
GetPrim(): Prim;
|
|
376
|
+
GetName(): string;
|
|
377
|
+
GetBaseName(): string;
|
|
378
|
+
GetNamespace(): string;
|
|
379
|
+
IsCustom(): boolean;
|
|
380
|
+
GetTargets(): SdfPath[];
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* A composed prim on a {@link Stage} (`UsdPrim`-like).
|
|
385
|
+
*
|
|
386
|
+
* The pseudo-root (path `/`) is represented by a Prim with a `null` spec; its
|
|
387
|
+
* children are the stage's root prims.
|
|
388
|
+
*/
|
|
389
|
+
declare class Prim {
|
|
390
|
+
private readonly _stage;
|
|
391
|
+
private readonly _spec;
|
|
392
|
+
private readonly _path;
|
|
393
|
+
private readonly _parent;
|
|
394
|
+
private readonly _children;
|
|
395
|
+
private _attributes?;
|
|
396
|
+
private _relationships?;
|
|
397
|
+
constructor(_stage: Stage, _spec: PrimSpec | null, _path: string, _parent: Prim | null);
|
|
398
|
+
/** @internal Used by {@link Stage} while building the prim tree. */
|
|
399
|
+
_addChild(child: Prim): void;
|
|
400
|
+
GetStage(): Stage;
|
|
401
|
+
IsValid(): boolean;
|
|
402
|
+
IsPseudoRoot(): boolean;
|
|
403
|
+
GetName(): string;
|
|
404
|
+
GetPath(): string;
|
|
405
|
+
GetTypeName(): string;
|
|
406
|
+
GetSpecifier(): Specifier | null;
|
|
407
|
+
GetParent(): Prim | null;
|
|
408
|
+
GetChildren(): Prim[];
|
|
409
|
+
GetChild(name: string): Prim | null;
|
|
410
|
+
private attrMap;
|
|
411
|
+
/** Always returns an Attribute; check {@link Attribute.IsValid}. */
|
|
412
|
+
GetAttribute(name: string): Attribute;
|
|
413
|
+
HasAttribute(name: string): boolean;
|
|
414
|
+
GetAttributes(): Attribute[];
|
|
415
|
+
private relMap;
|
|
416
|
+
/** Always returns a Relationship; check {@link Relationship.IsValid}. */
|
|
417
|
+
GetRelationship(name: string): Relationship;
|
|
418
|
+
HasRelationship(name: string): boolean;
|
|
419
|
+
GetRelationships(): Relationship[];
|
|
420
|
+
GetMetadata(key: string): UsdValue | undefined;
|
|
421
|
+
GetAllMetadata(): MetadataMap;
|
|
422
|
+
/**
|
|
423
|
+
* Model-hierarchy kind from the `kind` metadata — `"component"`, `"group"`,
|
|
424
|
+
* `"assembly"`, `"subcomponent"`, … — or `""` when unauthored. The standard
|
|
425
|
+
* signal for selection granularity (usdview's "select by kind").
|
|
426
|
+
*/
|
|
427
|
+
GetKind(): string;
|
|
428
|
+
/** Applied API schema names from `apiSchemas` (e.g. `PhysicsArticulationRootAPI`). */
|
|
429
|
+
GetAppliedSchemas(): string[];
|
|
430
|
+
/**
|
|
431
|
+
* Whether the given API schema is applied. Matches the bare schema name as
|
|
432
|
+
* well as multi-apply instances (e.g. `HasAPI("PhysicsDriveAPI")` is true for
|
|
433
|
+
* an applied `PhysicsDriveAPI:angular`).
|
|
434
|
+
*/
|
|
435
|
+
HasAPI(schemaName: string): boolean;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/** OpenUSD's fallback stage linear unit when `metersPerUnit` is unauthored. */
|
|
439
|
+
declare const DEFAULT_METERS_PER_UNIT = 0.01;
|
|
440
|
+
type UpAxis = "Y" | "Z";
|
|
441
|
+
/**
|
|
442
|
+
* A composed USD stage (`UsdStage`-like) backed by a single in-memory USDA
|
|
443
|
+
* layer. Multi-layer composition (sublayers / references / payloads) arrives in
|
|
444
|
+
* M8; for now a stage wraps exactly one parsed layer.
|
|
445
|
+
*/
|
|
446
|
+
declare class Stage {
|
|
447
|
+
private readonly _layer;
|
|
448
|
+
private readonly _byPath;
|
|
449
|
+
private readonly _pseudoRoot;
|
|
450
|
+
private constructor();
|
|
451
|
+
/** Parse and open a stage from USDA source text. */
|
|
452
|
+
static OpenFromString(usda: string): Stage;
|
|
453
|
+
/** Open a stage from an already-parsed layer. */
|
|
454
|
+
static OpenFromFile(file: UsdaFile): Stage;
|
|
455
|
+
private buildPrim;
|
|
456
|
+
GetRootLayer(): Layer;
|
|
457
|
+
/**
|
|
458
|
+
* Serialize the stage's backing layer to USDA text. Loader-built stages wrap
|
|
459
|
+
* the fully composed layer, so this is a flattened (`usdcat --flatten`-like)
|
|
460
|
+
* export of everything that was read — including binary-crate sources.
|
|
461
|
+
*/
|
|
462
|
+
ExportToString(): string;
|
|
463
|
+
GetPseudoRoot(): Prim;
|
|
464
|
+
/** Returns the prim at the absolute path, or `null` if none exists. */
|
|
465
|
+
GetPrimAtPath(path: string): Prim | null;
|
|
466
|
+
/** The stage's default prim (from layer `defaultPrim` metadata), if any. */
|
|
467
|
+
GetDefaultPrim(): Prim | null;
|
|
468
|
+
/** Depth-first traversal of all prims (excludes the pseudo-root). */
|
|
469
|
+
Traverse(): Prim[];
|
|
470
|
+
GetMetadata(key: string): UsdValue | undefined;
|
|
471
|
+
/** Stage up axis (`upAxis` metadata); defaults to `"Y"` per OpenUSD. */
|
|
472
|
+
GetUpAxis(): UpAxis;
|
|
473
|
+
/** Stage linear unit (`metersPerUnit` metadata); defaults to {@link DEFAULT_METERS_PER_UNIT}. */
|
|
474
|
+
GetMetersPerUnit(): number;
|
|
475
|
+
/** Animation start time code, if authored. */
|
|
476
|
+
GetStartTimeCode(): number | undefined;
|
|
477
|
+
/** Animation end time code, if authored. */
|
|
478
|
+
GetEndTimeCode(): number | undefined;
|
|
479
|
+
/** Time codes per second for playback; defaults to 24. */
|
|
480
|
+
GetTimeCodesPerSecond(): number;
|
|
481
|
+
}
|
|
482
|
+
|
|
320
483
|
/**
|
|
321
484
|
* Builds a kinematic spanning tree from a {@link RobotDescription}.
|
|
322
485
|
*
|
|
@@ -361,4 +524,4 @@ type BuildTreeOptions = {
|
|
|
361
524
|
};
|
|
362
525
|
declare function buildKinematicTree(robot: RobotDescription, options?: BuildTreeOptions): KinematicTree;
|
|
363
526
|
|
|
364
|
-
export { type Axis as A, type BuildTreeOptions as B, type CompositionArc as C,
|
|
527
|
+
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 };
|
|
@@ -1907,6 +1907,15 @@ var Prim = class {
|
|
|
1907
1907
|
GetAllMetadata() {
|
|
1908
1908
|
return this._spec?.metadata ?? {};
|
|
1909
1909
|
}
|
|
1910
|
+
/**
|
|
1911
|
+
* Model-hierarchy kind from the `kind` metadata — `"component"`, `"group"`,
|
|
1912
|
+
* `"assembly"`, `"subcomponent"`, … — or `""` when unauthored. The standard
|
|
1913
|
+
* signal for selection granularity (usdview's "select by kind").
|
|
1914
|
+
*/
|
|
1915
|
+
GetKind() {
|
|
1916
|
+
const kind = this._spec?.metadata.kind;
|
|
1917
|
+
return typeof kind === "string" ? kind : "";
|
|
1918
|
+
}
|
|
1910
1919
|
/** Applied API schema names from `apiSchemas` (e.g. `PhysicsArticulationRootAPI`). */
|
|
1911
1920
|
GetAppliedSchemas() {
|
|
1912
1921
|
const raw = this._spec?.metadata.apiSchemas;
|
|
@@ -3210,5 +3219,5 @@ function openUsdz(bytes) {
|
|
|
3210
3219
|
}
|
|
3211
3220
|
|
|
3212
3221
|
export { ARTICULATION_ROOT_API, Attribute, COLLISION_API, CrateReader, DEFAULT_METERS_PER_UNIT, DefaultAssetResolver, Layer, MASS_API, MESH_COLLISION_API, PHYSICS_MATERIAL_API, ParseError, Prim, RIGID_BODY_API, Relationship, Stage, TokenizeError, buildKinematicTree, composeFile, composeLayer, computeLocalTransform, computeWorldTransform, crateToUsdaFile, createMemoryResolver, driveKindFor, extractRobotDescription, gatherGprimDescendants, gatherMeshDescendants, getJointAxis, getJointBodies, getJointDrive, getJointLimits, getJointLocalFrame, getJointStatePosition, getJointType, getMassProperties, getMaterialSubsets, hasArticulationRootAPI, hasCollisionAPI, hasRigidBodyAPI, isMesh, isNonVisualPurpose, isRenderableGprim, isScope, isSolidGprim, isXform, isZip, iterDescendants, joinPosix, jointValueFromSI, jointValueToSI, normalizeJointLimits, openUsdz, parseOpType, parseUsda, refineJointType, resolveBoundMaterial, serializeUsda, toBytes, tokenize };
|
|
3213
|
-
//# sourceMappingURL=chunk-
|
|
3214
|
-
//# sourceMappingURL=chunk-
|
|
3222
|
+
//# sourceMappingURL=chunk-2UD32EGU.js.map
|
|
3223
|
+
//# sourceMappingURL=chunk-2UD32EGU.js.map
|