修复 UI 文本字体引用校验
按 FontSource::Bound 显式校验字体素材引用 保留系统字体不参与项目字体资产校验
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user