feat(asset): 统一资产引用使用 GUID 替代路径 (#287)
* feat(world-streaming): 添加世界流式加载系统 实现基于区块的世界流式加载系统,支持开放世界游戏: 运行时包 (@esengine/world-streaming): - ChunkComponent: 区块实体组件,包含坐标、边界、状态 - StreamingAnchorComponent: 流式锚点组件(玩家/摄像机) - ChunkLoaderComponent: 流式加载配置组件 - ChunkStreamingSystem: 区块加载/卸载调度系统 - ChunkCullingSystem: 区块可见性剔除系统 - ChunkManager: 区块生命周期管理服务 - SpatialHashGrid: 空间哈希网格 - ChunkSerializer: 区块序列化 编辑器包 (@esengine/world-streaming-editor): - ChunkVisualizer: 区块可视化覆盖层 - ChunkLoaderInspectorProvider: 区块加载器检视器 - StreamingAnchorInspectorProvider: 流式锚点检视器 - WorldStreamingPlugin: 完整插件导出 * feat(asset): 统一资产引用使用 GUID 替代路径 将所有组件的资产引用字段从路径改为 GUID: - SpriteComponent: texture -> textureGuid, material -> materialGuid - SpriteAnimatorComponent: AnimationFrame.texture -> textureGuid - UIRenderComponent: texture -> textureGuid - UIButtonComponent: normalTexture -> normalTextureGuid 等 - AudioSourceComponent: clip -> clipGuid - ParticleSystemComponent: 已使用 textureGuid 修复 AssetRegistryService 注册问题和路径规范化, 添加渲染系统的 GUID 解析支持。 * fix(sprite-editor): 更新 material 为 materialGuid * fix(editor-app): 更新 AnimationFrame.texture 为 textureGuid
This commit is contained in:
@@ -626,7 +626,7 @@ function MaterialOverrideEditor({ sprite, material, onChange }: MaterialOverride
|
||||
onChange('materialOverrides', newOverrides);
|
||||
};
|
||||
|
||||
if (!sprite.material) {
|
||||
if (!sprite.materialGuid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -871,10 +871,10 @@ function SpriteInspectorContent({ context }: { context: ComponentInspectorContex
|
||||
const [material, setMaterial] = useState<Material | null>(null);
|
||||
const [, forceUpdate] = useState({});
|
||||
|
||||
// Load material when sprite.material changes.
|
||||
// 当 sprite.material 变化时加载材质。
|
||||
// Load material when sprite.materialGuid changes.
|
||||
// 当 sprite.materialGuid 变化时加载材质。
|
||||
useEffect(() => {
|
||||
if (!sprite.material) {
|
||||
if (!sprite.materialGuid) {
|
||||
setMaterial(null);
|
||||
return;
|
||||
}
|
||||
@@ -887,7 +887,7 @@ function SpriteInspectorContent({ context }: { context: ComponentInspectorContex
|
||||
|
||||
// Try to get cached material by ID.
|
||||
// 尝试通过 ID 获取缓存的材质。
|
||||
const materialId = materialManager.getMaterialIdByPath(sprite.material);
|
||||
const materialId = materialManager.getMaterialIdByPath(sprite.materialGuid);
|
||||
if (materialId > 0) {
|
||||
const mat = materialManager.getMaterial(materialId);
|
||||
setMaterial(mat || null);
|
||||
@@ -896,7 +896,7 @@ function SpriteInspectorContent({ context }: { context: ComponentInspectorContex
|
||||
|
||||
// Load material asynchronously.
|
||||
// 异步加载材质。
|
||||
materialManager.loadMaterialFromPath(sprite.material)
|
||||
materialManager.loadMaterialFromPath(sprite.materialGuid)
|
||||
.then(matId => {
|
||||
const mat = materialManager.getMaterial(matId);
|
||||
setMaterial(mat || null);
|
||||
@@ -904,7 +904,7 @@ function SpriteInspectorContent({ context }: { context: ComponentInspectorContex
|
||||
.catch(() => {
|
||||
setMaterial(null);
|
||||
});
|
||||
}, [sprite.material]);
|
||||
}, [sprite.materialGuid]);
|
||||
|
||||
const handleChange = useCallback((propertyName: string, value: unknown) => {
|
||||
(sprite as unknown as Record<string, unknown>)[propertyName] = value;
|
||||
@@ -930,7 +930,7 @@ function SpriteInspectorContent({ context }: { context: ComponentInspectorContex
|
||||
}, []);
|
||||
|
||||
// No material selected
|
||||
if (!sprite.material) {
|
||||
if (!sprite.materialGuid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -940,7 +940,7 @@ function SpriteInspectorContent({ context }: { context: ComponentInspectorContex
|
||||
{material && (
|
||||
<InlineMaterialEditor
|
||||
material={material}
|
||||
materialPath={sprite.material}
|
||||
materialPath={sprite.materialGuid}
|
||||
onMaterialChange={handleMaterialChange}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user