完善素材分离恢复与步骤映射
回填部分失败时重新读取恢复状态;移除冗余类型断言并改用显式步骤映射。
This commit is contained in:
@@ -413,12 +413,11 @@ export function useUiEditorSession(
|
||||
resourceId !== undefined &&
|
||||
savedStateSignature !== null &&
|
||||
savedStateSignature !== stateSignature;
|
||||
const nextStep: UiEditorStepId | null =
|
||||
activeStep === 'reference-analysis'
|
||||
? 'structure-recognition'
|
||||
: activeStep === 'structure-recognition'
|
||||
? 'asset-separation'
|
||||
: null;
|
||||
const nextStepByStep: Partial<Record<UiEditorStepId, UiEditorStepId>> = {
|
||||
'reference-analysis': 'structure-recognition',
|
||||
'structure-recognition': 'asset-separation',
|
||||
};
|
||||
const nextStep = nextStepByStep[activeStep] ?? null;
|
||||
|
||||
const spriteReferenceCounts = useMemo(() => {
|
||||
const counts: Record<string, number> = {};
|
||||
@@ -1195,13 +1194,18 @@ export function useUiEditorSession(
|
||||
}));
|
||||
if (separationResult === null)
|
||||
throw new Error('自动切分素材没有返回结果');
|
||||
const completedResult = separationResult as SeparationDTO;
|
||||
const completedResult = separationResult;
|
||||
if (!(await save({ allowDuringSeparation: true }))) {
|
||||
throw new Error(
|
||||
'自动切分素材结果已写入编辑器,但 State 保存失败;sidecar 已保留,可继续恢复。',
|
||||
);
|
||||
}
|
||||
if (backfillErrors.length > 0) {
|
||||
const recovery = await invoke<SeparationRecoveryDTO>(
|
||||
'inspect_separation_recovery',
|
||||
{ projectPath, assetId: resourceId },
|
||||
);
|
||||
setSeparationRecovery(recovery);
|
||||
reportWorkflowCompletion(
|
||||
'asset-separation',
|
||||
'failure',
|
||||
|
||||
Reference in New Issue
Block a user