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
View File
@@ -394,6 +394,7 @@ namespace Engine
scene.Each<MeshRendererComponent, AnimationComponent>(
[&](Entity entity, MeshRendererComponent& mr, AnimationComponent& anim) {
if (!anim.active) return; // 组件禁用 = 暂停采样(播放头不动)
if (!mr.model.Valid()) return; // 未指派/手清 = 无效句柄(Get 对无效 FATAL)
const Model* model = assets.GetModel(mr.model);
if (!model || !model->HasAnimations()) return;
const auto& clips = model->GetClips();
@@ -516,6 +517,7 @@ namespace Engine
scene.Each<TransformComponent, MeshRendererComponent>(
[&](Entity entity, TransformComponent& t, MeshRendererComponent& mr) {
if (!mr.active) return; // 组件禁用 = 不渲染不拾取
if (!mr.model.Valid()) return; // 未指派 = 无效句柄(Get 对无效 FATAL)
Model* model = assets.GetModel(mr.model);
if (!model) return;