mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 10:42:22 +00:00
Carry Sonar with the Minimal HUD layout in links and scene shots
A link or scene shot made in Minimal with Sonar on played back with Sonar off, and turned off the viewer's own. Tactical with Sonar keeps the `cyber` layout code, which older readers understand; Minimal with Sonar now carries an explicit mark beside its layout: flag bit 5 (`hudSonar`, default off) of a compact link, `hs=1` in the long form, and `hud.sonar: true` in a scene shot. A restore turns Sonar on when the state names Cyber or carries the mark, so a state made before it restores exactly as it did. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
c69a421678
commit
40e2998466
14 files changed
+266
-28
No files matched your search
@@ -36,7 +36,7 @@ function visual(value, path, legacy) {
|
||||
const specs = {
|
||||
bloom: { enabled: 'boolean', intensity: [-100, 10000], version: [1, 100] },
|
||||
sharpen: { enabled: 'boolean', intensity: [0, 100] },
|
||||
hud: { visible: 'boolean', variant: 'string' },
|
||||
hud: { visible: 'boolean', variant: 'string', sonar: 'boolean' },
|
||||
detection: {
|
||||
mode: 'string',
|
||||
density: [0, 100],
|
||||
|
||||
@@ -168,3 +168,30 @@ test('captured scope and extended detection edits survive migration', () => {
|
||||
project.scenes[0].shots[0].visual.detection,
|
||||
);
|
||||
});
|
||||
|
||||
test('a shot keeps Sonar beside its HUD layout; one without it reads as before', () => {
|
||||
const project = fixture();
|
||||
const shot = project.scenes[0].shots[0];
|
||||
shot.visual = { hud: { visible: true, variant: 'minimal', sonar: true } };
|
||||
const read = (p) =>
|
||||
normalizeProject(parseSceneDocument(JSON.stringify(p))).scenes[0].shots[0]
|
||||
.visual.hud;
|
||||
assert.deepEqual(read(project), {
|
||||
visible: true,
|
||||
variant: 'minimal',
|
||||
sonar: true,
|
||||
});
|
||||
// Older shots name no Sonar: the layout alone, Cyber included, as before.
|
||||
for (const variant of ['minimal', 'cyber']) {
|
||||
shot.visual = { hud: { visible: true, variant } };
|
||||
assert.deepEqual(read(project), { visible: true, variant });
|
||||
}
|
||||
// Off is the meaning of an absent field, so it is not kept.
|
||||
shot.visual = { hud: { variant: 'minimal', sonar: false } };
|
||||
assert.equal(Object.hasOwn(read(project), 'sonar'), false);
|
||||
shot.visual = { hud: { variant: 'minimal', sonar: 'on' } };
|
||||
assert.throws(
|
||||
() => validateSceneDocument(project),
|
||||
/\$\.scenes\[0\]\.shots\[0\]\.visual\.hud\.sonar/,
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user