@vizij/runtime-react 0.1.0 → 0.2.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 CHANGED
@@ -85,6 +85,7 @@ Wrap your app in a single `<OrchestratorProvider>` and give each `VizijRuntimePr
85
85
  - `rig`: optional. When omitted, the runtime looks for a `VIZIJ_bundle` extension inside the GLB and registers the first rig graph it finds.
86
86
  - `pose`: optional. Provide your own pose graph/config or just a `stageNeutralFilter`; bundled pose data is pulled from the GLB when present.
87
87
  - `animations`: optional array. Explicit entries merge with animations discovered in the GLB bundle (deduped by id). Use `playAnimation` to trigger them.
88
+ - `programs`: optional array. Explicit entries merge with bundled `motiongraph` programs (deduped by id). Use `playProgram` / `pauseProgram` / `stopProgram` to control them.
88
89
  - `initialInputs`: optional map of ValueJSON that seeds inputs before autostart.
89
90
  - `metadata`: free-form dictionary you can read back through `useVizijRuntime().assetBundle.metadata`.
90
91
  - `bundle`: optional. Supply pre-parsed bundle metadata when you manage world loading yourself. When loading from GLB/Blob the runtime fills this with the extracted `VizijBundleExtension`.
@@ -118,6 +119,7 @@ The provider exposes context via `useVizijRuntime()` once `loading` flips to `fa
118
119
  - `stagePoseNeutral(force)`: restore the neutral pose captured at export.
119
120
  - `animateValue(path, target, options)`, `cancelAnimation(path)`: tween rig values with built-in easing.
120
121
  - `playAnimation(id, options)`, `stopAnimation(id)`: drive bundle animations that were provided in `animations`.
122
+ - `playProgram(id)`, `pauseProgram(id)`, `stopProgram(id)`: drive bundled procedural programs discovered from `motiongraph` bundle entries or supplied via `programs`.
121
123
  - `step(dt)` / `advanceAnimations(dt)`: manually tick the orchestrator if you run outside `autostart`.
122
124
  - `useRigInput(path)`: returns `[value, setter]` for a single rig input. The setter writes through the orchestrator while the value mirrors the renderer store.
123
125
  - `useVizijOutputs(paths)`: subscribes to renderer output paths (`RawValue` map) for UI or logging.
@@ -143,13 +145,17 @@ Watch `onStatusChange` for realtime updates and implement retries or fallbacks i
143
145
 
144
146
  Animations are defined alongside rig inputs. Each track maps to an input path (`animation/<id>/<channel>`). When `playAnimation` runs, the runtime schedules frames and writes values back through the orchestrator merge strategy. Use `options.reset` to restart clips, `options.weight` to blend multiple clips, and `stopAnimation` to cut a clip immediately.
145
147
 
148
+ ## Working With Procedural Programs
149
+
150
+ Bundled procedural programs are discovered from `motiongraph` graph entries in the embedded `VIZIJ_bundle`. `playProgram(id)` registers the graph and lets it own any output paths it writes. `pauseProgram(id)` unregisters it without resetting its last written values. `stopProgram(id)` unregisters it and restores owned inputs to their default values when available.
151
+
146
152
  For ad-hoc gestures, use `animateValue` with duration/easing. If you need custom easing, pass a function `(t) => number`.
147
153
 
148
154
  ## Asset Bundling Workflow
149
155
 
150
- 1. Export an authoring scene to GLB with Vizij metadata intact (bounds, animatable ids). Enable “Embed Vizij bundle” in vizij-authoring to persist rig graphs, pose rig data, and animations inside the GLB.
151
- 2. Drop the GLB into a `VizijAssetBundle` and let the runtime extract rig/pose/animation data automatically.
152
- 3. Optionally override or extend bundle contents by setting `rig`, `pose`, or `animations` manually (useful for tooling builds or custom staging).
156
+ 1. Export an authoring scene to GLB with Vizij metadata intact (bounds, animatable ids). Enable “Embed Vizij bundle” in vizij-authoring to persist rig graphs, pose rig data, animations, and procedural programs inside the GLB.
157
+ 2. Drop the GLB into a `VizijAssetBundle` and let the runtime extract rig/pose/animation/program data automatically.
158
+ 3. Optionally override or extend bundle contents by setting `rig`, `pose`, `animations`, or `programs` manually (useful for tooling builds or custom staging).
153
159
  4. Host GLB URLs or include them via bundler asset imports (`new URL("./face.glb", import.meta.url).href`).
154
160
 
155
161
  The runtime tolerates incremental bundles; swap `assetBundle` props to hot-reload assets in dev builds.