@vizij/render 0.0.2 → 0.0.4
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 +12 -0
- package/dist/index.d.mts +114 -12
- package/dist/index.d.ts +114 -12
- package/dist/index.js +475 -466
- package/dist/index.mjs +336 -332
- package/package.json +4 -6
package/README.md
CHANGED
|
@@ -101,6 +101,18 @@ The store tracks world graph entries, controllers, debug overlays, and renderabl
|
|
|
101
101
|
|
|
102
102
|
All exports are re-exported through `src/index.tsx`, so a simple `import { loadGLTF } from "@vizij/render"` works.
|
|
103
103
|
|
|
104
|
+
### Dual-format Vizij bundles
|
|
105
|
+
|
|
106
|
+
Vizij scenes persist authoring metadata inside GLBs so third-party tools see baked animation, while Vizij runtimes retain orchestrator graphs and clips.
|
|
107
|
+
|
|
108
|
+
- Every renderable still carries a `RobotData` extension in `userData` describing features and animatable bindings.
|
|
109
|
+
- The exporter now writes a root-level `extensions.VIZIJ_bundle` block following the schema in [`src/types/vizij-bundle.ts`](./src/types/vizij-bundle.ts). It contains rig graphs, pose configs, stored Vizij clips, and provenance hashes.
|
|
110
|
+
- Use `exportScene(group, { bundle, animations })` to embed both the Vizij bundle and optional baked `THREE.AnimationClip` instances. The helper attaches the bundle only for the export call and restores the original object.
|
|
111
|
+
- When loading assets, prefer `loadGLTFWithBundle` / `loadGLTFFromBlobWithBundle` to retrieve `{ world, animatables, bundle }`. The legacy tuple helpers remain available if you do not need bundle metadata.
|
|
112
|
+
- `extractVizijBundle(scene)` and `applyVizijBundle(scene, bundle)` (under `src/functions/vizij-bundle.ts`) let advanced tooling inspect or mutate bundles without triggering a fresh export.
|
|
113
|
+
|
|
114
|
+
With this structure, authoring tools can round-trip orchestrator assets while shipping native glTF animations for viewers that do not understand Vizij.
|
|
115
|
+
|
|
104
116
|
---
|
|
105
117
|
|
|
106
118
|
## Development & Testing
|
package/dist/index.d.mts
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
1
2
|
import * as react from 'react';
|
|
2
3
|
import { ComponentProps, ReactNode, RefObject } from 'react';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { Canvas, ThreeEvent } from '@react-three/fiber';
|
|
5
5
|
import * as zustand from 'zustand';
|
|
6
6
|
import * as THREE from 'three';
|
|
7
|
-
import { Mesh, Group as Group$1, BufferGeometry, ShapeGeometry } from 'three';
|
|
7
|
+
import { Mesh, Group as Group$1, BufferGeometry, ShapeGeometry, AnimationClip, Object3D } from 'three';
|
|
8
8
|
import { RawValue, AnimatableValue, RawVector2 } from '@vizij/utils';
|
|
9
9
|
|
|
10
|
-
declare function InnerController({ animatableId, namespace, subfield, className, }: {
|
|
11
|
-
animatableId: string;
|
|
12
|
-
namespace?: string;
|
|
13
|
-
subfield?: string;
|
|
14
|
-
className?: string;
|
|
15
|
-
}): react_jsx_runtime.JSX.Element | undefined;
|
|
16
|
-
declare const Controller: react.MemoExoticComponent<typeof InnerController>;
|
|
17
|
-
|
|
18
10
|
interface VizijProps {
|
|
19
11
|
style?: React.CSSProperties;
|
|
20
12
|
className?: string;
|
|
@@ -282,6 +274,94 @@ interface Selection {
|
|
|
282
274
|
};
|
|
283
275
|
}
|
|
284
276
|
|
|
277
|
+
type VizijBundleVersion = 1;
|
|
278
|
+
type VizijBundleGraphKind = "rig" | "pose" | "pose-driver" | "animation-bridge" | "low-level" | string;
|
|
279
|
+
type VizijPoseId = string;
|
|
280
|
+
type VizijAnimationId = string;
|
|
281
|
+
type VizijGraphId = string;
|
|
282
|
+
interface VizijBundleGraphMetadata {
|
|
283
|
+
hash?: string;
|
|
284
|
+
source?: string;
|
|
285
|
+
kind?: VizijBundleGraphKind;
|
|
286
|
+
exportedAt?: string;
|
|
287
|
+
[key: string]: unknown;
|
|
288
|
+
}
|
|
289
|
+
interface VizijBundleGraphEntry {
|
|
290
|
+
id: VizijGraphId;
|
|
291
|
+
kind: VizijBundleGraphKind;
|
|
292
|
+
spec: Record<string, unknown>;
|
|
293
|
+
label?: string;
|
|
294
|
+
metadata?: VizijBundleGraphMetadata;
|
|
295
|
+
}
|
|
296
|
+
interface VizijPoseDefinition {
|
|
297
|
+
id: VizijPoseId;
|
|
298
|
+
name?: string;
|
|
299
|
+
description?: string;
|
|
300
|
+
values: Record<string, number | undefined>;
|
|
301
|
+
}
|
|
302
|
+
interface VizijPoseRigConfig {
|
|
303
|
+
version: number;
|
|
304
|
+
faceId?: string | null;
|
|
305
|
+
title?: string;
|
|
306
|
+
description?: string;
|
|
307
|
+
neutralInputs: Record<string, number>;
|
|
308
|
+
poses: VizijPoseDefinition[];
|
|
309
|
+
metadata?: Record<string, unknown>;
|
|
310
|
+
[key: string]: unknown;
|
|
311
|
+
}
|
|
312
|
+
interface VizijBundlePoseSection {
|
|
313
|
+
config: VizijPoseRigConfig;
|
|
314
|
+
metadata?: {
|
|
315
|
+
hash?: string;
|
|
316
|
+
exportedAt?: string;
|
|
317
|
+
[key: string]: unknown;
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
interface VizijBundleAnimationKeyframe {
|
|
321
|
+
time: number;
|
|
322
|
+
value: number;
|
|
323
|
+
easing?: "linear" | "easeIn" | "easeOut" | "easeInOut" | string;
|
|
324
|
+
inTangent?: number | null;
|
|
325
|
+
outTangent?: number | null;
|
|
326
|
+
[key: string]: unknown;
|
|
327
|
+
}
|
|
328
|
+
interface VizijBundleAnimationTrack {
|
|
329
|
+
channel: string;
|
|
330
|
+
keyframes: VizijBundleAnimationKeyframe[];
|
|
331
|
+
interpolation?: "step" | "linear" | "cubic" | string;
|
|
332
|
+
[key: string]: unknown;
|
|
333
|
+
}
|
|
334
|
+
interface VizijBundleAnimationClip {
|
|
335
|
+
id: VizijAnimationId;
|
|
336
|
+
name?: string;
|
|
337
|
+
duration?: number;
|
|
338
|
+
tracks: VizijBundleAnimationTrack[];
|
|
339
|
+
metadata?: Record<string, unknown>;
|
|
340
|
+
[key: string]: unknown;
|
|
341
|
+
}
|
|
342
|
+
interface VizijBundleAnimationEntry {
|
|
343
|
+
id: VizijAnimationId;
|
|
344
|
+
clip: VizijBundleAnimationClip;
|
|
345
|
+
metadata?: {
|
|
346
|
+
hash?: string;
|
|
347
|
+
sampleRateHz?: number;
|
|
348
|
+
rigGraphHash?: string;
|
|
349
|
+
poseGraphHash?: string | null;
|
|
350
|
+
bakedClipIndex?: number | null;
|
|
351
|
+
tolerance?: number;
|
|
352
|
+
exportedAt?: string;
|
|
353
|
+
[key: string]: unknown;
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
interface VizijBundleExtension {
|
|
357
|
+
version: VizijBundleVersion;
|
|
358
|
+
exportedAt?: string;
|
|
359
|
+
graphs?: VizijBundleGraphEntry[];
|
|
360
|
+
poses?: VizijBundlePoseSection | null;
|
|
361
|
+
animations?: VizijBundleAnimationEntry[];
|
|
362
|
+
metadata?: Record<string, unknown>;
|
|
363
|
+
}
|
|
364
|
+
|
|
285
365
|
interface VizijData {
|
|
286
366
|
world: World;
|
|
287
367
|
animatables: Record<string, AnimatableValue>;
|
|
@@ -442,6 +522,19 @@ declare function loadGLTFFromBlob(blob: Blob, namespaces: string[], aggressiveIm
|
|
|
442
522
|
center: RawVector2;
|
|
443
523
|
size: RawVector2;
|
|
444
524
|
}): Promise<[World, Record<string, AnimatableValue>]>;
|
|
525
|
+
type LoadedVizijAsset = {
|
|
526
|
+
world: World;
|
|
527
|
+
animatables: Record<string, AnimatableValue>;
|
|
528
|
+
bundle: VizijBundleExtension | null;
|
|
529
|
+
};
|
|
530
|
+
declare function loadGLTFWithBundle(url: string, namespaces: string[], aggressiveImport?: boolean, rootBounds?: {
|
|
531
|
+
center: RawVector2;
|
|
532
|
+
size: RawVector2;
|
|
533
|
+
}): Promise<LoadedVizijAsset>;
|
|
534
|
+
declare function loadGLTFFromBlobWithBundle(blob: Blob, namespaces: string[], aggressiveImport?: boolean, rootBounds?: {
|
|
535
|
+
center: RawVector2;
|
|
536
|
+
size: RawVector2;
|
|
537
|
+
}): Promise<LoadedVizijAsset>;
|
|
445
538
|
|
|
446
539
|
/**
|
|
447
540
|
* Loads a GLTF model from a Blob and returns the Three.js scene containing the model.
|
|
@@ -451,6 +544,15 @@ declare function loadGLTFFromBlob(blob: Blob, namespaces: string[], aggressiveIm
|
|
|
451
544
|
*/
|
|
452
545
|
declare const loadGltfFromBlob: (blob: Blob, namespaces: string[]) => Promise<[World, Record<string, AnimatableValue>]>;
|
|
453
546
|
|
|
454
|
-
|
|
547
|
+
type ExportSceneOptions = {
|
|
548
|
+
fileName?: string;
|
|
549
|
+
bundle?: VizijBundleExtension | null;
|
|
550
|
+
animations?: AnimationClip[];
|
|
551
|
+
binary?: boolean;
|
|
552
|
+
};
|
|
553
|
+
declare function exportScene(data: Group$1, fileNameOrOptions?: string | ExportSceneOptions): void;
|
|
554
|
+
|
|
555
|
+
declare function extractVizijBundle(object: Object3D, parserJson?: unknown): VizijBundleExtension | null;
|
|
556
|
+
declare function applyVizijBundle(object: Object3D, bundle: VizijBundleExtension | null): () => void;
|
|
455
557
|
|
|
456
|
-
export { type AnimatedFeature,
|
|
558
|
+
export { type AnimatedFeature, type Ellipse, type EllipseFeature, EmptyModelError, type ExportSceneOptions, type Feature, type Group, type GroupFeature, InnerVizij, type InnerVizijProps, type LoadedVizijAsset, type Rectangle, type RectangleFeature, type RenderableBase, type RenderableFeature, type Selection, type Shape, type ShapeFeature, ShapeMaterial, type StaticFeature, type Stored, type StoredAnimatedFeature, type StoredEllipse, type StoredFeatures, type StoredGroup, type StoredRectangle, type StoredRenderable, type StoredShape, Vizij, type VizijActions, type VizijAnimationId, type VizijBundleAnimationClip, type VizijBundleAnimationEntry, type VizijBundleAnimationKeyframe, type VizijBundleAnimationTrack, type VizijBundleExtension, type VizijBundleGraphEntry, type VizijBundleGraphKind, type VizijBundleGraphMetadata, type VizijBundlePoseSection, type VizijBundleVersion, VizijContext, type VizijData, type VizijGraphId, type VizijPoseDefinition, type VizijPoseId, type VizijPoseRigConfig, type VizijProps, VizijSlice, type VizijStore, type VizijStoreGetter, type VizijStoreSetter, type World, applyVizijBundle, createVizijStore, exportScene, extractVizijBundle, loadGLTF, loadGLTFFromBlob, loadGLTFFromBlobWithBundle, loadGLTFWithBundle, loadGltfFromBlob, useDefaultVizijStore, useFeatures, useVizijStore, useVizijStoreGetter, useVizijStoreSetter, useVizijStoreSubscription };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
1
2
|
import * as react from 'react';
|
|
2
3
|
import { ComponentProps, ReactNode, RefObject } from 'react';
|
|
3
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { Canvas, ThreeEvent } from '@react-three/fiber';
|
|
5
5
|
import * as zustand from 'zustand';
|
|
6
6
|
import * as THREE from 'three';
|
|
7
|
-
import { Mesh, Group as Group$1, BufferGeometry, ShapeGeometry } from 'three';
|
|
7
|
+
import { Mesh, Group as Group$1, BufferGeometry, ShapeGeometry, AnimationClip, Object3D } from 'three';
|
|
8
8
|
import { RawValue, AnimatableValue, RawVector2 } from '@vizij/utils';
|
|
9
9
|
|
|
10
|
-
declare function InnerController({ animatableId, namespace, subfield, className, }: {
|
|
11
|
-
animatableId: string;
|
|
12
|
-
namespace?: string;
|
|
13
|
-
subfield?: string;
|
|
14
|
-
className?: string;
|
|
15
|
-
}): react_jsx_runtime.JSX.Element | undefined;
|
|
16
|
-
declare const Controller: react.MemoExoticComponent<typeof InnerController>;
|
|
17
|
-
|
|
18
10
|
interface VizijProps {
|
|
19
11
|
style?: React.CSSProperties;
|
|
20
12
|
className?: string;
|
|
@@ -282,6 +274,94 @@ interface Selection {
|
|
|
282
274
|
};
|
|
283
275
|
}
|
|
284
276
|
|
|
277
|
+
type VizijBundleVersion = 1;
|
|
278
|
+
type VizijBundleGraphKind = "rig" | "pose" | "pose-driver" | "animation-bridge" | "low-level" | string;
|
|
279
|
+
type VizijPoseId = string;
|
|
280
|
+
type VizijAnimationId = string;
|
|
281
|
+
type VizijGraphId = string;
|
|
282
|
+
interface VizijBundleGraphMetadata {
|
|
283
|
+
hash?: string;
|
|
284
|
+
source?: string;
|
|
285
|
+
kind?: VizijBundleGraphKind;
|
|
286
|
+
exportedAt?: string;
|
|
287
|
+
[key: string]: unknown;
|
|
288
|
+
}
|
|
289
|
+
interface VizijBundleGraphEntry {
|
|
290
|
+
id: VizijGraphId;
|
|
291
|
+
kind: VizijBundleGraphKind;
|
|
292
|
+
spec: Record<string, unknown>;
|
|
293
|
+
label?: string;
|
|
294
|
+
metadata?: VizijBundleGraphMetadata;
|
|
295
|
+
}
|
|
296
|
+
interface VizijPoseDefinition {
|
|
297
|
+
id: VizijPoseId;
|
|
298
|
+
name?: string;
|
|
299
|
+
description?: string;
|
|
300
|
+
values: Record<string, number | undefined>;
|
|
301
|
+
}
|
|
302
|
+
interface VizijPoseRigConfig {
|
|
303
|
+
version: number;
|
|
304
|
+
faceId?: string | null;
|
|
305
|
+
title?: string;
|
|
306
|
+
description?: string;
|
|
307
|
+
neutralInputs: Record<string, number>;
|
|
308
|
+
poses: VizijPoseDefinition[];
|
|
309
|
+
metadata?: Record<string, unknown>;
|
|
310
|
+
[key: string]: unknown;
|
|
311
|
+
}
|
|
312
|
+
interface VizijBundlePoseSection {
|
|
313
|
+
config: VizijPoseRigConfig;
|
|
314
|
+
metadata?: {
|
|
315
|
+
hash?: string;
|
|
316
|
+
exportedAt?: string;
|
|
317
|
+
[key: string]: unknown;
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
interface VizijBundleAnimationKeyframe {
|
|
321
|
+
time: number;
|
|
322
|
+
value: number;
|
|
323
|
+
easing?: "linear" | "easeIn" | "easeOut" | "easeInOut" | string;
|
|
324
|
+
inTangent?: number | null;
|
|
325
|
+
outTangent?: number | null;
|
|
326
|
+
[key: string]: unknown;
|
|
327
|
+
}
|
|
328
|
+
interface VizijBundleAnimationTrack {
|
|
329
|
+
channel: string;
|
|
330
|
+
keyframes: VizijBundleAnimationKeyframe[];
|
|
331
|
+
interpolation?: "step" | "linear" | "cubic" | string;
|
|
332
|
+
[key: string]: unknown;
|
|
333
|
+
}
|
|
334
|
+
interface VizijBundleAnimationClip {
|
|
335
|
+
id: VizijAnimationId;
|
|
336
|
+
name?: string;
|
|
337
|
+
duration?: number;
|
|
338
|
+
tracks: VizijBundleAnimationTrack[];
|
|
339
|
+
metadata?: Record<string, unknown>;
|
|
340
|
+
[key: string]: unknown;
|
|
341
|
+
}
|
|
342
|
+
interface VizijBundleAnimationEntry {
|
|
343
|
+
id: VizijAnimationId;
|
|
344
|
+
clip: VizijBundleAnimationClip;
|
|
345
|
+
metadata?: {
|
|
346
|
+
hash?: string;
|
|
347
|
+
sampleRateHz?: number;
|
|
348
|
+
rigGraphHash?: string;
|
|
349
|
+
poseGraphHash?: string | null;
|
|
350
|
+
bakedClipIndex?: number | null;
|
|
351
|
+
tolerance?: number;
|
|
352
|
+
exportedAt?: string;
|
|
353
|
+
[key: string]: unknown;
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
interface VizijBundleExtension {
|
|
357
|
+
version: VizijBundleVersion;
|
|
358
|
+
exportedAt?: string;
|
|
359
|
+
graphs?: VizijBundleGraphEntry[];
|
|
360
|
+
poses?: VizijBundlePoseSection | null;
|
|
361
|
+
animations?: VizijBundleAnimationEntry[];
|
|
362
|
+
metadata?: Record<string, unknown>;
|
|
363
|
+
}
|
|
364
|
+
|
|
285
365
|
interface VizijData {
|
|
286
366
|
world: World;
|
|
287
367
|
animatables: Record<string, AnimatableValue>;
|
|
@@ -442,6 +522,19 @@ declare function loadGLTFFromBlob(blob: Blob, namespaces: string[], aggressiveIm
|
|
|
442
522
|
center: RawVector2;
|
|
443
523
|
size: RawVector2;
|
|
444
524
|
}): Promise<[World, Record<string, AnimatableValue>]>;
|
|
525
|
+
type LoadedVizijAsset = {
|
|
526
|
+
world: World;
|
|
527
|
+
animatables: Record<string, AnimatableValue>;
|
|
528
|
+
bundle: VizijBundleExtension | null;
|
|
529
|
+
};
|
|
530
|
+
declare function loadGLTFWithBundle(url: string, namespaces: string[], aggressiveImport?: boolean, rootBounds?: {
|
|
531
|
+
center: RawVector2;
|
|
532
|
+
size: RawVector2;
|
|
533
|
+
}): Promise<LoadedVizijAsset>;
|
|
534
|
+
declare function loadGLTFFromBlobWithBundle(blob: Blob, namespaces: string[], aggressiveImport?: boolean, rootBounds?: {
|
|
535
|
+
center: RawVector2;
|
|
536
|
+
size: RawVector2;
|
|
537
|
+
}): Promise<LoadedVizijAsset>;
|
|
445
538
|
|
|
446
539
|
/**
|
|
447
540
|
* Loads a GLTF model from a Blob and returns the Three.js scene containing the model.
|
|
@@ -451,6 +544,15 @@ declare function loadGLTFFromBlob(blob: Blob, namespaces: string[], aggressiveIm
|
|
|
451
544
|
*/
|
|
452
545
|
declare const loadGltfFromBlob: (blob: Blob, namespaces: string[]) => Promise<[World, Record<string, AnimatableValue>]>;
|
|
453
546
|
|
|
454
|
-
|
|
547
|
+
type ExportSceneOptions = {
|
|
548
|
+
fileName?: string;
|
|
549
|
+
bundle?: VizijBundleExtension | null;
|
|
550
|
+
animations?: AnimationClip[];
|
|
551
|
+
binary?: boolean;
|
|
552
|
+
};
|
|
553
|
+
declare function exportScene(data: Group$1, fileNameOrOptions?: string | ExportSceneOptions): void;
|
|
554
|
+
|
|
555
|
+
declare function extractVizijBundle(object: Object3D, parserJson?: unknown): VizijBundleExtension | null;
|
|
556
|
+
declare function applyVizijBundle(object: Object3D, bundle: VizijBundleExtension | null): () => void;
|
|
455
557
|
|
|
456
|
-
export { type AnimatedFeature,
|
|
558
|
+
export { type AnimatedFeature, type Ellipse, type EllipseFeature, EmptyModelError, type ExportSceneOptions, type Feature, type Group, type GroupFeature, InnerVizij, type InnerVizijProps, type LoadedVizijAsset, type Rectangle, type RectangleFeature, type RenderableBase, type RenderableFeature, type Selection, type Shape, type ShapeFeature, ShapeMaterial, type StaticFeature, type Stored, type StoredAnimatedFeature, type StoredEllipse, type StoredFeatures, type StoredGroup, type StoredRectangle, type StoredRenderable, type StoredShape, Vizij, type VizijActions, type VizijAnimationId, type VizijBundleAnimationClip, type VizijBundleAnimationEntry, type VizijBundleAnimationKeyframe, type VizijBundleAnimationTrack, type VizijBundleExtension, type VizijBundleGraphEntry, type VizijBundleGraphKind, type VizijBundleGraphMetadata, type VizijBundlePoseSection, type VizijBundleVersion, VizijContext, type VizijData, type VizijGraphId, type VizijPoseDefinition, type VizijPoseId, type VizijPoseRigConfig, type VizijProps, VizijSlice, type VizijStore, type VizijStoreGetter, type VizijStoreSetter, type World, applyVizijBundle, createVizijStore, exportScene, extractVizijBundle, loadGLTF, loadGLTFFromBlob, loadGLTFFromBlobWithBundle, loadGLTFWithBundle, loadGltfFromBlob, useDefaultVizijStore, useFeatures, useVizijStore, useVizijStoreGetter, useVizijStoreSetter, useVizijStoreSubscription };
|