mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 09:03:52 +00:00
fix(editor): always load M2 skin file for NPC models
WotLK M2 models store geometry in separate .skin files. The NPC renderer was only loading skin files when M2Loader::load() returned invalid (empty vertices). But some M2 files have vertices in the header yet need the skin file for indices, batches, and submeshes. Now always attempts to load the skin file regardless of initial isValid() state. This fixes creature models not rendering even when the M2 and skin files exist on disk. Also improved debug logging to show vertex/index counts when models fail to load, making it easier to diagnose remaining issues.
This commit is contained in:
parent
92787901d8
commit
47bfe35b26
1 changed files with 8 additions and 3 deletions
|
|
@ -241,11 +241,12 @@ void EditorViewport::rebuildObjects(const std::vector<PlacedObject>& objects,
|
|||
} else {
|
||||
auto data = assetManager_->readFile(npc.modelPath);
|
||||
if (data.empty()) {
|
||||
LOG_DEBUG("NPC model not found (showing marker): ", npc.modelPath);
|
||||
LOG_DEBUG("NPC model file not found: ", npc.modelPath);
|
||||
continue;
|
||||
}
|
||||
auto model = pipeline::M2Loader::load(data);
|
||||
if (!model.isValid()) {
|
||||
// Always try loading skin file (WotLK M2s need it for geometry)
|
||||
{
|
||||
std::string skinPath = npc.modelPath;
|
||||
auto dotPos = skinPath.rfind('.');
|
||||
if (dotPos != std::string::npos)
|
||||
|
|
@ -254,7 +255,11 @@ void EditorViewport::rebuildObjects(const std::vector<PlacedObject>& objects,
|
|||
if (!skinData.empty())
|
||||
pipeline::M2Loader::loadSkin(skinData, model);
|
||||
}
|
||||
if (!model.isValid()) continue;
|
||||
if (!model.isValid()) {
|
||||
LOG_DEBUG("NPC model invalid after skin load: ", npc.modelPath,
|
||||
" (verts=", model.vertices.size(), " idx=", model.indices.size(), ")");
|
||||
continue;
|
||||
}
|
||||
if (model.boundRadius < 1.0f) model.boundRadius = 50.0f;
|
||||
// Validate vertex data
|
||||
bool ok = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue