fix(particle): 修复粒子系统在浏览器预览中的资产加载和渲染 (#290)

* fix(editor): 修复粒子实体创建和优化检视器

- 添加 effects 分类到右键菜单,修复粒子实体无法创建的问题
- 添加粒子效果的本地化标签
- 简化粒子组件检视器,优先显示资产文件选择
- 高级属性只在未选择资产时显示,且默认折叠
- 添加可折叠的属性分组提升用户体验

* fix(particle): 修复粒子系统在浏览器预览中的资产加载和渲染

- 添加粒子 Gizmo 支持,显示发射形状并响应 Transform 缩放/旋转
- 修复资产热重载:添加 reloadAsset() 方法和 assets:refresh 事件监听
- 修复 VectorFieldEditors 数值输入精度(step 改为 0.01)
- 修复浏览器预览中粒子资产加载失败的问题:
  - 将相对路径转换为绝对路径以正确复制资产文件
  - 使用原始 GUID 而非生成的 GUID 构建 asset catalog
  - 初始化全局 assetManager 单例的 catalog 和 loader
  - 在 GameRuntime 的 systemContext 中添加 engineIntegration
- 公开 AssetManager.initializeFromCatalog 方法供运行时使用
This commit is contained in:
YHH
2025-12-07 01:00:35 +08:00
committed by GitHub
parent 1fb702169e
commit 568b327425
22 changed files with 1628 additions and 782 deletions

View File

@@ -104,11 +104,22 @@ export class AssetManager implements IAssetManager {
return this._database;
}
/**
* Get the loader factory.
* 获取加载器工厂。
*/
getLoaderFactory(): AssetLoaderFactory {
return this._loaderFactory as AssetLoaderFactory;
}
/**
* Initialize from catalog
* 从目录初始化
*
* Can be called after construction to load catalog entries.
* 可在构造后调用以加载目录条目。
*/
private initializeFromCatalog(catalog: IAssetCatalog): void {
initializeFromCatalog(catalog: IAssetCatalog): void {
catalog.entries.forEach((entry, guid) => {
const metadata: IAssetMetadata = {
guid,

View File

@@ -12,9 +12,11 @@ import {
IAssetLoadResult,
IAssetReferenceInfo,
IAssetPreloadGroup,
IAssetLoadProgress
IAssetLoadProgress,
IAssetCatalog
} from '../types/AssetTypes';
import { IAssetLoader } from './IAssetLoader';
import { IAssetReader } from './IAssetReader';
/**
* Asset manager interface
@@ -150,6 +152,21 @@ export interface IAssetManager {
* 释放管理器
*/
dispose(): void;
/**
* Set asset reader
* 设置资产读取器
*/
setReader(reader: IAssetReader): void;
/**
* Initialize from catalog
* 从目录初始化
*
* Loads asset metadata from a catalog for runtime asset resolution.
* 从目录加载资产元数据,用于运行时资产解析。
*/
initializeFromCatalog(catalog: IAssetCatalog): void;
}
/**