@ignifx/editor-host 0.15.0 → 0.16.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ignifx/editor-host",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "ignifx editor host: runs a project's own engine inside the ignifx editor's scene view and play view, over a versioned protocol.",
5
5
  "keywords": [
6
6
  "ignifx"
@@ -52,19 +52,19 @@
52
52
  "typescript-native": "npm:typescript@7.0.2",
53
53
  "vite": "^8.2.2",
54
54
  "vitest": "^5.0.0",
55
- "@ignifx/2d": "0.15.0",
56
- "@ignifx/3d": "0.15.0",
57
- "@ignifx/core": "0.15.0",
58
- "@ignifx/input": "0.15.0",
59
- "@ignifx/physics": "0.15.0",
60
- "@ignifx/physics-2d": "0.15.0",
61
- "@ignifx/vite-plugin": "0.15.0"
55
+ "@ignifx/2d": "0.16.0",
56
+ "@ignifx/3d": "0.16.0",
57
+ "@ignifx/core": "0.16.0",
58
+ "@ignifx/input": "0.16.0",
59
+ "@ignifx/physics": "0.16.0",
60
+ "@ignifx/physics-2d": "0.16.0",
61
+ "@ignifx/vite-plugin": "0.16.0"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@babylonjs/lite": "1.34.0",
65
65
  "vite": "^8.2.2",
66
- "@ignifx/core": "0.15.0",
67
- "@ignifx/vite-plugin": "0.15.0"
66
+ "@ignifx/core": "0.16.0",
67
+ "@ignifx/vite-plugin": "0.16.0"
68
68
  },
69
69
  "peerDependenciesMeta": {
70
70
  "@ignifx/vite-plugin": {
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: editor-host
3
- description: Connects an ignifx project to the ignifx editor with @ignifx/editor-host: the Vite plugin that serves the editor's scene view from the project's own dev server, the virtual:ignifx/editor play controls a game's main.ts hands its app to (play, pause, step, stop, playState, playStateChanged, playStats, screenshot, queryRuntime, sendInput), and the host half of the editor protocol 0.3 over a MessagePort (hello/ready, heartbeat, and the scene document methods openScene, applyOps, readBack, select, pick, frame, setGizmo, setViewMode, screenshot, getSchemas, describeSettings, setAnimateMaterials, getColliderOutlines, sampleAnimation), including the 2D view mode. Use when wiring a project or template for the editor, when the user mentions @ignifx/editor-host, editorHostPlugin, attachEditorPlayControls, virtual:ignifx/editor, startEditorHost or /__ignifx_editor__/, or when debugging why the editor cannot connect to a view or why the scene view disagrees with the editor's document.
3
+ description: Connects an ignifx project to the ignifx editor with @ignifx/editor-host: the Vite plugin that serves the editor's scene view from the project's own dev server, the virtual:ignifx/editor play controls a game's main.ts hands its app to (play, pause, step, stop, playState, playStateChanged, playStats, screenshot, queryRuntime, sendInput), and the host half of the editor protocol 0.3 over a MessagePort (hello/ready, heartbeat, and the scene document methods openScene, applyOps, readBack, select, pick, frame, setGizmo, setViewMode, screenshot, getSchemas, describeSettings, setAnimateMaterials, getColliderOutlines, sampleAnimation, sampleSpriteAnimation), including the 2D view mode. Use when wiring a project or template for the editor, when the user mentions @ignifx/editor-host, editorHostPlugin, attachEditorPlayControls, virtual:ignifx/editor, startEditorHost or /__ignifx_editor__/, or when debugging why the editor cannot connect to a view or why the scene view disagrees with the editor's document.
4
4
  license: Apache-2.0
5
5
  metadata:
6
- ignifx-version: "0.15.0"
6
+ ignifx-version: "0.16.0"
7
7
  ---
8
8
 
9
9
  # @ignifx/editor-host
@@ -25,7 +25,7 @@ editor's, even though its name starts with `editor-`.
25
25
 
26
26
  ## Environment
27
27
 
28
- - Engine: ignifx `0.15.0`; this package targets `@ignifx/core` `>=0.0.0 <1.0.0`.
28
+ - Engine: ignifx `0.16.0`; this package targets `@ignifx/core` `>=0.0.0 <1.0.0`.
29
29
  - Peers: `@ignifx/core` and `@babylonjs/lite` (the scene view's gizmos); for the `./vite` entry,
30
30
  `@ignifx/vite-plugin` and `vite`.
31
31
  - A development dependency of the project, at the same version as its `@ignifx/core`.
@@ -68,7 +68,9 @@ each view ◀── MessagePort ──▶ editor JSON-RPC 2.0, protocol 0.3
68
68
  connect (window message, origin-checked) → hello → ready → ping/pong, heartbeat
69
69
  scene view: schemasChanged → openScene → applyOps… / readBack / select / pick / frame / setGizmo / screenshot
70
70
  / setViewMode / getSchemas / describeSettings (on request only)
71
- / setAnimateMaterials / getColliderOutlines / sampleAnimation / setGrid (with a canvas)
71
+ / setAnimateMaterials / getColliderOutlines / sampleAnimation / sampleSpriteAnimation
72
+ / setGrid / setTilemapCells
73
+ / setEditorLines / clearEditorLines (with a canvas)
72
74
  ← sceneOpened, selectionChanged, transformDragging/Dragged, hotReloaded, assetReloaded,
73
75
  hostError, log
74
76
  play view: play / pause / step / stop / playState / playStats / screenshot (with a canvas)
@@ -369,6 +371,13 @@ object `openScene` sends, through `world.loadSceneFile`; `readBack` answers with
369
371
  entity without an `Animator`, or an engine refusal such as an unknown state (`data.code`
370
372
  `IGX-1202`), is `invalidParams`. The host finds `ignifx/Animator` by type id, so a project
371
373
  without `@ignifx/3d` simply has none.
374
+ - **A sprite frame on demand.** Every scene host lists the `spriteAnimation` capability and answers
375
+ `sampleSpriteAnimation { entity, clip, frame }` or `{ entity, clip, time }` (exactly one of the
376
+ two; `time` in seconds) with `{ posed }`: it calls `SpriteAnimator.sample(clip, frame)` or
377
+ `sampleTime(clip, time)` from `@ignifx/2d`, which writes the frame onto the entity's
378
+ `SpriteRenderer` and stops playback there. `posed` is `false` while the animation document or the
379
+ atlas loads. An entity without a `SpriteAnimator`, or an unknown clip (`data.code` `IGX-1108`), is
380
+ `invalidParams`. The host finds `ignifx/SpriteAnimator` by type id, as it does the `Animator`.
372
381
  - **Settings over the protocol.** `describeSettings` answers `{ sections, values }`: core's
373
382
  `describeSettings(app)` with each section's `settingsJsonSchema` entry as `propsSchema`, and the
374
383
  values the app resolved, in the settings form (`{ x, y, z }`, `{ r, g, b, a }`). No notification
@@ -387,6 +396,17 @@ object `openScene` sends, through `world.loadSceneFile`; `readBack` answers with
387
396
  its default (`visible: true`, `size: 1` metre, 0.001 to 1000). The grid starts visible at every
388
397
  load, so re-send the editor's state after `ready`. It is never picked or saved, and never in the
389
398
  play view; `screenshot` includes it while it is visible.
399
+ - **Live tilemap painting.** With a canvas the scene host lists `tilemapCells` and answers
400
+ `setTilemapCells { asset, layer, cells }`: `cells` are flat `[index, tile, …]` pairs in the
401
+ `.tilemap.json` file's order (row-major, top row first), `layer` a layer name or index. Every
402
+ loaded `Tilemap` of the open scene whose `map` is `asset` is written with `Tilemap.setCells`, so
403
+ the view shows the paint at once; the answer is `{ tilemaps, changed }`. The file is not
404
+ written: save it, or a reopen shows the file's cells again.
405
+ - **Editor lines.** With a canvas the scene host lists `editorLines` and draws the editor's own
406
+ line sets over the view in 3D and 2D: `setEditorLines { id, lines, color? }` (six numbers a
407
+ segment, world metres, as `getColliderOutlines` answers; `color` `[r, g, b, a?]`) replaces the
408
+ set `id`, `clearEditorLines { id? }` removes one or all. At most 64 sets of 100 000 segments;
409
+ never picked, saved or drawn in the game view; re-send them after `ready`.
390
410
  - **A changed asset reloads in place, not the view.** The scene view's page hands every
391
411
  `ignifx:asset-changed` event to `host.assetChanged`, which calls `app.assets.reload(address)` for an
392
412
  asset the app has loaded, of type `scene` (a scene or prefab), `model`, `mesh`, `material`,