fix: reuse scenes for on-air refresh

This commit is contained in:
2026-07-11 12:13:30 +09:00
parent 3e3292b8a9
commit d11abfa567
2 changed files with 100 additions and 52 deletions

View File

@@ -413,9 +413,16 @@ internal sealed class DynamicK3dSession : IK3dGuardedConnectSession
try
{
nextScene = new SceneReference(
InvokeRequired(engine, "LoadScene", cue.SceneFile, cue.SceneName),
cue.SceneName);
// MainForm refreshes the selected DTO immediately before TAKE IN and
// Page NEXT can target the alias already on air. Tornado2 rejects a
// second LoadScene for an alias it still owns, so mutate and re-Prepare
// the retained loaded scene instead of creating a duplicate alias.
nextScene =
ReusableScene(_preparedScene, cue.SceneName) ??
ReusableScene(_currentScene, cue.SceneName) ??
new SceneReference(
InvokeRequired(engine, "LoadScene", cue.SceneFile, cue.SceneName),
cue.SceneName);
if (outputChannel.HasValue)
{
Invoke(nextScene.Value, "SetOutputChannelIndex", outputChannel.GetValueOrDefault());
@@ -548,10 +555,16 @@ internal sealed class DynamicK3dSession : IK3dGuardedConnectSession
try
{
// MainForm.timer1_Tick replays the current layout before entering
// Show_PlayList(idx: 1), then prepares and plays the mutated scene again.
InvokeTrackedPlay(layoutIndex);
playingScene = InvokeRequired(player, "GetPlayingScene", layoutIndex);
foreach (var mutation in cue.Mutations ?? [])
{
if (IsBeforeTransactionSceneSetupMutation(mutation))
{
ApplySceneSetupMutation(playingScene, mutation);
}
}
Invoke(engine, "BeginTransaction");
transactionStarted = true;
@@ -562,11 +575,12 @@ internal sealed class DynamicK3dSession : IK3dGuardedConnectSession
foreach (var mutation in cue.Mutations ?? [])
{
// The legacy idx == 1 path updates the playing scene in place. It does not
// reapply scene-level background setup or the scene transition effect.
if (!IsSceneLevelMutation(mutation))
// Match Show_PlayList(idx: 1): common background setup runs before the
// transaction, while builder-owned setup and object changes keep their
// explicit in-transaction ordering.
if (!IsBeforeTransactionSceneSetupMutation(mutation))
{
ApplyMutation(playingScene, mutation);
ApplyTransactionMutation(playingScene, mutation);
}
}
@@ -1080,6 +1094,14 @@ internal sealed class DynamicK3dSession : IK3dGuardedConnectSession
}
}
private static SceneReference? ReusableScene(
SceneReference? scene,
string sceneName) =>
scene is not null &&
string.Equals(scene.Name, sceneName, StringComparison.OrdinalIgnoreCase)
? scene
: null;
private void MoveAllScenesToPendingTakeOut()
{
AddDistinctScene(_pendingTakeOutScenes, _preparedScene);