fix: retain prepared Ortho context for script PXP-OA

This commit is contained in:
codex
2026-08-04 14:25:44 +03:00
parent 3cecee4777
commit e707456ab6
3 changed files with 37 additions and 3 deletions
@@ -77,7 +77,9 @@ public sealed class EntryPoint : IExtensionApplication
// document lags behind MDI activation. Bind the planner to the
// command document captured above, which is also the observer's
// fixture identity.
var context = new PlantRuntimeContextReader().ReadCurrentContext(document);
var context = ScriptDrivenFirstApplyAutomation.TryGetPreparedContext(document, out var scriptContext)
? scriptContext
: new PlantRuntimeContextReader().ReadCurrentContext(document);
var details = new Dictionary<string, object?>
{
["ExecutionMode"] = mode.ToString(),
@@ -113,7 +115,8 @@ public sealed class EntryPoint : IExtensionApplication
var applyPermit = (mode == PRecAnnotExecutionMode.Apply || hasLimitedApplyPermit) && document is not null
? FirstLimitedApplyPermitReader.ReadFor(document)
: null;
var automationTarget = FirstLimitedApplyAutomationCoordinator.SelectedTargetSnapshotId;
var automationTarget = ScriptDrivenFirstApplyAutomation.SelectedTargetSnapshotId
?? FirstLimitedApplyAutomationCoordinator.SelectedTargetSnapshotId;
var limitedTarget = applyPermit?.TargetSnapshotId ?? automationTarget;
if (mode == PRecAnnotExecutionMode.Apply && context.Viewports.Count != 1)
throw new InvalidOperationException("APPLY_REQUIRES_EXACTLY_ONE_VIEWPORT");