diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow.rs index 2d3cbb5ff..a17c07926 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/workflow.rs @@ -380,6 +380,7 @@ pub(crate) async fn separate_ui_impl( } }; let mut cut_paths = std::collections::HashMap::new(); + let mut cut_error = None; for decision in &binding.decisions { if let BindingDecision::Ok { to_node, @@ -387,10 +388,24 @@ pub(crate) async fn separate_ui_impl( } = decision { let cut_path = sidecar.join(format!("cut-{}.png", to_node.as_str())); - cut_processed_image(&processed_path, separated_image_area, &cut_path)?; - cut_paths.insert(to_node.clone(), cut_path.to_string_lossy().to_string()); + match cut_processed_image(&processed_path, separated_image_area, &cut_path) { + Ok(()) => { + cut_paths + .insert(to_node.clone(), cut_path.to_string_lossy().to_string()); + } + Err(error) => { + cut_error = + Some(format!("节点 {} 的分离区域无效:{error}", to_node.as_str())); + break; + } + } } } + if let Some(error) = cut_error { + mark_batch_problematic(&mut separation, tree_index, &batch, error); + write_separation_state(&state_path, &separation)?; + continue; + } apply_batch_patch(&mut separation, tree_index, &binding.decisions, &cut_paths)?; write_separation_state(&state_path, &separation)?; }