fix: check vertices before skin load so WotLK (v264) character M2s parse correctly

TBC races like Draenei use version-264 M2 files with no embedded skin;
indices come from a separate .skin file loaded after M2::load().
The premature isValid() check (which requires non-empty indices) always
failed for WotLK-format character models, making Draenei (and Blood Elf)
players invisible.

Fix: only check vertices.empty() right after load(), then validate fully
with isValid() after the skin file is loaded.
This commit is contained in:
Kelsi 2026-03-13 02:58:42 -07:00
parent 27213c1d40
commit 8f3f1b21af

View file

@ -6612,7 +6612,7 @@ void Application::spawnOnlinePlayer(uint64_t guid,
}
pipeline::M2Model model = pipeline::M2Loader::load(m2Data);
if (!model.isValid() || model.vertices.empty()) {
if (model.vertices.empty()) {
LOG_WARNING("spawnOnlinePlayer: failed to parse M2: ", m2Path);
return;
}
@ -6624,6 +6624,12 @@ void Application::spawnOnlinePlayer(uint64_t guid,
pipeline::M2Loader::loadSkin(skinData, model);
}
// After skin loading, full model must be valid (vertices + indices)
if (!model.isValid()) {
LOG_WARNING("spawnOnlinePlayer: failed to load skin for M2: ", m2Path);
return;
}
// Load only core external animations (stand/walk/run) to avoid stalls
for (uint32_t si = 0; si < model.sequences.size(); si++) {
if (!(model.sequences[si].flags & 0x20)) {