From d1664472d5f3c80ffeefcc7c370282f1fb9f5806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Tue, 18 Aug 2026 11:57:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20UI=20=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E5=AD=97=E4=BD=93=E5=BC=95=E7=94=A8=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 按 FontSource::Bound 显式校验字体素材引用 保留系统字体不参与项目字体资产校验 --- .../src-tauri/src/ui_editor/persistence.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/persistence.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/persistence.rs index ad0da4f96..36bb8166e 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/persistence.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/persistence.rs @@ -1,4 +1,5 @@ use crate::ui_editor::component::Component; +use crate::ui_editor::component::text::FontSource; use crate::ui_editor::layout::node::Node; use crate::ui_editor::state::State; use crate::*; @@ -543,12 +544,10 @@ fn validate_node( } } Component::Text(text) => { - if text - .font - .as_ref() - .is_some_and(|id| !state.font_assets.contains_key(id)) - { - return Err("Text 组件引用了不存在的字体素材".to_string()); + if let FontSource::Bound(id) = &text.font { + if !state.font_assets.contains_key(id) { + return Err("Text 组件引用了不存在的字体素材".to_string()); + } } } }