You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6ea4f54
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/module-sdk.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -575,6 +575,30 @@ cloudApi.setWhatsNewSection(null); // removes it
575
575
The markdown is a safe subset: headings, bullets, **bold**, ```code``` and https links; anything else is shown as
576
576
text.
577
577
578
+
### For cloud plugin authors: scene changes and whole projects
579
+
580
+
New in @@VER@@ — what a plugin needs to keep a scene or a project somewhere else (theprototype.app's cloud saves and
581
+
kept rooms use them). All are additive: feature-detect each one (`typeofapi.onSceneChange==='function'`), and
582
+
nothing listens until a plugin calls them, so an app without a plugin behaves exactly as before.
583
+
584
+
```js
585
+
constrev=cloudApi.sceneRevision(); // a counter that moves on EVERY scene change, local or from a peer
586
+
constoff=cloudApi.onSceneChange((rev) => { /* something changed — debounce, then save */ });
587
+
constsig=awaitcloudApi.sceneSignature(); // the CONTENT identity of the open scene (a short hash)
588
+
const { blob, meta } =awaitcloudApi.buildSceneBundle({ signature:true }); // meta.signature = the same hash
589
+
constproject=awaitcloudApi.buildProjectBundle(); // the whole project as a .tp
590
+
awaitcloudApi.openRemoteProject({ url, title:'My project' }); // asks before replacing the project
591
+
```
592
+
593
+
| Call | What it does |
594
+
|---|---|
595
+
| `sceneRevision()` | a number that moves on every change to the scene — objects, graphs, animation, looks, sky, physics, music, HUD, game state. Compare two reads to know whether anything changed in between. `0` before the app has booted |
596
+
| `onSceneChange(fn)` | calls `fn(revision)` after every change from now on (never for the current value); returns `off` |
597
+
| `sceneSignature()` | a short hash of what the scene *is* (no ids, timestamps, thumbnail or game state). The revision also moves on internal refreshes, so "did the scene really change since I saved it?" is answered by comparing two signatures |
598
+
| `buildSceneBundle({signature:true})` | as before, plus `meta.signature`. Opt-in, because it is one more pass over the whole scene |
599
+
| `buildProjectBundle({versions?})` | the Explorer's own **Export project** bytes as `{blob, meta: {name, scenes, assets, items, bytes, appVersion}}`; downloads and changes nothing |
600
+
| `openRemoteProject({url, title?})` | fetches a `.tp` and opens it through the app's own path (format check, "This replaces your current project" confirm). View-only users are refused. Resolves the counts, or `null` when refused, declined or failed (the user saw why) |
601
+
578
602
## For module authors: pointer, camera, play mode and VR seat
579
603
580
604
New in 1.26 — the hooks [Race](race.md) uses to drive on a phone and in a headset, open to every module. Each is torn
0 commit comments