feat(editor): manual mesh renderer setup + asset hover info card

Mesh Renderer was missing from the Add Component menu and its model
reference was read-only, so a mesh could only be attached by loading
a saved scene. Add it to the menu (Unity Add Component semantics) and
give the block a UE-Details-style asset slot: a dropdown listing all
model files under assets/, selecting applies LoadModel (cache deduped).

Asset browser files now show a UE Content Browser style hover card:
kind, size, modified time, and loaded state (new AssetCache::Contains
query, read-only -- hovering never triggers loading).

Fix latent FATALs unlocked by manual assignment: AssetCache::Get
aborts on invalid handles, so rendering, animation sampling, and mesh
collider build now guard mr.model.Valid() before calling it.
This commit is contained in:
2026-10-04 01:07:38 +08:00
parent 7d02d344e5
commit 69671cf4eb
5 changed files with 156 additions and 14 deletions
@@ -122,6 +122,12 @@ namespace Engine
return static_cast<u32>(m_Entries.size()) - static_cast<u32>(m_Free.size());
}
// 路径是否在缓存(含被卸载后路径清除的语义:卸载即不含)
bool Contains(const std::string& path) const
{
return m_ByPath.find(path) != m_ByPath.end();
}
private:
struct Entry
{
@@ -170,6 +176,16 @@ namespace Engine
DecodedEquirect&& decoded);
Cubemap* GetEnvironment(EnvRef h) const { return m_Environments.Get(h); }
// 路径缓存查询(面板显示加载状态用;不触发加载)
bool IsModelLoaded(const std::string& path) const
{
return m_Models.Contains(path);
}
bool IsEnvironmentLoaded(const std::string& path) const
{
return m_Environments.Contains(path);
}
AssetCache<Model>& Models() { return m_Models; }
// ---- 资产 GUID 注册表(UE AssetRegistry 模式:中央注册表)----