@laplace.live/persona-sdk 1.4.0 → 1.6.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/dist/client/client.d.ts +1 -0
- package/dist/client/client.js +3 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/values/camera.d.ts +13 -0
- package/dist/values/camera.js +19 -0
- package/dist/values/controller.d.ts +11 -11
- package/dist/values/controller.js +24 -44
- package/dist/values/curve.d.ts +4 -4
- package/dist/values/effect-schema.js +4 -4
- package/dist/values/guards.d.ts +12 -0
- package/dist/values/guards.js +16 -0
- package/dist/values/hands.d.ts +22 -22
- package/dist/values/hands.js +30 -58
- package/dist/values/hotkeys.d.ts +14 -0
- package/dist/values/hotkeys.js +13 -1
- package/dist/values/labels.d.ts +12 -5
- package/dist/values/labels.js +29 -9
- package/dist/values/limits.js +1 -0
- package/dist/values/lipsync.d.ts +2 -2
- package/dist/values/lipsync.js +2 -15
- package/dist/values/locale.d.ts +9 -4
- package/dist/values/locale.js +4 -3
- package/dist/values/scene-transition.d.ts +15 -0
- package/dist/values/scene-transition.js +48 -0
- package/dist/wire/errors.js +3 -2
- package/dist/wire/events.d.ts +5 -5
- package/dist/wire/events.js +3 -2
- package/dist/wire/methods.d.ts +14 -24
- package/dist/wire/protocol.d.ts +3 -1
- package/dist/wire/protocol.js +3 -1
- package/dist/wire/schemas.d.ts +20 -8
- package/dist/wire/schemas.js +19 -9
- package/dist/wire/types.d.ts +89 -27
- package/dist/wire/types.js +63 -66
- package/package.json +1 -1
package/dist/wire/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ControllerConfig } from '../values/controller.ts';
|
|
2
|
-
import type { EFFECT_SCOPES } from '../values/effect-schema.ts';
|
|
2
|
+
import type { EFFECT_BLEND_MODES, EFFECT_SCOPES } from '../values/effect-schema.ts';
|
|
3
|
+
import type { SCENE_TRANSITION_TYPES } from '../values/scene-transition.ts';
|
|
3
4
|
import { type ArkitInputName } from '../values/arkit.ts';
|
|
4
5
|
import { type BaseControllerInputName, type ControllerInputName, type ControllerMovementConfig } from '../values/controller.ts';
|
|
5
6
|
import { type HandInputName } from '../values/hands.ts';
|
|
@@ -175,7 +176,8 @@ export interface SceneModelItem {
|
|
|
175
176
|
/** MToon material fine-tuning, VRM only. */
|
|
176
177
|
mtoon: MToonTuning;
|
|
177
178
|
}
|
|
178
|
-
export
|
|
179
|
+
export declare const OBJECT_SPACES: readonly ["2d", "3d"];
|
|
180
|
+
export type ObjectSpace = (typeof OBJECT_SPACES)[number];
|
|
179
181
|
/** Where a webpage overlay renders relative to the stage. */
|
|
180
182
|
export type WebLayer = 'behind' | 'front';
|
|
181
183
|
export type CaptureKind = 'display' | 'window';
|
|
@@ -333,6 +335,8 @@ export type ShadowQuality = (typeof SHADOW_QUALITY_LEVELS)[number];
|
|
|
333
335
|
export interface SceneLight {
|
|
334
336
|
id: string;
|
|
335
337
|
type: SceneLightType;
|
|
338
|
+
/** Mutes illumination and shadows. Defaults to true; omitted by hosts without light toggles. */
|
|
339
|
+
enabled?: boolean;
|
|
336
340
|
color: string;
|
|
337
341
|
intensity: number;
|
|
338
342
|
azimuth: number;
|
|
@@ -608,7 +612,7 @@ export interface SceneDroplets {
|
|
|
608
612
|
glints: number;
|
|
609
613
|
}
|
|
610
614
|
/** Blend modes shared by Shoost's rim light and gradient. */
|
|
611
|
-
export type EffectBlendMode =
|
|
615
|
+
export type EffectBlendMode = (typeof EFFECT_BLEND_MODES)[number];
|
|
612
616
|
/** Solid, linear, or radial color overlay in scene or source coordinates. */
|
|
613
617
|
export interface EffectGradient {
|
|
614
618
|
enabled: boolean;
|
|
@@ -840,6 +844,23 @@ export interface SceneEnvironment {
|
|
|
840
844
|
*/
|
|
841
845
|
effectLayers: ToggleEffectKey[];
|
|
842
846
|
}
|
|
847
|
+
/** An effect played when this destination scene becomes active. */
|
|
848
|
+
export interface SceneTransition {
|
|
849
|
+
type: (typeof SCENE_TRANSITION_TYPES)[number];
|
|
850
|
+
/** Total animation time in milliseconds, 100–10,000; cuts are immediate. */
|
|
851
|
+
durationMs: number;
|
|
852
|
+
color: string;
|
|
853
|
+
/** A registered image/video id; filesystem paths never cross the wire. */
|
|
854
|
+
assetId: string | null;
|
|
855
|
+
/** Fraction of the animation where the scene changes, 0.05–0.95. */
|
|
856
|
+
switchPoint: number;
|
|
857
|
+
/** Fade a video's opacity at its start and end; false preserves the clip's authored alpha. */
|
|
858
|
+
autoFade: boolean;
|
|
859
|
+
/** Video fade-in playback time in milliseconds, 0–10,000, capped at the switch point; requires autoFade. */
|
|
860
|
+
fadeInMs: number;
|
|
861
|
+
/** Video fade-out playback time in milliseconds, 0–10,000, capped after the switch point; requires autoFade. */
|
|
862
|
+
fadeOutMs: number;
|
|
863
|
+
}
|
|
843
864
|
export interface Scene {
|
|
844
865
|
id: string;
|
|
845
866
|
name: string;
|
|
@@ -852,14 +873,12 @@ export interface Scene {
|
|
|
852
873
|
/** Array order is display order only; live lights are keyed by id. */
|
|
853
874
|
lights: SceneLight[];
|
|
854
875
|
environment: SceneEnvironment;
|
|
855
|
-
/**
|
|
856
|
-
|
|
876
|
+
/** Absent on older hosts; gate editing on the `scene-transitions` capability. */
|
|
877
|
+
transition?: SceneTransition;
|
|
857
878
|
}
|
|
858
879
|
export interface SceneState {
|
|
859
880
|
scenes: Scene[];
|
|
860
881
|
activeSceneId: string;
|
|
861
|
-
/** Scene ids whose shortcut is currently registered with the OS. */
|
|
862
|
-
registeredSceneIds: string[];
|
|
863
882
|
}
|
|
864
883
|
/**
|
|
865
884
|
* Editable sections of the active scene. Items are deliberately absent — they
|
|
@@ -871,12 +890,13 @@ export interface ScenePatch {
|
|
|
871
890
|
vrmCamera?: SceneCamera;
|
|
872
891
|
lights?: SceneLight[];
|
|
873
892
|
environment?: SceneEnvironment;
|
|
893
|
+
transition?: SceneTransition;
|
|
874
894
|
}
|
|
875
895
|
/**
|
|
876
896
|
* App-level features a client gates on (never version-sniff): `hello` and
|
|
877
897
|
* `app.info` report them — the per-app mirror of {@link InstanceRuntime.capabilities}.
|
|
878
898
|
*/
|
|
879
|
-
export declare const APP_CAPABILITIES: readonly ["storage", "speech", "
|
|
899
|
+
export declare const APP_CAPABILITIES: readonly ["storage", "speech", "automations", "controllers", "model-editing", "asset-inspection", "layer-effects", "scene-transitions"];
|
|
880
900
|
export type AppCapability = (typeof APP_CAPABILITIES)[number];
|
|
881
901
|
export declare function isAppCapability(v: unknown): v is AppCapability;
|
|
882
902
|
/** What a loaded model instance can do; absent capabilities answer `unsupported-for-format`. */
|
|
@@ -948,23 +968,32 @@ export interface HotkeyState extends HotkeyConfig {
|
|
|
948
968
|
/** Hotkey ids currently registered with the OS (active model only). */
|
|
949
969
|
registered: string[];
|
|
950
970
|
}
|
|
951
|
-
/** Action kinds an app
|
|
952
|
-
export declare const
|
|
953
|
-
export type
|
|
971
|
+
/** Action kinds an app automation can carry today; servers may send kinds newer than this list. */
|
|
972
|
+
export declare const AUTOMATION_ACTION_KINDS: readonly ["effect-toggle", "effect-params", "camera-pose", "reset-camera", "layer-visibility", "stream-mode", "switch-scene", "delay"];
|
|
973
|
+
export type AutomationActionKind = (typeof AUTOMATION_ACTION_KINDS)[number];
|
|
974
|
+
/** Kinds that end an action batch: the actions after one wait until it finishes. */
|
|
975
|
+
export declare const AUTOMATION_BOUNDARY_KINDS: readonly ["switch-scene", "delay"];
|
|
976
|
+
export type AutomationBoundaryKind = (typeof AUTOMATION_BOUNDARY_KINDS)[number];
|
|
954
977
|
/**
|
|
955
|
-
* One app
|
|
956
|
-
* payloads stay app-side
|
|
978
|
+
* One app automation as clients see it. Action kinds and scene targets drive derived
|
|
979
|
+
* labels; other action payloads stay app-side.
|
|
957
980
|
*/
|
|
958
|
-
export interface
|
|
981
|
+
export interface AutomationInfo {
|
|
959
982
|
id: string;
|
|
960
|
-
/** User-given name, or null — derive a label from `actionKinds` (see `
|
|
983
|
+
/** User-given name, or null — derive a label from `actionKinds` (see `automationLabel`). */
|
|
961
984
|
title: string | null;
|
|
962
|
-
/** Bound key combo, or null
|
|
985
|
+
/** Bound key combo, or null when the automation has no keyboard/controller trigger. */
|
|
963
986
|
accelerator: string | null;
|
|
964
987
|
/** May include kinds newer than this SDK; label those generically. */
|
|
965
988
|
actionKinds: string[];
|
|
989
|
+
/** Scene targets aligned with `actionKinds`; null for other actions. Older hosts omit this field. */
|
|
990
|
+
actionSceneIds?: (string | null)[];
|
|
966
991
|
/** Whether the combo is currently registered with the OS. */
|
|
967
992
|
registered: boolean;
|
|
993
|
+
/** Whether this automation can run. */
|
|
994
|
+
enabled: boolean;
|
|
995
|
+
/** Additional event trigger kinds. Trigger settings stay desktop-side. */
|
|
996
|
+
triggerKinds: string[];
|
|
968
997
|
}
|
|
969
998
|
export interface ExpressionPersistence {
|
|
970
999
|
supported: boolean;
|
|
@@ -975,6 +1004,8 @@ export interface ExpressionPersistence {
|
|
|
975
1004
|
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
976
1005
|
[key: string]: JsonValue;
|
|
977
1006
|
};
|
|
1007
|
+
export declare const LIVE2D_ENGINES: readonly ["pixi", "three"];
|
|
1008
|
+
export type Live2DEngine = (typeof LIVE2D_ENGINES)[number];
|
|
978
1009
|
export declare const TRACKING_SOURCE_IDS: readonly ["persona-ios", "ifacialmocap", "vts-ios"];
|
|
979
1010
|
export type TrackingSourceId = (typeof TRACKING_SOURCE_IDS)[number];
|
|
980
1011
|
/** Body-pose protocols. Every one so far is UDP with a configurable port. */
|
|
@@ -985,17 +1016,18 @@ export type PoseStatus = 'off' | 'waiting' | 'tracking';
|
|
|
985
1016
|
/** Every protocol a tracking source instance can speak; face and body kinds. */
|
|
986
1017
|
export declare const TRACKING_SOURCE_KINDS: readonly ["persona-ios", "ifacialmocap", "vts-ios", "vmc", "mocopi", "mediapipe"];
|
|
987
1018
|
export type TrackingSourceKind = (typeof TRACKING_SOURCE_KINDS)[number];
|
|
988
|
-
export
|
|
989
|
-
export type TrackingChannel = (typeof TRACKING_CHANNELS)[number];
|
|
1019
|
+
export type TrackingChannel = keyof typeof TRACKING_CHANNEL_FIELDS;
|
|
990
1020
|
/** The scene-item binding each channel reads and writes. */
|
|
991
1021
|
export declare const TRACKING_CHANNEL_FIELDS: {
|
|
992
1022
|
readonly face: "faceSourceId";
|
|
993
1023
|
readonly pose: "poseSourceId";
|
|
994
1024
|
readonly hands: "handSourceId";
|
|
995
1025
|
};
|
|
1026
|
+
export declare const TRACKING_CHANNELS: readonly TrackingChannel[];
|
|
996
1027
|
export declare const HAND_TRACKING_MODES: readonly ["arms", "fingers"];
|
|
997
1028
|
export type HandTrackingMode = (typeof HAND_TRACKING_MODES)[number];
|
|
998
1029
|
export declare function isHandTrackingMode(v: unknown): v is HandTrackingMode;
|
|
1030
|
+
export declare const MEDIAPIPE_DELEGATES: readonly ["CPU", "GPU"];
|
|
999
1031
|
/** The shared webcam source's enabled inference tasks and camera configuration. */
|
|
1000
1032
|
export interface MediaPipeConfig {
|
|
1001
1033
|
deviceId: string;
|
|
@@ -1003,7 +1035,7 @@ export interface MediaPipeConfig {
|
|
|
1003
1035
|
face: boolean;
|
|
1004
1036
|
hands: boolean;
|
|
1005
1037
|
body: boolean;
|
|
1006
|
-
delegate:
|
|
1038
|
+
delegate: (typeof MEDIAPIPE_DELEGATES)[number];
|
|
1007
1039
|
}
|
|
1008
1040
|
export declare const DEFAULT_MEDIAPIPE_CONFIG: Readonly<MediaPipeConfig>;
|
|
1009
1041
|
/** Whether a source kind uses a network face receiver. */
|
|
@@ -1084,11 +1116,10 @@ export interface Settings {
|
|
|
1084
1116
|
performance: {
|
|
1085
1117
|
showFps: boolean;
|
|
1086
1118
|
fpsLimit: number;
|
|
1087
|
-
selectionOutline: boolean;
|
|
1088
1119
|
effectsQuality: EffectsQuality;
|
|
1089
1120
|
/** Absent on older hosts. */
|
|
1090
1121
|
renderScale?: number;
|
|
1091
|
-
live2dEngine?:
|
|
1122
|
+
live2dEngine?: Live2DEngine;
|
|
1092
1123
|
};
|
|
1093
1124
|
/** `enabled` gates network face sources; `source` mirrors the first one's kind for old clients. */
|
|
1094
1125
|
tracking: {
|
|
@@ -1115,15 +1146,45 @@ export interface SettingsPatch {
|
|
|
1115
1146
|
performance?: {
|
|
1116
1147
|
showFps?: boolean;
|
|
1117
1148
|
fpsLimit?: number;
|
|
1118
|
-
selectionOutline?: boolean;
|
|
1119
1149
|
effectsQuality?: EffectsQuality;
|
|
1120
1150
|
renderScale?: number;
|
|
1121
|
-
live2dEngine?:
|
|
1151
|
+
live2dEngine?: Live2DEngine;
|
|
1122
1152
|
};
|
|
1123
1153
|
}
|
|
1124
|
-
/**
|
|
1125
|
-
|
|
1126
|
-
|
|
1154
|
+
/**
|
|
1155
|
+
* From VTS's own registry (`FaceTrackingParamInfo.paramNameDictionary`), which is both the
|
|
1156
|
+
* range its editor seeds a new parameter with and what every `.vtube.json` was authored
|
|
1157
|
+
* against. Two families differ deliberately:
|
|
1158
|
+
*
|
|
1159
|
+
* - **the brow inputs** are signed here. VTS lists them `0..1`; we derive them as
|
|
1160
|
+
* `brow-up − brow-down`, so a frown needs the lower half.
|
|
1161
|
+
* - **`JawOpen`** is absent from VTS's registry — it exists there only as a plugin-created
|
|
1162
|
+
* parameter, which VTS then special-cases — so its span is the ARKit channel's.
|
|
1163
|
+
*/
|
|
1164
|
+
declare const VTS_INPUT_RANGES: {
|
|
1165
|
+
readonly FaceAngleX: readonly [-30, 30];
|
|
1166
|
+
readonly FaceAngleY: readonly [-30, 30];
|
|
1167
|
+
readonly FaceAngleZ: readonly [-90, 90];
|
|
1168
|
+
readonly FacePositionX: readonly [-15, 15];
|
|
1169
|
+
readonly FacePositionY: readonly [-15, 15];
|
|
1170
|
+
readonly FacePositionZ: readonly [-10, 10];
|
|
1171
|
+
readonly EyeOpenLeft: readonly [0, 1];
|
|
1172
|
+
readonly EyeOpenRight: readonly [0, 1];
|
|
1173
|
+
readonly EyeLeftX: readonly [-1, 1];
|
|
1174
|
+
readonly EyeLeftY: readonly [-1, 1];
|
|
1175
|
+
readonly EyeRightX: readonly [-1, 1];
|
|
1176
|
+
readonly EyeRightY: readonly [-1, 1];
|
|
1177
|
+
readonly Brows: readonly [-1, 1];
|
|
1178
|
+
readonly BrowLeftY: readonly [-1, 1];
|
|
1179
|
+
readonly BrowRightY: readonly [-1, 1];
|
|
1180
|
+
readonly MouthSmile: readonly [0, 1];
|
|
1181
|
+
readonly MouthOpen: readonly [0, 1];
|
|
1182
|
+
readonly MouthX: readonly [-1, 1];
|
|
1183
|
+
readonly CheekPuff: readonly [0, 1];
|
|
1184
|
+
readonly JawOpen: readonly [0, 1];
|
|
1185
|
+
readonly TongueOut: readonly [0, 1];
|
|
1186
|
+
};
|
|
1187
|
+
type VtsInputName = keyof typeof VTS_INPUT_RANGES;
|
|
1127
1188
|
/**
|
|
1128
1189
|
* Default input vocabulary: face and hand inputs, raw ARKit channels and controller profile 1.
|
|
1129
1190
|
* Additional controller profile ids are accepted by isInputName without appearing in this list.
|
|
@@ -1168,7 +1229,8 @@ export declare function getInputRange(name: InputName): readonly [number, number
|
|
|
1168
1229
|
* - `vrm-expression` — reserved, not implemented yet; the server answers
|
|
1169
1230
|
* `unsupported-for-format`.
|
|
1170
1231
|
*/
|
|
1171
|
-
export
|
|
1232
|
+
export declare const INJECT_TARGET_TYPES: readonly ["input", "live2d-param", "vrm-expression"];
|
|
1233
|
+
export type InjectTargetType = (typeof INJECT_TARGET_TYPES)[number];
|
|
1172
1234
|
export interface InjectTarget {
|
|
1173
1235
|
type: InjectTargetType;
|
|
1174
1236
|
id: string;
|
package/dist/wire/types.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// filesystem-shaped — model refs are sanitized to ids, never directories.
|
|
4
4
|
import { ARKIT_INPUT_NAMES } from "../values/arkit.js";
|
|
5
5
|
import { BASE_CONTROLLER_INPUT_NAMES, BASE_CONTROLLER_INPUT_RANGES, controllerInputRange, isControllerInputName, } from "../values/controller.js";
|
|
6
|
+
import { isOneOf, keysOf } from "../values/guards.js";
|
|
6
7
|
import { HAND_INPUT_NAMES, HAND_INPUT_RANGES } from "../values/hands.js";
|
|
7
8
|
import { VOICE_INPUT_NAMES, VOICE_INPUT_RANGES, } from "../values/lipsync.js";
|
|
8
9
|
/**
|
|
@@ -13,8 +14,10 @@ import { VOICE_INPUT_NAMES, VOICE_INPUT_RANGES, } from "../values/lipsync.js";
|
|
|
13
14
|
export const ASSET_KINDS = ['image', 'video', 'prop', 'ibl', 'lut', 'animation', 'cameraMotion'];
|
|
14
15
|
/** Narrow a kind string to the set the asset registry owns — models and effects have their own. */
|
|
15
16
|
export function isAssetKind(v) {
|
|
16
|
-
return
|
|
17
|
+
return isOneOf(v, ASSET_KINDS);
|
|
17
18
|
}
|
|
19
|
+
// ---- Objects -------------------------------------------------------------------
|
|
20
|
+
export const OBJECT_SPACES = ['2d', '3d'];
|
|
18
21
|
/**
|
|
19
22
|
* Per-light shadow tier. `off` is the old `castShadow: false`; the rest raise
|
|
20
23
|
* shadow-map resolution. A point light pays 6 cube faces for the same tier a
|
|
@@ -29,42 +32,49 @@ export const SHADOW_QUALITY_LEVELS = ['off', 'low', 'medium', 'high', 'ultra'];
|
|
|
29
32
|
export const APP_CAPABILITIES = [
|
|
30
33
|
'storage',
|
|
31
34
|
'speech',
|
|
32
|
-
'
|
|
35
|
+
'automations',
|
|
33
36
|
'controllers',
|
|
34
37
|
'model-editing',
|
|
35
38
|
'asset-inspection',
|
|
36
39
|
'layer-effects',
|
|
40
|
+
'scene-transitions',
|
|
37
41
|
];
|
|
38
42
|
export function isAppCapability(v) {
|
|
39
|
-
return
|
|
43
|
+
return isOneOf(v, APP_CAPABILITIES);
|
|
40
44
|
}
|
|
41
|
-
// ---- App
|
|
42
|
-
/** Action kinds an app
|
|
43
|
-
export const
|
|
45
|
+
// ---- App automations --------------------------------------------------------------
|
|
46
|
+
/** Action kinds an app automation can carry today; servers may send kinds newer than this list. */
|
|
47
|
+
export const AUTOMATION_ACTION_KINDS = [
|
|
44
48
|
'effect-toggle',
|
|
45
49
|
'effect-params',
|
|
46
50
|
'camera-pose',
|
|
47
51
|
'reset-camera',
|
|
48
52
|
'layer-visibility',
|
|
49
53
|
'stream-mode',
|
|
54
|
+
'switch-scene',
|
|
55
|
+
'delay',
|
|
50
56
|
];
|
|
57
|
+
/** Kinds that end an action batch: the actions after one wait until it finishes. */
|
|
58
|
+
export const AUTOMATION_BOUNDARY_KINDS = ['switch-scene', 'delay'];
|
|
51
59
|
// ---- Settings ------------------------------------------------------------------
|
|
60
|
+
export const LIVE2D_ENGINES = ['pixi', 'three'];
|
|
52
61
|
export const TRACKING_SOURCE_IDS = ['persona-ios', 'ifacialmocap', 'vts-ios'];
|
|
53
62
|
/** Body-pose protocols. Every one so far is UDP with a configurable port. */
|
|
54
63
|
export const POSE_SOURCE_IDS = ['vmc', 'mocopi'];
|
|
55
64
|
/** Every protocol a tracking source instance can speak; face and body kinds. */
|
|
56
65
|
export const TRACKING_SOURCE_KINDS = [...TRACKING_SOURCE_IDS, ...POSE_SOURCE_IDS, 'mediapipe'];
|
|
57
|
-
export const TRACKING_CHANNELS = ['face', 'pose', 'hands'];
|
|
58
66
|
/** The scene-item binding each channel reads and writes. */
|
|
59
67
|
export const TRACKING_CHANNEL_FIELDS = {
|
|
60
68
|
face: 'faceSourceId',
|
|
61
69
|
pose: 'poseSourceId',
|
|
62
70
|
hands: 'handSourceId',
|
|
63
71
|
};
|
|
72
|
+
export const TRACKING_CHANNELS = keysOf(TRACKING_CHANNEL_FIELDS);
|
|
64
73
|
export const HAND_TRACKING_MODES = ['arms', 'fingers'];
|
|
65
74
|
export function isHandTrackingMode(v) {
|
|
66
|
-
return
|
|
75
|
+
return isOneOf(v, HAND_TRACKING_MODES);
|
|
67
76
|
}
|
|
77
|
+
export const MEDIAPIPE_DELEGATES = ['CPU', 'GPU'];
|
|
68
78
|
export const DEFAULT_MEDIAPIPE_CONFIG = {
|
|
69
79
|
deviceId: '',
|
|
70
80
|
mirror: true,
|
|
@@ -75,11 +85,11 @@ export const DEFAULT_MEDIAPIPE_CONFIG = {
|
|
|
75
85
|
};
|
|
76
86
|
/** Whether a source kind uses a network face receiver. */
|
|
77
87
|
export function isFaceSourceKind(kind) {
|
|
78
|
-
return
|
|
88
|
+
return isOneOf(kind, TRACKING_SOURCE_IDS);
|
|
79
89
|
}
|
|
80
90
|
/** Whether a source uses a network body receiver. */
|
|
81
91
|
export function isPoseSource(source) {
|
|
82
|
-
return
|
|
92
|
+
return isOneOf(source.kind, POSE_SOURCE_IDS);
|
|
83
93
|
}
|
|
84
94
|
const FACE_ONLY = ['face'];
|
|
85
95
|
const POSE_ONLY = ['pose'];
|
|
@@ -119,30 +129,41 @@ export const EFFECTS_QUALITY_LEVELS = ['low', 'medium', 'high'];
|
|
|
119
129
|
*/
|
|
120
130
|
export const FPS_LIMIT_PRESETS = [0, 15, 30, 60, 90];
|
|
121
131
|
// ---- Injection -----------------------------------------------------------------
|
|
132
|
+
/**
|
|
133
|
+
* From VTS's own registry (`FaceTrackingParamInfo.paramNameDictionary`), which is both the
|
|
134
|
+
* range its editor seeds a new parameter with and what every `.vtube.json` was authored
|
|
135
|
+
* against. Two families differ deliberately:
|
|
136
|
+
*
|
|
137
|
+
* - **the brow inputs** are signed here. VTS lists them `0..1`; we derive them as
|
|
138
|
+
* `brow-up − brow-down`, so a frown needs the lower half.
|
|
139
|
+
* - **`JawOpen`** is absent from VTS's registry — it exists there only as a plugin-created
|
|
140
|
+
* parameter, which VTS then special-cases — so its span is the ARKit channel's.
|
|
141
|
+
*/
|
|
142
|
+
const VTS_INPUT_RANGES = {
|
|
143
|
+
FaceAngleX: [-30, 30],
|
|
144
|
+
FaceAngleY: [-30, 30],
|
|
145
|
+
FaceAngleZ: [-90, 90],
|
|
146
|
+
FacePositionX: [-15, 15],
|
|
147
|
+
FacePositionY: [-15, 15],
|
|
148
|
+
FacePositionZ: [-10, 10],
|
|
149
|
+
EyeOpenLeft: [0, 1],
|
|
150
|
+
EyeOpenRight: [0, 1],
|
|
151
|
+
EyeLeftX: [-1, 1],
|
|
152
|
+
EyeLeftY: [-1, 1],
|
|
153
|
+
EyeRightX: [-1, 1],
|
|
154
|
+
EyeRightY: [-1, 1],
|
|
155
|
+
Brows: [-1, 1],
|
|
156
|
+
BrowLeftY: [-1, 1],
|
|
157
|
+
BrowRightY: [-1, 1],
|
|
158
|
+
MouthSmile: [0, 1],
|
|
159
|
+
MouthOpen: [0, 1],
|
|
160
|
+
MouthX: [-1, 1],
|
|
161
|
+
CheekPuff: [0, 1],
|
|
162
|
+
JawOpen: [0, 1],
|
|
163
|
+
TongueOut: [0, 1],
|
|
164
|
+
};
|
|
122
165
|
/** VTS's input vocabulary, plus `JawOpen` — the derived half of {@link INPUT_NAMES}. */
|
|
123
|
-
const VTS_INPUT_NAMES =
|
|
124
|
-
'FaceAngleX',
|
|
125
|
-
'FaceAngleY',
|
|
126
|
-
'FaceAngleZ',
|
|
127
|
-
'FacePositionX',
|
|
128
|
-
'FacePositionY',
|
|
129
|
-
'FacePositionZ',
|
|
130
|
-
'EyeOpenLeft',
|
|
131
|
-
'EyeOpenRight',
|
|
132
|
-
'EyeLeftX',
|
|
133
|
-
'EyeLeftY',
|
|
134
|
-
'EyeRightX',
|
|
135
|
-
'EyeRightY',
|
|
136
|
-
'Brows',
|
|
137
|
-
'BrowLeftY',
|
|
138
|
-
'BrowRightY',
|
|
139
|
-
'MouthSmile',
|
|
140
|
-
'MouthOpen',
|
|
141
|
-
'MouthX',
|
|
142
|
-
'CheekPuff',
|
|
143
|
-
'JawOpen',
|
|
144
|
-
'TongueOut',
|
|
145
|
-
];
|
|
166
|
+
const VTS_INPUT_NAMES = keysOf(VTS_INPUT_RANGES);
|
|
146
167
|
/**
|
|
147
168
|
* Default input vocabulary: face and hand inputs, raw ARKit channels and controller profile 1.
|
|
148
169
|
* Additional controller profile ids are accepted by isInputName without appearing in this list.
|
|
@@ -180,39 +201,6 @@ export const BINDING_INPUT_NAMES = INPUT_NAMES.filter(n => !isArkitTwinAlias(n))
|
|
|
180
201
|
export function arkitTwinOf(input) {
|
|
181
202
|
return isArkitTwinAlias(input) ? ARKIT_TWINS[input] : input;
|
|
182
203
|
}
|
|
183
|
-
/**
|
|
184
|
-
* From VTS's own registry (`FaceTrackingParamInfo.paramNameDictionary`), which is both the
|
|
185
|
-
* range its editor seeds a new parameter with and what every `.vtube.json` was authored
|
|
186
|
-
* against. Two families differ deliberately:
|
|
187
|
-
*
|
|
188
|
-
* - **the brow inputs** are signed here. VTS lists them `0..1`; we derive them as
|
|
189
|
-
* `brow-up − brow-down`, so a frown needs the lower half.
|
|
190
|
-
* - **`JawOpen`** is absent from VTS's registry — it exists there only as a plugin-created
|
|
191
|
-
* parameter, which VTS then special-cases — so its span is the ARKit channel's.
|
|
192
|
-
*/
|
|
193
|
-
const VTS_INPUT_RANGES = {
|
|
194
|
-
FaceAngleX: [-30, 30],
|
|
195
|
-
FaceAngleY: [-30, 30],
|
|
196
|
-
FaceAngleZ: [-90, 90],
|
|
197
|
-
FacePositionX: [-15, 15],
|
|
198
|
-
FacePositionY: [-15, 15],
|
|
199
|
-
FacePositionZ: [-10, 10],
|
|
200
|
-
EyeOpenLeft: [0, 1],
|
|
201
|
-
EyeOpenRight: [0, 1],
|
|
202
|
-
EyeLeftX: [-1, 1],
|
|
203
|
-
EyeLeftY: [-1, 1],
|
|
204
|
-
EyeRightX: [-1, 1],
|
|
205
|
-
EyeRightY: [-1, 1],
|
|
206
|
-
Brows: [-1, 1],
|
|
207
|
-
BrowLeftY: [-1, 1],
|
|
208
|
-
BrowRightY: [-1, 1],
|
|
209
|
-
MouthSmile: [0, 1],
|
|
210
|
-
MouthOpen: [0, 1],
|
|
211
|
-
MouthX: [-1, 1],
|
|
212
|
-
CheekPuff: [0, 1],
|
|
213
|
-
JawOpen: [0, 1],
|
|
214
|
-
TongueOut: [0, 1],
|
|
215
|
-
};
|
|
216
204
|
/** ARKit blendshapes are unit-scale by definition, so every raw channel shares one span. */
|
|
217
205
|
const ARKIT_RANGE = [0, 1];
|
|
218
206
|
/**
|
|
@@ -232,3 +220,12 @@ export const INPUT_RANGES = {
|
|
|
232
220
|
export function getInputRange(name) {
|
|
233
221
|
return isControllerInputName(name) ? controllerInputRange(name) : INPUT_RANGES[name];
|
|
234
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* What an injected value drives:
|
|
225
|
+
* - `input` — a VTS-vocabulary tracking input (`MouthOpen`, `FaceAngleX`, …), mapped
|
|
226
|
+
* through the model's own tracking rules. Live2D only.
|
|
227
|
+
* - `live2d-param` — a Cubism parameter id, written directly.
|
|
228
|
+
* - `vrm-expression` — reserved, not implemented yet; the server answers
|
|
229
|
+
* `unsupported-for-format`.
|
|
230
|
+
*/
|
|
231
|
+
export const INJECT_TARGET_TYPES = ['input', 'live2d-param', 'vrm-expression'];
|