From aa6b692a58cbb5a7aca7c340ec90689c9a2eb929 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 02:15:13 -0700 Subject: [PATCH] fix(wob): convert .png texture paths back to .blp in toWMOModel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WMORenderer's PNG override system only triggers when the requested texture path ends in .blp — it strips the .blp and probes for .png. WoB stores .png paths (because fromWMO converts .blp->.png at conversion time), so passing them straight through to the WMOModel meant the override wasn't engaged and textures didn't load. Now converts back to .blp so the existing override pipeline picks up the PNG file. --- src/pipeline/wowee_building.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/pipeline/wowee_building.cpp b/src/pipeline/wowee_building.cpp index aed82865..e6f61e20 100644 --- a/src/pipeline/wowee_building.cpp +++ b/src/pipeline/wowee_building.cpp @@ -206,12 +206,21 @@ bool WoweeBuildingLoader::toWMOModel(const WoweeBuilding& building, WMOModel& ou // Build a global texture index from per-material texturePath strings. // First-group materials become the WMO material list; each unique texture // gets one entry in outModel.textures. + + // Reverse the .blp -> .png conversion that fromWMO did, since the WMO + // renderer's PNG override system only triggers when the requested texture + // path ends in .blp (it then probes for a .png next to the cache file). auto textureIndex = [&](const std::string& path) -> uint32_t { - if (path.empty()) return 0; - for (uint32_t i = 0; i < outModel.textures.size(); i++) { - if (outModel.textures[i] == path) return i; + std::string p = path; + if (p.size() >= 4) { + std::string ext = p.substr(p.size() - 4); + if (ext == ".png" || ext == ".PNG") p = p.substr(0, p.size() - 4) + ".blp"; } - outModel.textures.push_back(path); + if (p.empty()) return 0; + for (uint32_t i = 0; i < outModel.textures.size(); i++) { + if (outModel.textures[i] == p) return i; + } + outModel.textures.push_back(p); return static_cast(outModel.textures.size() - 1); };