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
+2 -2
View File
@@ -685,8 +685,8 @@ namespace Engine {
// 同实体 MeshRenderer 提供网格;缺失 → 回退(CreateBody 判 null 走 Box)
auto *mc = m_Scene.GetRegistry().try_get<ECS::MeshRendererComponent>(
static_cast<entt::entity>(entityBits));
if (m_Assets == nullptr || mc == nullptr) {
return nullptr;
if (m_Assets == nullptr || mc == nullptr || !mc->model.Valid()) {
return nullptr; // 无效句柄(未指派)不进 Get(对无效 FATAL)
}
const Model *model = m_Assets->GetModel(mc->model);
if (model == nullptr) {