mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
Fix Stories history and paused playback
This commit is contained in:
1 parent
472cc35c47
commit
2edcd5bc69
7 files changed
+144
-28
No files matched your search
+12
-8
@@ -1813,15 +1813,17 @@ export class SceneDirector {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Seek the complete authored scene state to an exact clock position. */
|
||||
seekScene(sceneId, progress) {
|
||||
/** Seek to an exact position. Reopening a scene can reload its authored look. */
|
||||
seekScene(sceneId, progress, { reloadShot = false } = {}) {
|
||||
if (this._destroyed) return Promise.resolve(false);
|
||||
this.stopScene(msg('Seeking scene clock'));
|
||||
const generation = this._bumpSceneSeekGeneration();
|
||||
return this._trackWork(this._seekScene(sceneId, progress, generation));
|
||||
return this._trackWork(
|
||||
this._seekScene(sceneId, progress, generation, reloadShot),
|
||||
);
|
||||
}
|
||||
|
||||
async _seekScene(sceneId, progress, generation) {
|
||||
async _seekScene(sceneId, progress, generation, reloadShot) {
|
||||
const scene = this._project.scenes.find(({ id }) => id === sceneId);
|
||||
if (!scene?.shots?.length) return false;
|
||||
if (this._running) {
|
||||
@@ -1831,10 +1833,12 @@ export class SceneDirector {
|
||||
return false;
|
||||
const seekState = this._sceneSeekState(scene, progress);
|
||||
if (!seekState) return false;
|
||||
const seeked = await this._seekLoadedShot(scene, seekState, generation);
|
||||
if (this._destroyed || generation !== this._sceneSeekGeneration)
|
||||
return false;
|
||||
if (seeked !== null) return seeked;
|
||||
if (!reloadShot) {
|
||||
const seeked = await this._seekLoadedShot(scene, seekState, generation);
|
||||
if (this._destroyed || generation !== this._sceneSeekGeneration)
|
||||
return false;
|
||||
if (seeked !== null) return seeked;
|
||||
}
|
||||
const result = await this._loadShot(scene.id, seekState.shot.id, {
|
||||
sceneSeek: seekState,
|
||||
});
|
||||
|
||||
@@ -505,10 +505,13 @@ test('refused same-shot seek rollback keeps a manual toggle still in flight', as
|
||||
}
|
||||
});
|
||||
|
||||
test('same-shot seeking keeps the shortcut when declared visibility is unchanged', async () => {
|
||||
const { director, dataManager, styleManager, restore } = makeDirector();
|
||||
test('reopening the same shot reapplies its look while ordinary seeks reuse it', async () => {
|
||||
const project = structuredClone(PROJECT_FIXTURE);
|
||||
project.scenes[0].shots[0].visual.style = 'retro';
|
||||
const { director, dataManager, styleManager, restore } = makeDirector({ project });
|
||||
try {
|
||||
await director.loadShot('scene-1', 'shot-a', { flyDuration: 0 });
|
||||
await styleManager.applyVisualState({ style: 'normal' });
|
||||
await dataManager.setEnabled('satellites', true);
|
||||
dataManager.setEnabledCalls.length = 0;
|
||||
const visualCalls = styleManager.visualCalls.length;
|
||||
@@ -517,6 +520,13 @@ test('same-shot seeking keeps the shortcut when declared visibility is unchanged
|
||||
assert.deepEqual(dataManager.setEnabledCalls, []);
|
||||
assert.equal(styleManager.visualCalls.length, visualCalls);
|
||||
assert.equal(director.getPlaybackTimingState().snapshot.sceneProgress, 0.25);
|
||||
|
||||
assert.equal(await director.seekScene('scene-1', 0.25, { reloadShot: true }), true);
|
||||
assert.equal(styleManager.visualCalls.length, visualCalls + 1);
|
||||
assert.equal(styleManager.visualStates.at(-1).style, 'retro');
|
||||
const { sceneProgress, seeking } = director.getPlaybackTimingState().snapshot;
|
||||
assert.equal(sceneProgress, 0.25);
|
||||
assert.equal(seeking, true);
|
||||
} finally {
|
||||
await director.destroy();
|
||||
restore();
|
||||
|
||||
Reference in new issue
Block a user