feat(editor): export WMO textures with the zone

Placed WMO buildings reference textures (walls, floors, decorations) that
were not being exported alongside the WOB files. Added collectWMOTextures()
which loads the root WMO + all group files and gathers every texture path,
then folds these into the same PNG export pass that handles terrain and M2
textures. Exported zones now have every texture they need across all model
types.
This commit is contained in:
Kelsi 2026-05-06 01:40:05 -07:00
parent a711a92875
commit f1d332825e
3 changed files with 47 additions and 1 deletions

View file

@ -1152,13 +1152,20 @@ void EditorApp::exportZone(const std::string& outputDir) {
std::unordered_set<std::string> uniq;
for (auto& t : TextureExporter::collectUsedTextures(terrain_)) uniq.insert(std::move(t));
std::unordered_set<std::string> visitedM2;
std::unordered_set<std::string> visitedWMO;
auto addM2Tex = [&](const std::string& m2Path) {
if (m2Path.empty() || !visitedM2.insert(m2Path).second) return;
for (auto& t : TextureExporter::collectM2Textures(assetManager_.get(), m2Path))
uniq.insert(std::move(t));
};
auto addWMOTex = [&](const std::string& wmoPath) {
if (wmoPath.empty() || !visitedWMO.insert(wmoPath).second) return;
for (auto& t : TextureExporter::collectWMOTextures(assetManager_.get(), wmoPath))
uniq.insert(std::move(t));
};
for (const auto& obj : objectPlacer_.getObjects()) {
if (obj.type == PlaceableType::M2) addM2Tex(obj.path);
else if (obj.type == PlaceableType::WMO) addWMOTex(obj.path);
}
for (const auto& npc : npcSpawner_.getSpawns()) addM2Tex(npc.modelPath);
@ -1167,7 +1174,8 @@ void EditorApp::exportZone(const std::string& outputDir) {
if (!usedTextures.empty()) {
int exported = TextureExporter::exportTexturesAsPng(
assetManager_.get(), usedTextures, base + "/textures");
LOG_INFO("Exported ", exported, " textures as PNG (terrain + ", visitedM2.size(), " M2s)");
LOG_INFO("Exported ", exported, " textures as PNG (terrain + ",
visitedM2.size(), " M2s + ", visitedWMO.size(), " WMOs)");
}
}