@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 +9 -3
- package/dist/index.cjs +2432 -184
- package/dist/index.d.cts +142 -7
- package/dist/index.d.ts +142 -7
- package/dist/index.js +2411 -182
- package/package.json +7 -5
package/dist/index.d.cts
CHANGED
|
@@ -11,17 +11,31 @@ type PoseDefinition = {
|
|
|
11
11
|
name?: string;
|
|
12
12
|
description?: string;
|
|
13
13
|
group?: string | null;
|
|
14
|
+
groupId?: string | null;
|
|
15
|
+
groupIds?: string[];
|
|
14
16
|
values: Record<string, number | undefined>;
|
|
15
17
|
};
|
|
18
|
+
type PoseBlendMode = "average" | "additive";
|
|
19
|
+
type PoseGroupDefinition = {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
path: string;
|
|
23
|
+
blendMode?: PoseBlendMode;
|
|
24
|
+
};
|
|
16
25
|
type PoseRigConfig = {
|
|
17
26
|
version: number;
|
|
18
27
|
faceId?: string | null;
|
|
19
28
|
title?: string;
|
|
20
29
|
description?: string;
|
|
30
|
+
poseGroups?: PoseGroupDefinition[];
|
|
31
|
+
crossGroupBlendMode?: PoseBlendMode;
|
|
21
32
|
neutralInputs: Record<string, number>;
|
|
22
33
|
poses: PoseDefinition[];
|
|
23
|
-
metadata?: Record<string, unknown
|
|
24
|
-
|
|
34
|
+
metadata?: Record<string, unknown> | {
|
|
35
|
+
createdAt: string;
|
|
36
|
+
updatedAt: string;
|
|
37
|
+
author?: string;
|
|
38
|
+
};
|
|
25
39
|
};
|
|
26
40
|
type RootBounds = {
|
|
27
41
|
center: {
|
|
@@ -45,8 +59,8 @@ type VizijGlbAsset = {
|
|
|
45
59
|
rootBounds?: RootBounds;
|
|
46
60
|
} | {
|
|
47
61
|
kind: "world";
|
|
48
|
-
world: World
|
|
49
|
-
animatables: Record<string, AnimatableValue>;
|
|
62
|
+
world: World | Record<string, unknown>;
|
|
63
|
+
animatables: Record<string, AnimatableValue> | Record<string, unknown>;
|
|
50
64
|
bundle?: VizijBundleExtension | null;
|
|
51
65
|
};
|
|
52
66
|
type VizijGraphAsset = {
|
|
@@ -72,10 +86,15 @@ type VizijInputMetadata = {
|
|
|
72
86
|
type AnimationKeyframeLike = {
|
|
73
87
|
time?: number;
|
|
74
88
|
value?: number;
|
|
89
|
+
inTangent?: number | null;
|
|
90
|
+
outTangent?: number | null;
|
|
91
|
+
[key: string]: unknown;
|
|
75
92
|
};
|
|
76
93
|
type AnimationTrackLike = {
|
|
77
94
|
channel: string;
|
|
78
95
|
keyframes?: AnimationKeyframeLike[];
|
|
96
|
+
interpolation?: "linear" | "step" | "cubic" | string;
|
|
97
|
+
[key: string]: unknown;
|
|
79
98
|
};
|
|
80
99
|
type AnimationClipLike = {
|
|
81
100
|
id?: string;
|
|
@@ -90,6 +109,13 @@ type VizijAnimationAsset = {
|
|
|
90
109
|
setup?: Partial<AnimationSetup>;
|
|
91
110
|
weight?: number;
|
|
92
111
|
};
|
|
112
|
+
type VizijProgramAsset = {
|
|
113
|
+
id: string;
|
|
114
|
+
label?: string;
|
|
115
|
+
graph: VizijGraphAsset;
|
|
116
|
+
resetValues?: Record<string, number>;
|
|
117
|
+
metadata?: Record<string, unknown>;
|
|
118
|
+
};
|
|
93
119
|
type VizijAssetBundle = {
|
|
94
120
|
namespace?: string;
|
|
95
121
|
faceId?: string;
|
|
@@ -101,6 +127,7 @@ type VizijAssetBundle = {
|
|
|
101
127
|
stageNeutralFilter?: (id: string, path: string) => boolean;
|
|
102
128
|
};
|
|
103
129
|
animations?: VizijAnimationAsset[];
|
|
130
|
+
programs?: VizijProgramAsset[];
|
|
104
131
|
initialInputs?: Record<string, ValueJSON>;
|
|
105
132
|
metadata?: Record<string, unknown>;
|
|
106
133
|
bundle?: VizijBundleExtension | null;
|
|
@@ -139,6 +166,22 @@ type PlayAnimationOptions = {
|
|
|
139
166
|
speed?: number;
|
|
140
167
|
reset?: boolean;
|
|
141
168
|
};
|
|
169
|
+
type StopAnimationOptions = {
|
|
170
|
+
clearOutputs?: boolean;
|
|
171
|
+
};
|
|
172
|
+
type AnimationPlaybackState = {
|
|
173
|
+
time: number;
|
|
174
|
+
duration: number;
|
|
175
|
+
playing: boolean;
|
|
176
|
+
loop: boolean;
|
|
177
|
+
speed: number;
|
|
178
|
+
};
|
|
179
|
+
type StopProgramOptions = {
|
|
180
|
+
resetOutputs?: boolean;
|
|
181
|
+
};
|
|
182
|
+
type ProgramPlaybackState = {
|
|
183
|
+
state: "playing" | "paused" | "stopped";
|
|
184
|
+
};
|
|
142
185
|
type InputDriverLifecycle = {
|
|
143
186
|
start: () => void;
|
|
144
187
|
stop: () => void;
|
|
@@ -151,19 +194,38 @@ type InputDriverContext = {
|
|
|
151
194
|
faceId?: string;
|
|
152
195
|
};
|
|
153
196
|
type InputDriverFactory = (ctx: InputDriverContext) => InputDriverLifecycle;
|
|
197
|
+
type RuntimeOutputWrite = {
|
|
198
|
+
id: string;
|
|
199
|
+
namespace: string;
|
|
200
|
+
value: RawValue;
|
|
201
|
+
currentValue?: RawValue;
|
|
202
|
+
};
|
|
154
203
|
type VizijRuntimeFaceProps = Omit<VizijProps, "rootId" | "namespace"> & {
|
|
155
204
|
namespaceOverride?: string;
|
|
156
205
|
};
|
|
157
206
|
type VizijRuntimeContextValue = VizijRuntimeStatus & {
|
|
158
207
|
assetBundle: VizijAssetBundle;
|
|
159
208
|
setInput: (path: string, value: ValueJSON, shape?: ShapeJSON) => void;
|
|
209
|
+
setGraphBundle: (bundle: RuntimeGraphBundle, options?: {
|
|
210
|
+
tier?: "auto" | "assets" | "graphs";
|
|
211
|
+
}) => void;
|
|
160
212
|
setValue: (id: string, namespace: string, value: RawValue | ((prev: RawValue | undefined) => RawValue | undefined)) => void;
|
|
161
213
|
stagePoseNeutral: (force?: boolean) => void;
|
|
162
214
|
animateValue: (path: string, target: ValueJSON, options?: AnimateValueOptions) => Promise<void>;
|
|
163
215
|
cancelAnimation: (path: string) => void;
|
|
164
216
|
registerInputDriver: (id: string, factory: InputDriverFactory) => InputDriverLifecycle;
|
|
165
217
|
playAnimation: (id: string, options?: PlayAnimationOptions) => Promise<void>;
|
|
166
|
-
|
|
218
|
+
pauseAnimation: (id: string) => void;
|
|
219
|
+
seekAnimation: (id: string, timeSeconds: number) => void;
|
|
220
|
+
setAnimationLoop: (id: string, enabled: boolean) => void;
|
|
221
|
+
getAnimationState: (id: string) => AnimationPlaybackState | null;
|
|
222
|
+
stopAnimation: (id: string, options?: StopAnimationOptions) => void;
|
|
223
|
+
playProgram: (id: string) => void;
|
|
224
|
+
pauseProgram: (id: string) => void;
|
|
225
|
+
stopProgram: (id: string, options?: StopProgramOptions) => void;
|
|
226
|
+
getProgramState: (id: string) => ProgramPlaybackState | null;
|
|
227
|
+
setAnimationActive: (active: boolean) => void;
|
|
228
|
+
isAnimationActive: () => boolean;
|
|
167
229
|
step: (dt: number, opts?: {
|
|
168
230
|
forceRuntime?: boolean;
|
|
169
231
|
}) => void;
|
|
@@ -179,6 +241,7 @@ type VizijRuntimeProviderProps = {
|
|
|
179
241
|
children: ReactNode;
|
|
180
242
|
namespace?: string;
|
|
181
243
|
faceId?: string;
|
|
244
|
+
updateTier?: RuntimeUpdateTier;
|
|
182
245
|
autoCreate?: boolean;
|
|
183
246
|
createOptions?: CreateOrchOptions;
|
|
184
247
|
autostart?: boolean;
|
|
@@ -189,19 +252,91 @@ type VizijRuntimeProviderProps = {
|
|
|
189
252
|
anims: string[];
|
|
190
253
|
}) => void;
|
|
191
254
|
onStatusChange?: (status: VizijRuntimeStatus) => void;
|
|
255
|
+
transformOutputWrite?: (write: RuntimeOutputWrite) => RuntimeOutputWrite | null;
|
|
192
256
|
orchestratorScope?: "auto" | "shared" | "isolated";
|
|
193
257
|
};
|
|
258
|
+
type RuntimeUpdateTier = "auto" | "assets" | "graphs";
|
|
259
|
+
type RuntimeUpdatePlan = {
|
|
260
|
+
reloadAssets: boolean;
|
|
261
|
+
reregisterGraphs: boolean;
|
|
262
|
+
};
|
|
263
|
+
type RuntimeGraphBundle = {
|
|
264
|
+
rig?: VizijGraphAsset;
|
|
265
|
+
pose?: VizijAssetBundle["pose"];
|
|
266
|
+
animations?: VizijAnimationAsset[];
|
|
267
|
+
programs?: VizijProgramAsset[];
|
|
268
|
+
};
|
|
194
269
|
|
|
195
270
|
type ProviderProps = PropsWithChildren<VizijRuntimeProviderProps>;
|
|
196
|
-
declare function VizijRuntimeProvider({ assetBundle, children, namespace: namespaceProp, faceId: faceIdProp, autoCreate, createOptions, autostart, driveOrchestrator, mergeStrategy, onRegisterControllers, onStatusChange, orchestratorScope, }: ProviderProps): react_jsx_runtime.JSX.Element;
|
|
271
|
+
declare function VizijRuntimeProvider({ assetBundle, children, namespace: namespaceProp, faceId: faceIdProp, updateTier, autoCreate, createOptions, autostart, driveOrchestrator, mergeStrategy, onRegisterControllers, onStatusChange, transformOutputWrite, orchestratorScope, }: ProviderProps): react_jsx_runtime.JSX.Element;
|
|
197
272
|
|
|
198
273
|
declare function VizijRuntimeFaceInner({ namespaceOverride, ...props }: VizijRuntimeFaceProps): react_jsx_runtime.JSX.Element | null;
|
|
199
274
|
declare const VizijRuntimeFace: react.MemoExoticComponent<typeof VizijRuntimeFaceInner>;
|
|
200
275
|
|
|
201
276
|
declare function useVizijRuntime(): VizijRuntimeContextValue;
|
|
202
277
|
|
|
278
|
+
declare function useOptionalVizijRuntime(): VizijRuntimeContextValue | null;
|
|
279
|
+
|
|
203
280
|
declare function useVizijOutputs(paths: string[]): Record<string, RawValue | undefined>;
|
|
204
281
|
|
|
205
282
|
declare function useRigInput(path: string): [RawValue | undefined, (value: ValueJSON, shape?: ShapeJSON) => void];
|
|
206
283
|
|
|
207
|
-
|
|
284
|
+
declare function resolveRuntimeUpdatePlan(previous: VizijAssetBundle | null, next: VizijAssetBundle, tier: RuntimeUpdateTier): RuntimeUpdatePlan;
|
|
285
|
+
|
|
286
|
+
declare const POSE_WEIGHT_INPUT_PATH_PREFIX = "/poses/";
|
|
287
|
+
declare const VISEME_POSE_KEYS: readonly ["a", "at", "b", "e", "e_2", "f", "i", "k", "m", "o", "o_2", "p", "r", "s", "t", "t_2", "u"];
|
|
288
|
+
declare const EXPRESSIVE_EMOTION_POSE_KEYS: readonly ["concerned", "happy", "sad", "sleepy", "surprise"];
|
|
289
|
+
declare const EMOTION_POSE_KEYS: readonly ["concerned", "happy", "neutral", "sad", "sleepy", "surprise", "angry"];
|
|
290
|
+
type PoseSemanticKind = "emotion" | "viseme" | "other";
|
|
291
|
+
declare function buildRigInputPath(faceId: string, path: string): string;
|
|
292
|
+
declare function buildPoseWeightInputPathSegment(poseId: string | null | undefined): string;
|
|
293
|
+
declare function buildPoseWeightRelativePath(poseId: string | null | undefined): string;
|
|
294
|
+
declare function buildPoseWeightPathMap(poses: PoseDefinition[], faceId: string | null | undefined): Map<string, string>;
|
|
295
|
+
declare function normalizePoseSemanticKey(value: string | null | undefined): string | null;
|
|
296
|
+
declare function getPoseSemanticKey(pose: Pick<PoseDefinition, "id" | "name">): string | null;
|
|
297
|
+
declare function resolvePoseMembership(pose: Pick<PoseDefinition, "group" | "groupId" | "groupIds">, groups: PoseGroupDefinition[] | undefined): {
|
|
298
|
+
groupIds: string[];
|
|
299
|
+
primaryGroupId: string | null;
|
|
300
|
+
primaryGroupPath: string | null;
|
|
301
|
+
groupPathsById: Record<string, string>;
|
|
302
|
+
};
|
|
303
|
+
declare function resolvePoseSemantics(pose: Pick<PoseDefinition, "id" | "name" | "group" | "groupId" | "groupIds">, groups: PoseGroupDefinition[] | undefined): {
|
|
304
|
+
key: string | null;
|
|
305
|
+
kind: PoseSemanticKind;
|
|
306
|
+
membership: ReturnType<typeof resolvePoseMembership>;
|
|
307
|
+
};
|
|
308
|
+
declare function filterPosesBySemanticKind(poses: PoseDefinition[], groups: PoseGroupDefinition[] | undefined, kind: PoseSemanticKind): PoseDefinition[];
|
|
309
|
+
declare function buildSemanticPoseWeightPathMap(poses: PoseDefinition[], groups: PoseGroupDefinition[] | undefined, faceId: string | null | undefined, kind: Exclude<PoseSemanticKind, "other">): Map<string, string>;
|
|
310
|
+
|
|
311
|
+
type InputConstraint = {
|
|
312
|
+
min?: number;
|
|
313
|
+
max?: number;
|
|
314
|
+
defaultValue?: number;
|
|
315
|
+
};
|
|
316
|
+
type FaceScalarControl = {
|
|
317
|
+
path: string;
|
|
318
|
+
min: number;
|
|
319
|
+
max: number;
|
|
320
|
+
defaultValue: number;
|
|
321
|
+
};
|
|
322
|
+
type ResolvedFaceControls = {
|
|
323
|
+
faceId: string;
|
|
324
|
+
gazeSource: "standard-vizij" | "standard" | "propsrig" | "coupled-gaze" | "none";
|
|
325
|
+
blinkSource: "lids" | "blink" | "none";
|
|
326
|
+
eyes: {
|
|
327
|
+
leftX: FaceScalarControl | null;
|
|
328
|
+
leftY: FaceScalarControl | null;
|
|
329
|
+
rightX: FaceScalarControl | null;
|
|
330
|
+
rightY: FaceScalarControl | null;
|
|
331
|
+
};
|
|
332
|
+
eyelids: {
|
|
333
|
+
leftUpper: FaceScalarControl | null;
|
|
334
|
+
rightUpper: FaceScalarControl | null;
|
|
335
|
+
};
|
|
336
|
+
blink: FaceScalarControl | null;
|
|
337
|
+
};
|
|
338
|
+
declare function resolveFaceControls(assetBundle: VizijAssetBundle, runtimeFaceId?: string | null, inputConstraints?: Record<string, InputConstraint>): ResolvedFaceControls;
|
|
339
|
+
declare function mapNormalizedControlValue(control: FaceScalarControl, normalizedValue: number): number;
|
|
340
|
+
declare function mapUnitControlValue(control: FaceScalarControl, unitValue: number): number;
|
|
341
|
+
|
|
342
|
+
export { type AnimateValueOptions, type AnimationClipLike, type AnimationKeyframeLike, type AnimationPlaybackState, type AnimationTrackLike, EMOTION_POSE_KEYS, EXPRESSIVE_EMOTION_POSE_KEYS, type FaceScalarControl, type InputDriverContext, type InputDriverFactory, type InputDriverLifecycle, POSE_WEIGHT_INPUT_PATH_PREFIX, type PlayAnimationOptions, type PoseDefinition, type PoseGroupDefinition, type PoseRigConfig, type ProgramPlaybackState, type RootBounds, type RuntimeGraphBundle, type RuntimeOutputWrite, type RuntimeUpdatePlan, type RuntimeUpdateTier, type StopProgramOptions, VISEME_POSE_KEYS, type VizijAnimationAsset, type VizijAssetBundle, type VizijGlbAsset, type VizijGraphAsset, type VizijProgramAsset, VizijRuntimeFace, type VizijRuntimeFaceProps, VizijRuntimeProvider, type VizijRuntimeProviderProps, type VizijRuntimeStatus, buildPoseWeightInputPathSegment, buildPoseWeightPathMap, buildPoseWeightRelativePath, buildRigInputPath, buildSemanticPoseWeightPathMap, filterPosesBySemanticKind, getPoseSemanticKey, mapNormalizedControlValue, mapUnitControlValue, normalizePoseSemanticKey, resolveFaceControls, resolvePoseMembership, resolvePoseSemantics, resolveRuntimeUpdatePlan, useOptionalVizijRuntime, useRigInput, useVizijOutputs, useVizijRuntime };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,17 +11,31 @@ type PoseDefinition = {
|
|
|
11
11
|
name?: string;
|
|
12
12
|
description?: string;
|
|
13
13
|
group?: string | null;
|
|
14
|
+
groupId?: string | null;
|
|
15
|
+
groupIds?: string[];
|
|
14
16
|
values: Record<string, number | undefined>;
|
|
15
17
|
};
|
|
18
|
+
type PoseBlendMode = "average" | "additive";
|
|
19
|
+
type PoseGroupDefinition = {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
path: string;
|
|
23
|
+
blendMode?: PoseBlendMode;
|
|
24
|
+
};
|
|
16
25
|
type PoseRigConfig = {
|
|
17
26
|
version: number;
|
|
18
27
|
faceId?: string | null;
|
|
19
28
|
title?: string;
|
|
20
29
|
description?: string;
|
|
30
|
+
poseGroups?: PoseGroupDefinition[];
|
|
31
|
+
crossGroupBlendMode?: PoseBlendMode;
|
|
21
32
|
neutralInputs: Record<string, number>;
|
|
22
33
|
poses: PoseDefinition[];
|
|
23
|
-
metadata?: Record<string, unknown
|
|
24
|
-
|
|
34
|
+
metadata?: Record<string, unknown> | {
|
|
35
|
+
createdAt: string;
|
|
36
|
+
updatedAt: string;
|
|
37
|
+
author?: string;
|
|
38
|
+
};
|
|
25
39
|
};
|
|
26
40
|
type RootBounds = {
|
|
27
41
|
center: {
|
|
@@ -45,8 +59,8 @@ type VizijGlbAsset = {
|
|
|
45
59
|
rootBounds?: RootBounds;
|
|
46
60
|
} | {
|
|
47
61
|
kind: "world";
|
|
48
|
-
world: World
|
|
49
|
-
animatables: Record<string, AnimatableValue>;
|
|
62
|
+
world: World | Record<string, unknown>;
|
|
63
|
+
animatables: Record<string, AnimatableValue> | Record<string, unknown>;
|
|
50
64
|
bundle?: VizijBundleExtension | null;
|
|
51
65
|
};
|
|
52
66
|
type VizijGraphAsset = {
|
|
@@ -72,10 +86,15 @@ type VizijInputMetadata = {
|
|
|
72
86
|
type AnimationKeyframeLike = {
|
|
73
87
|
time?: number;
|
|
74
88
|
value?: number;
|
|
89
|
+
inTangent?: number | null;
|
|
90
|
+
outTangent?: number | null;
|
|
91
|
+
[key: string]: unknown;
|
|
75
92
|
};
|
|
76
93
|
type AnimationTrackLike = {
|
|
77
94
|
channel: string;
|
|
78
95
|
keyframes?: AnimationKeyframeLike[];
|
|
96
|
+
interpolation?: "linear" | "step" | "cubic" | string;
|
|
97
|
+
[key: string]: unknown;
|
|
79
98
|
};
|
|
80
99
|
type AnimationClipLike = {
|
|
81
100
|
id?: string;
|
|
@@ -90,6 +109,13 @@ type VizijAnimationAsset = {
|
|
|
90
109
|
setup?: Partial<AnimationSetup>;
|
|
91
110
|
weight?: number;
|
|
92
111
|
};
|
|
112
|
+
type VizijProgramAsset = {
|
|
113
|
+
id: string;
|
|
114
|
+
label?: string;
|
|
115
|
+
graph: VizijGraphAsset;
|
|
116
|
+
resetValues?: Record<string, number>;
|
|
117
|
+
metadata?: Record<string, unknown>;
|
|
118
|
+
};
|
|
93
119
|
type VizijAssetBundle = {
|
|
94
120
|
namespace?: string;
|
|
95
121
|
faceId?: string;
|
|
@@ -101,6 +127,7 @@ type VizijAssetBundle = {
|
|
|
101
127
|
stageNeutralFilter?: (id: string, path: string) => boolean;
|
|
102
128
|
};
|
|
103
129
|
animations?: VizijAnimationAsset[];
|
|
130
|
+
programs?: VizijProgramAsset[];
|
|
104
131
|
initialInputs?: Record<string, ValueJSON>;
|
|
105
132
|
metadata?: Record<string, unknown>;
|
|
106
133
|
bundle?: VizijBundleExtension | null;
|
|
@@ -139,6 +166,22 @@ type PlayAnimationOptions = {
|
|
|
139
166
|
speed?: number;
|
|
140
167
|
reset?: boolean;
|
|
141
168
|
};
|
|
169
|
+
type StopAnimationOptions = {
|
|
170
|
+
clearOutputs?: boolean;
|
|
171
|
+
};
|
|
172
|
+
type AnimationPlaybackState = {
|
|
173
|
+
time: number;
|
|
174
|
+
duration: number;
|
|
175
|
+
playing: boolean;
|
|
176
|
+
loop: boolean;
|
|
177
|
+
speed: number;
|
|
178
|
+
};
|
|
179
|
+
type StopProgramOptions = {
|
|
180
|
+
resetOutputs?: boolean;
|
|
181
|
+
};
|
|
182
|
+
type ProgramPlaybackState = {
|
|
183
|
+
state: "playing" | "paused" | "stopped";
|
|
184
|
+
};
|
|
142
185
|
type InputDriverLifecycle = {
|
|
143
186
|
start: () => void;
|
|
144
187
|
stop: () => void;
|
|
@@ -151,19 +194,38 @@ type InputDriverContext = {
|
|
|
151
194
|
faceId?: string;
|
|
152
195
|
};
|
|
153
196
|
type InputDriverFactory = (ctx: InputDriverContext) => InputDriverLifecycle;
|
|
197
|
+
type RuntimeOutputWrite = {
|
|
198
|
+
id: string;
|
|
199
|
+
namespace: string;
|
|
200
|
+
value: RawValue;
|
|
201
|
+
currentValue?: RawValue;
|
|
202
|
+
};
|
|
154
203
|
type VizijRuntimeFaceProps = Omit<VizijProps, "rootId" | "namespace"> & {
|
|
155
204
|
namespaceOverride?: string;
|
|
156
205
|
};
|
|
157
206
|
type VizijRuntimeContextValue = VizijRuntimeStatus & {
|
|
158
207
|
assetBundle: VizijAssetBundle;
|
|
159
208
|
setInput: (path: string, value: ValueJSON, shape?: ShapeJSON) => void;
|
|
209
|
+
setGraphBundle: (bundle: RuntimeGraphBundle, options?: {
|
|
210
|
+
tier?: "auto" | "assets" | "graphs";
|
|
211
|
+
}) => void;
|
|
160
212
|
setValue: (id: string, namespace: string, value: RawValue | ((prev: RawValue | undefined) => RawValue | undefined)) => void;
|
|
161
213
|
stagePoseNeutral: (force?: boolean) => void;
|
|
162
214
|
animateValue: (path: string, target: ValueJSON, options?: AnimateValueOptions) => Promise<void>;
|
|
163
215
|
cancelAnimation: (path: string) => void;
|
|
164
216
|
registerInputDriver: (id: string, factory: InputDriverFactory) => InputDriverLifecycle;
|
|
165
217
|
playAnimation: (id: string, options?: PlayAnimationOptions) => Promise<void>;
|
|
166
|
-
|
|
218
|
+
pauseAnimation: (id: string) => void;
|
|
219
|
+
seekAnimation: (id: string, timeSeconds: number) => void;
|
|
220
|
+
setAnimationLoop: (id: string, enabled: boolean) => void;
|
|
221
|
+
getAnimationState: (id: string) => AnimationPlaybackState | null;
|
|
222
|
+
stopAnimation: (id: string, options?: StopAnimationOptions) => void;
|
|
223
|
+
playProgram: (id: string) => void;
|
|
224
|
+
pauseProgram: (id: string) => void;
|
|
225
|
+
stopProgram: (id: string, options?: StopProgramOptions) => void;
|
|
226
|
+
getProgramState: (id: string) => ProgramPlaybackState | null;
|
|
227
|
+
setAnimationActive: (active: boolean) => void;
|
|
228
|
+
isAnimationActive: () => boolean;
|
|
167
229
|
step: (dt: number, opts?: {
|
|
168
230
|
forceRuntime?: boolean;
|
|
169
231
|
}) => void;
|
|
@@ -179,6 +241,7 @@ type VizijRuntimeProviderProps = {
|
|
|
179
241
|
children: ReactNode;
|
|
180
242
|
namespace?: string;
|
|
181
243
|
faceId?: string;
|
|
244
|
+
updateTier?: RuntimeUpdateTier;
|
|
182
245
|
autoCreate?: boolean;
|
|
183
246
|
createOptions?: CreateOrchOptions;
|
|
184
247
|
autostart?: boolean;
|
|
@@ -189,19 +252,91 @@ type VizijRuntimeProviderProps = {
|
|
|
189
252
|
anims: string[];
|
|
190
253
|
}) => void;
|
|
191
254
|
onStatusChange?: (status: VizijRuntimeStatus) => void;
|
|
255
|
+
transformOutputWrite?: (write: RuntimeOutputWrite) => RuntimeOutputWrite | null;
|
|
192
256
|
orchestratorScope?: "auto" | "shared" | "isolated";
|
|
193
257
|
};
|
|
258
|
+
type RuntimeUpdateTier = "auto" | "assets" | "graphs";
|
|
259
|
+
type RuntimeUpdatePlan = {
|
|
260
|
+
reloadAssets: boolean;
|
|
261
|
+
reregisterGraphs: boolean;
|
|
262
|
+
};
|
|
263
|
+
type RuntimeGraphBundle = {
|
|
264
|
+
rig?: VizijGraphAsset;
|
|
265
|
+
pose?: VizijAssetBundle["pose"];
|
|
266
|
+
animations?: VizijAnimationAsset[];
|
|
267
|
+
programs?: VizijProgramAsset[];
|
|
268
|
+
};
|
|
194
269
|
|
|
195
270
|
type ProviderProps = PropsWithChildren<VizijRuntimeProviderProps>;
|
|
196
|
-
declare function VizijRuntimeProvider({ assetBundle, children, namespace: namespaceProp, faceId: faceIdProp, autoCreate, createOptions, autostart, driveOrchestrator, mergeStrategy, onRegisterControllers, onStatusChange, orchestratorScope, }: ProviderProps): react_jsx_runtime.JSX.Element;
|
|
271
|
+
declare function VizijRuntimeProvider({ assetBundle, children, namespace: namespaceProp, faceId: faceIdProp, updateTier, autoCreate, createOptions, autostart, driveOrchestrator, mergeStrategy, onRegisterControllers, onStatusChange, transformOutputWrite, orchestratorScope, }: ProviderProps): react_jsx_runtime.JSX.Element;
|
|
197
272
|
|
|
198
273
|
declare function VizijRuntimeFaceInner({ namespaceOverride, ...props }: VizijRuntimeFaceProps): react_jsx_runtime.JSX.Element | null;
|
|
199
274
|
declare const VizijRuntimeFace: react.MemoExoticComponent<typeof VizijRuntimeFaceInner>;
|
|
200
275
|
|
|
201
276
|
declare function useVizijRuntime(): VizijRuntimeContextValue;
|
|
202
277
|
|
|
278
|
+
declare function useOptionalVizijRuntime(): VizijRuntimeContextValue | null;
|
|
279
|
+
|
|
203
280
|
declare function useVizijOutputs(paths: string[]): Record<string, RawValue | undefined>;
|
|
204
281
|
|
|
205
282
|
declare function useRigInput(path: string): [RawValue | undefined, (value: ValueJSON, shape?: ShapeJSON) => void];
|
|
206
283
|
|
|
207
|
-
|
|
284
|
+
declare function resolveRuntimeUpdatePlan(previous: VizijAssetBundle | null, next: VizijAssetBundle, tier: RuntimeUpdateTier): RuntimeUpdatePlan;
|
|
285
|
+
|
|
286
|
+
declare const POSE_WEIGHT_INPUT_PATH_PREFIX = "/poses/";
|
|
287
|
+
declare const VISEME_POSE_KEYS: readonly ["a", "at", "b", "e", "e_2", "f", "i", "k", "m", "o", "o_2", "p", "r", "s", "t", "t_2", "u"];
|
|
288
|
+
declare const EXPRESSIVE_EMOTION_POSE_KEYS: readonly ["concerned", "happy", "sad", "sleepy", "surprise"];
|
|
289
|
+
declare const EMOTION_POSE_KEYS: readonly ["concerned", "happy", "neutral", "sad", "sleepy", "surprise", "angry"];
|
|
290
|
+
type PoseSemanticKind = "emotion" | "viseme" | "other";
|
|
291
|
+
declare function buildRigInputPath(faceId: string, path: string): string;
|
|
292
|
+
declare function buildPoseWeightInputPathSegment(poseId: string | null | undefined): string;
|
|
293
|
+
declare function buildPoseWeightRelativePath(poseId: string | null | undefined): string;
|
|
294
|
+
declare function buildPoseWeightPathMap(poses: PoseDefinition[], faceId: string | null | undefined): Map<string, string>;
|
|
295
|
+
declare function normalizePoseSemanticKey(value: string | null | undefined): string | null;
|
|
296
|
+
declare function getPoseSemanticKey(pose: Pick<PoseDefinition, "id" | "name">): string | null;
|
|
297
|
+
declare function resolvePoseMembership(pose: Pick<PoseDefinition, "group" | "groupId" | "groupIds">, groups: PoseGroupDefinition[] | undefined): {
|
|
298
|
+
groupIds: string[];
|
|
299
|
+
primaryGroupId: string | null;
|
|
300
|
+
primaryGroupPath: string | null;
|
|
301
|
+
groupPathsById: Record<string, string>;
|
|
302
|
+
};
|
|
303
|
+
declare function resolvePoseSemantics(pose: Pick<PoseDefinition, "id" | "name" | "group" | "groupId" | "groupIds">, groups: PoseGroupDefinition[] | undefined): {
|
|
304
|
+
key: string | null;
|
|
305
|
+
kind: PoseSemanticKind;
|
|
306
|
+
membership: ReturnType<typeof resolvePoseMembership>;
|
|
307
|
+
};
|
|
308
|
+
declare function filterPosesBySemanticKind(poses: PoseDefinition[], groups: PoseGroupDefinition[] | undefined, kind: PoseSemanticKind): PoseDefinition[];
|
|
309
|
+
declare function buildSemanticPoseWeightPathMap(poses: PoseDefinition[], groups: PoseGroupDefinition[] | undefined, faceId: string | null | undefined, kind: Exclude<PoseSemanticKind, "other">): Map<string, string>;
|
|
310
|
+
|
|
311
|
+
type InputConstraint = {
|
|
312
|
+
min?: number;
|
|
313
|
+
max?: number;
|
|
314
|
+
defaultValue?: number;
|
|
315
|
+
};
|
|
316
|
+
type FaceScalarControl = {
|
|
317
|
+
path: string;
|
|
318
|
+
min: number;
|
|
319
|
+
max: number;
|
|
320
|
+
defaultValue: number;
|
|
321
|
+
};
|
|
322
|
+
type ResolvedFaceControls = {
|
|
323
|
+
faceId: string;
|
|
324
|
+
gazeSource: "standard-vizij" | "standard" | "propsrig" | "coupled-gaze" | "none";
|
|
325
|
+
blinkSource: "lids" | "blink" | "none";
|
|
326
|
+
eyes: {
|
|
327
|
+
leftX: FaceScalarControl | null;
|
|
328
|
+
leftY: FaceScalarControl | null;
|
|
329
|
+
rightX: FaceScalarControl | null;
|
|
330
|
+
rightY: FaceScalarControl | null;
|
|
331
|
+
};
|
|
332
|
+
eyelids: {
|
|
333
|
+
leftUpper: FaceScalarControl | null;
|
|
334
|
+
rightUpper: FaceScalarControl | null;
|
|
335
|
+
};
|
|
336
|
+
blink: FaceScalarControl | null;
|
|
337
|
+
};
|
|
338
|
+
declare function resolveFaceControls(assetBundle: VizijAssetBundle, runtimeFaceId?: string | null, inputConstraints?: Record<string, InputConstraint>): ResolvedFaceControls;
|
|
339
|
+
declare function mapNormalizedControlValue(control: FaceScalarControl, normalizedValue: number): number;
|
|
340
|
+
declare function mapUnitControlValue(control: FaceScalarControl, unitValue: number): number;
|
|
341
|
+
|
|
342
|
+
export { type AnimateValueOptions, type AnimationClipLike, type AnimationKeyframeLike, type AnimationPlaybackState, type AnimationTrackLike, EMOTION_POSE_KEYS, EXPRESSIVE_EMOTION_POSE_KEYS, type FaceScalarControl, type InputDriverContext, type InputDriverFactory, type InputDriverLifecycle, POSE_WEIGHT_INPUT_PATH_PREFIX, type PlayAnimationOptions, type PoseDefinition, type PoseGroupDefinition, type PoseRigConfig, type ProgramPlaybackState, type RootBounds, type RuntimeGraphBundle, type RuntimeOutputWrite, type RuntimeUpdatePlan, type RuntimeUpdateTier, type StopProgramOptions, VISEME_POSE_KEYS, type VizijAnimationAsset, type VizijAssetBundle, type VizijGlbAsset, type VizijGraphAsset, type VizijProgramAsset, VizijRuntimeFace, type VizijRuntimeFaceProps, VizijRuntimeProvider, type VizijRuntimeProviderProps, type VizijRuntimeStatus, buildPoseWeightInputPathSegment, buildPoseWeightPathMap, buildPoseWeightRelativePath, buildRigInputPath, buildSemanticPoseWeightPathMap, filterPosesBySemanticKind, getPoseSemanticKey, mapNormalizedControlValue, mapUnitControlValue, normalizePoseSemanticKey, resolveFaceControls, resolvePoseMembership, resolvePoseSemantics, resolveRuntimeUpdatePlan, useOptionalVizijRuntime, useRigInput, useVizijOutputs, useVizijRuntime };
|