feat(workspace): render a project on this PC from its originals
A workspace project that holds its originals now renders locally (JobKind.WorkspaceRender), so the full-resolution render no longer waits on the home. This holds also when the home is a server. - The handler reads its inputs under the project's lease. It refuses proxies-only media, and it refuses frames without an original, saying how many lack one. It renders into exports/ with unique names and a resumable checkpoint. - Each output gets a ledger entry: SHA-256, the render id from RenderJobHandler.RenderId, and the version, recorded only when versions/ holds it and its hash verifies. - After rendering, the handler queues a WorkspaceSend follow-up for the outputs it recorded. A cancel leaves no partial file. - The editor routes Originals media to the local engine even for a server home, and lists those jobs beside the server's. It treats WorkspaceRender like Render for the toast and the reload, says "Sent home" when a send ends, and shows unsent ledger renders as "Not sent". - Version on render saves a changed project as a version noted "Render" before it renders, and sends it with Sync automatically. With the setting off, the render behaves as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0c51d11080
commit
59e7aca006
12 files changed
+779
-32
No files matched your search
@@ -252,12 +252,15 @@ public sealed class ProjectMenuViewModel : LocalizedViewModel
|
||||
/// <summary>
|
||||
/// Before a render (phase 5b): a project whose home is a server renders what the server holds, so changes not saved as a
|
||||
/// version, or versions not sent, are first offered to be saved and sent (Sync); false when the user kept them here,
|
||||
/// the server could not take them or no longer has the project, or a conflict waits. A project of this PC's archive
|
||||
/// renders as it is: true.
|
||||
/// the server could not take them or no longer has the project, or a conflict waits. A project of this PC's archive,
|
||||
/// or one rendered on this PC from its originals (phase 5c), renders as it is: true. With Settings › Workspace › Version
|
||||
/// on render, a changed project is saved as a version first (<see cref="SaveForRenderAsync"/>).
|
||||
/// </summary>
|
||||
public async Task<bool> ReadyToRenderAsync()
|
||||
{
|
||||
if (!IsServerHome) return true;
|
||||
if (_host.Settings.WorkspaceVersionOnRender && !await SaveForRenderAsync()) return false;
|
||||
// Rendered on this PC from the originals the workspace holds (phase 5c): the project renders as it is.
|
||||
if (!IsServerHome || _source.RendersLocally) return true;
|
||||
await StoreEditAsync();
|
||||
var status = await _host.StatusAsync(ProjectId);
|
||||
if (_disposed) return false;
|
||||
@@ -296,6 +299,45 @@ public sealed class ProjectMenuViewModel : LocalizedViewModel
|
||||
return !_disposed && _source.InStepWithHome(_session.Project) is not null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Settings › Workspace › Version on render (phase 5c): a project changed since its last version is saved as a version
|
||||
/// noted "Render" before its render, and sent at once with Sync automatically when the home can be reached (out of reach,
|
||||
/// it waits here). False when it could not be saved, or the sync met a conflict to settle first.
|
||||
/// </summary>
|
||||
private async Task<bool> SaveForRenderAsync()
|
||||
{
|
||||
await StoreEditAsync();
|
||||
var status = await _host.StatusAsync(ProjectId);
|
||||
if (_disposed) return false;
|
||||
Apply(status);
|
||||
if (!status.Modified || !CanSaveVersion) return true;
|
||||
WorkspaceSaveResult result;
|
||||
try
|
||||
{
|
||||
result = await _host.SaveVersionAsync(ProjectId, Loc.L("Editor.Workspace.RenderNote"));
|
||||
}
|
||||
catch (Exception ex) when (ex is not OutOfMemoryException)
|
||||
{
|
||||
Log.Warning("workspace", $"Project {ProjectId} could not be saved before its render", ex);
|
||||
_ui.Notify(Loc.L("Editor.Workspace.RenderHeld"), WorkspaceText.Failure(ex, IsServerHome), isError: true);
|
||||
return false;
|
||||
}
|
||||
if (_disposed) return false;
|
||||
Apply(result.Status);
|
||||
if (result.Synced is { } taken) await TakeAsync(taken);
|
||||
if (result.Version is { } version)
|
||||
{
|
||||
// The home numbers what it stores: the last one sent is this version.
|
||||
var number = result.Synced is { Pushed.Count: > 0 } synced ? synced.Pushed[^1].Number : version.Number;
|
||||
_ui.Notify(Loc.L("Editor.Workspace.SavedForRender", Formatting.Count(number)), Name);
|
||||
}
|
||||
if (result.SyncError is { } error)
|
||||
_ui.Notify(Loc.L("Editor.Workspace.NotSent"), WorkspaceText.Failure(error, IsServerHome), isError: error is not HomeUnavailableException);
|
||||
if (result.Status.Conflict is not { } conflict) return true;
|
||||
AskConflict(conflict);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the working state as a version with <paramref name="note"/>, sent at once with Sync automatically; what the
|
||||
/// sync took from the home comes into the editor, a conflict it met is asked about.
|
||||
|
||||
Reference in new issue
Block a user