feat(editor): show scene preview immediately and optimize in background
Return control after copying the original asset, then run image optimization and thumbnail generation in the background with IPC progress updates. Block duplicate preview uploads and scene creation while requests are in flight. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -55,6 +55,7 @@ export const ipcChannels = {
|
||||
deleteProject: 'project.deleteProject',
|
||||
importZipProgress: 'project.importZipProgress',
|
||||
exportZipProgress: 'project.exportZipProgress',
|
||||
scenePreviewImportProgress: 'project.scenePreviewImportProgress',
|
||||
},
|
||||
windows: {
|
||||
openMultiWindow: 'windows.openMultiWindow',
|
||||
@@ -97,6 +98,14 @@ export type ZipProgressEvent = {
|
||||
detail?: string;
|
||||
};
|
||||
|
||||
export type ScenePreviewImportEvent = {
|
||||
sceneId: SceneId;
|
||||
assetId: AssetId;
|
||||
phase: 'queued' | 'optimizing' | 'thumbnail' | 'done' | 'error';
|
||||
project?: Project;
|
||||
message?: string;
|
||||
};
|
||||
|
||||
export type UpdaterCheckResponse =
|
||||
| { outcome: 'not_packaged' }
|
||||
| { outcome: 'no_license' }
|
||||
@@ -131,6 +140,7 @@ export type IpcEventMap = {
|
||||
[ipcChannels.windows.multiWindowStateChanged]: { open: boolean };
|
||||
[ipcChannels.project.importZipProgress]: ZipProgressEvent;
|
||||
[ipcChannels.project.exportZipProgress]: ZipProgressEvent;
|
||||
[ipcChannels.project.scenePreviewImportProgress]: ScenePreviewImportEvent;
|
||||
[ipcChannels.updater.progress]: UpdaterProgressEvent;
|
||||
};
|
||||
|
||||
@@ -205,7 +215,7 @@ export type IpcInvokeMap = {
|
||||
};
|
||||
[ipcChannels.project.importScenePreview]: {
|
||||
req: { sceneId: SceneId };
|
||||
res: { project: Project };
|
||||
res: { project: Project; assetId: AssetId | null; background: boolean };
|
||||
};
|
||||
[ipcChannels.project.clearScenePreview]: {
|
||||
req: { sceneId: SceneId };
|
||||
|
||||
Reference in New Issue
Block a user