@vgai/editor-sdk 0.5.0 → 0.5.2

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@vgai/editor-sdk",
3
3
  "author": "Volter AI, Inc.",
4
4
  "license": "Apache-2.0",
5
- "version": "0.5.0",
5
+ "version": "0.5.2",
6
6
  "type": "module",
7
7
  "repository": {
8
8
  "type": "git",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@types/three": "^0.180.0",
25
- "@vgai/sdk": "0.5.0"
25
+ "@vgai/sdk": "0.5.2"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": "^19.0.0",
package/src/client.ts CHANGED
@@ -1,15 +1,18 @@
1
1
  import type { GenerationJobsDocument } from '@vgai/sdk/generations';
2
2
  import type {
3
3
  ActiveDocumentCapture,
4
+ AssetCompareCapture,
5
+ AssetCompareOptions,
4
6
  AssetKind,
5
7
  AssetPreviewCapture,
6
8
  AssetPreviewOptions,
9
+ AssetPreviewShotSetDefinition,
7
10
  AssetPreviewSource,
8
11
  EditorState,
9
12
  EditorView,
10
13
  GameCapture,
11
14
  HelperVisibility,
12
- HumanoidShotSetCapture,
15
+ LabeledShotSetCapture,
13
16
  PresentedEditorView,
14
17
  ProjectInfo,
15
18
  ProjectTemplate,
@@ -188,23 +191,25 @@ export class EditorClient {
188
191
  }
189
192
 
190
193
  /**
191
- * B7.6 the canonical humanoid verify shot set (`vgai asset-preview
192
- * --shots humanoid`): four turntable angles, tight zooms on the
193
- * historical seam sites (head/hands/feet/shoulder), and a deep-bend pose
194
- * pair, all framed by the editor from the loaded GLB's OWN skeleton — see
195
- * `packages/editor/src/asset-preview.ts`'s `captureHumanoidShotSetAssetPreview`.
196
- * Throws (via `command`'s `{ok:false}` unwrap) with a clear message naming
197
- * the missing joint(s) when the asset has no Mixamo-named skeleton.
194
+ * A project-defined labeled shot set (`vgai asset-preview --shots <set>`):
195
+ * the DEFINITION travels with the command (project data — see
196
+ * `AssetPreviewShotSetDefinition`; the CLI resolves it from the registered
197
+ * `project.<set>.previewShots` tool), and the editor's generic
198
+ * capture engine renders it — see `packages/editor/src/asset-preview.ts`'s
199
+ * `captureShotSetAssetPreview`. Throws (via `command`'s `{ok:false}`
200
+ * unwrap) with a clear message naming the missing joint(s) when the asset
201
+ * lacks a bone the definition requires.
198
202
  */
199
- async captureHumanoidShotSetPreview(
203
+ async captureShotSetPreview(
200
204
  source: AssetPreviewSource,
205
+ definition: AssetPreviewShotSetDefinition,
201
206
  options: AssetPreviewOptions = {},
202
- ): Promise<HumanoidShotSetCapture> {
203
- const data = await this.command<HumanoidShotSetCapture>({
207
+ ): Promise<LabeledShotSetCapture> {
208
+ const data = await this.command<LabeledShotSetCapture>({
204
209
  type: 'capture-asset-preview',
205
210
  ...source,
206
211
  ...options,
207
- shots: 'humanoid',
212
+ shotSet: definition,
208
213
  });
209
214
  return {
210
215
  width: data.width,
@@ -214,6 +219,29 @@ export class EditorClient {
214
219
  };
215
220
  }
216
221
 
222
+ /**
223
+ * B8.4 — score the asset against a reference GLB (`vgai asset-preview
224
+ * --compare <ref.glb>`): matched orthographic front + side silhouettes
225
+ * (equal-height bounding-box framing, both yaw-normalized to face the
226
+ * camera), per-view IoU numbers, and overlay evidence images. The
227
+ * reference GLB's raw bytes travel base64 in the command; the editor
228
+ * renders and scores — the SDK never interprets Three.js assets itself.
229
+ */
230
+ async captureAssetComparePreview(
231
+ source: AssetPreviewSource,
232
+ refGlbBase64: string,
233
+ options: AssetCompareOptions = {},
234
+ ): Promise<AssetCompareCapture> {
235
+ const { refForward, ...dimensions } = options;
236
+ const data = await this.command<AssetCompareCapture>({
237
+ type: 'capture-asset-preview',
238
+ ...source,
239
+ ...dimensions,
240
+ compare: { glbBase64: refGlbBase64, ...(refForward ? { forward: refForward } : {}) },
241
+ });
242
+ return { width: data.width, height: data.height, views: data.views };
243
+ }
244
+
217
245
  // --- Panels ---
218
246
 
219
247
  async showViewport(tab: 'scene' | 'game'): Promise<void> {
package/src/index.ts CHANGED
@@ -24,10 +24,14 @@ export type {
24
24
  } from './extension.js';
25
25
  export type {
26
26
  ActiveDocumentCapture,
27
+ AssetCompareCapture,
28
+ AssetCompareOptions,
29
+ AssetCompareView,
27
30
  AssetKind,
28
31
  AssetPreviewBackground,
29
32
  AssetPreviewCapture,
30
33
  AssetPreviewOptions,
34
+ AssetPreviewShotSetDefinition,
31
35
  AssetPreviewSource,
32
36
  AssetPreviewView,
33
37
  EditorCameraState,
@@ -37,8 +41,7 @@ export type {
37
41
  EditorViewDocument,
38
42
  GameCapture,
39
43
  HelperVisibility,
40
- HumanoidShotLabel,
41
- HumanoidShotSetCapture,
44
+ LabeledShotSetCapture,
42
45
  PresentedEditorView,
43
46
  ProjectInfo,
44
47
  ProjectTemplate,
@@ -48,10 +51,11 @@ export type {
48
51
  ProjectToolOutcome,
49
52
  RecentProject,
50
53
  ShadingMode,
54
+ ShotSetPoseRotation,
55
+ ShotSetShot,
51
56
  TransformMode,
52
57
  TransformSpace,
53
58
  Vec3Value,
54
59
  ViewPreset,
55
60
  ViewportCapture,
56
61
  } from './types.js';
57
- export { HUMANOID_SHOT_LABELS } from './types.js';
package/src/types.ts CHANGED
@@ -89,29 +89,82 @@ export interface AssetPreviewCapture {
89
89
  }
90
90
 
91
91
  /**
92
- * B7.6 — the canonical humanoid verify shot set (`vgai asset-preview --shots
93
- * humanoid`): four turntable angles, tight zooms on the historical seam
94
- * sites (head/hands/feet/shoulder), and a deep-bend pose pair, all framed
95
- * from the loaded GLB's OWN skeleton (see `packages/editor/src/asset-preview.ts`).
92
+ * B8.4 — the asset-preview compare mode (`vgai asset-preview --compare
93
+ * <ref.glb>`): the asset and a caller-supplied reference GLB rendered with
94
+ * matched orthographic front + side framing (equal-height bounding-box
95
+ * normalization, both yaw-normalized to face the camera), scored by
96
+ * silhouette IoU with per-view overlay evidence (orange asset / cyan
97
+ * reference / near-white agreement). See
98
+ * `packages/editor/src/asset-compare.ts`.
96
99
  */
97
- export const HUMANOID_SHOT_LABELS = [
98
- 'front',
99
- 'back',
100
- 'left',
101
- 'right',
102
- 'zoom-head',
103
- 'zoom-hands',
104
- 'zoom-feet',
105
- 'zoom-shoulder',
106
- 'bend-front',
107
- 'bend-quarter',
108
- ] as const;
109
- export type HumanoidShotLabel = (typeof HUMANOID_SHOT_LABELS)[number];
100
+ export type AssetCompareView = 'front' | 'side';
110
101
 
111
- export interface HumanoidShotSetCapture {
102
+ export interface AssetCompareOptions {
103
+ width?: number;
104
+ height?: number;
105
+ /** Override the reference GLB's ground-plane forward vector; defaults to
106
+ * its `userData.forward` extras when present, else glTF's +Z. */
107
+ refForward?: [number, number, number];
108
+ }
109
+
110
+ export interface AssetCompareCapture {
111
+ width: number;
112
+ height: number;
113
+ views: Array<{
114
+ view: AssetCompareView;
115
+ /** Silhouette intersection-over-union in [0, 1]. */
116
+ iou: number;
117
+ overlay: ViewportCapture;
118
+ asset: ViewportCapture;
119
+ ref: ViewportCapture;
120
+ }>;
121
+ }
122
+
123
+ /**
124
+ * A project-defined labeled shot set (`vgai asset-preview --shots <set>`).
125
+ * The DEFINITION is project data: a registered project tool named
126
+ * `project.<set>.previewShots` returns it (installed capabilities register
127
+ * theirs — e.g. the humanoid capability contributes its canonical verify set),
128
+ * and the editor's generic capture engine renders it — turntable yaw angles
129
+ * and skeleton-anchored zoom crops, optionally under a named pose applied to
130
+ * a disposable snapshot (see `packages/editor/src/asset-preview.ts`).
131
+ */
132
+ export interface ShotSetPoseRotation {
133
+ bone: string;
134
+ axis: 'x' | 'y' | 'z';
135
+ radians: number;
136
+ }
137
+
138
+ export type ShotSetShot =
139
+ | { label: string; view: 'turntable'; yaw: number; pose?: string | undefined }
140
+ | {
141
+ label: string;
142
+ view: 'bone-zoom';
143
+ bones: string[];
144
+ spanFraction: number;
145
+ pose?: string | undefined;
146
+ };
147
+
148
+ export interface AssetPreviewShotSetDefinition {
149
+ /** The set's name (the CLI's `--shots <name>`), echoed in error messages. */
150
+ name: string;
151
+ /** Joints that must exist on the loaded GLB's OWN skeleton (zoom anchors
152
+ * plus a loud failure naming the missing joints — never a silent
153
+ * bounding-box fallback for a set that promised skeleton anchoring). */
154
+ requiredBones?: string[];
155
+ /** Optional clause appended to rig-requirement errors,
156
+ * e.g. "a Mixamo-named humanoid skeleton". */
157
+ rigRequirementHint?: string;
158
+ /** Named poses (bone rotations applied to a disposable snapshot only);
159
+ * shots opt in via their `pose` field. */
160
+ poses?: Record<string, ShotSetPoseRotation[]>;
161
+ shots: ShotSetShot[];
162
+ }
163
+
164
+ export interface LabeledShotSetCapture {
112
165
  width: number;
113
166
  height: number;
114
- shots: Array<ViewportCapture & { label: HumanoidShotLabel }>;
167
+ shots: Array<ViewportCapture & { label: string }>;
115
168
  contactSheet: ViewportCapture & { width: number; height: number };
116
169
  }
117
170