mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-07 01:23:52 +00:00
feat(wob): tryLoadByGamePath helper, used by editor + terrain_manager
Mirrors the WOM tryLoadByGamePath API: probes custom_zones/buildings/ + output/buildings/ by default, with optional extraPrefixes (e.g. per-zone output/<map>/buildings/) checked first. Both the editor and the main game's terrain_manager now use the helper, removing duplicate inline lookup loops in two more places.
This commit is contained in:
parent
f36309a96f
commit
db068d480b
4 changed files with 48 additions and 31 deletions
|
|
@ -210,21 +210,10 @@ void EditorViewport::rebuildObjects(const std::vector<PlacedObject>& objects,
|
|||
bool loaded = false;
|
||||
|
||||
// Try WOB open format first (replaces proprietary WMO when available)
|
||||
{
|
||||
std::string wobBase = obj.path;
|
||||
auto wobDot = wobBase.rfind('.');
|
||||
if (wobDot != std::string::npos) wobBase = wobBase.substr(0, wobDot);
|
||||
std::replace(wobBase.begin(), wobBase.end(), '\\', '/');
|
||||
for (const char* prefix : {"custom_zones/buildings/", "output/buildings/"}) {
|
||||
if (pipeline::WoweeBuildingLoader::exists(std::string(prefix) + wobBase)) {
|
||||
auto wob = pipeline::WoweeBuildingLoader::load(std::string(prefix) + wobBase);
|
||||
if (wob.isValid() &&
|
||||
pipeline::WoweeBuildingLoader::toWMOModel(wob, model)) {
|
||||
loaded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (auto wob = pipeline::WoweeBuildingLoader::tryLoadByGamePath(obj.path);
|
||||
wob.isValid() &&
|
||||
pipeline::WoweeBuildingLoader::toWMOModel(wob, model)) {
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
if (!loaded) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue