From df2027463a7ef71c581d89457c39c023f7c306c5 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 07:15:40 -0700 Subject: [PATCH] feat(editor): add --info-objects CLI for objects.json summary Mirrors --info-creatures and the other format inspectors. Reports total placement count, M2/WMO breakdown, unique source paths, and scale range. Useful for spotting empty zones, accidental scale extremes, or duplicated placements before packing. --- tools/editor/main.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tools/editor/main.cpp b/tools/editor/main.cpp index b68f04e2..387f3ffd 100644 --- a/tools/editor/main.cpp +++ b/tools/editor/main.cpp @@ -1,6 +1,7 @@ #include "editor_app.hpp" #include "content_pack.hpp" #include "npc_spawner.hpp" +#include "object_placer.hpp" #include "pipeline/wowee_model.hpp" #include "pipeline/wowee_building.hpp" #include "pipeline/wowee_collision.hpp" @@ -28,6 +29,7 @@ static void printUsage(const char* argv0) { std::printf(" --info-woc Print WOC collision metadata (triangle counts, bounds) and exit\n"); std::printf(" --info-wot Print WOT/WHM terrain metadata (tile, chunks, height range) and exit\n"); std::printf(" --info-creatures

Print creatures.json summary (counts, behaviors) and exit\n"); + std::printf(" --info-objects

Print objects.json summary (counts, types, scale range) and exit\n"); std::printf(" --info-wcp Print WCP archive metadata (name, files) and exit\n"); std::printf(" --version Show version and format info\n\n"); std::printf("Wowee World Editor v1.0.0 — by Kelsi Davis\n"); @@ -94,6 +96,33 @@ int main(int argc, char* argv[]) { std::printf(" total tris : %zu\n", totalIdx / 3); std::printf(" total mats : %zu (across all groups)\n", totalMats); return 0; + } else if (std::strcmp(argv[i], "--info-objects") == 0 && i + 1 < argc) { + std::string path = argv[++i]; + wowee::editor::ObjectPlacer placer; + if (!placer.loadFromFile(path)) { + std::fprintf(stderr, "Failed to load objects.json: %s\n", path.c_str()); + return 1; + } + const auto& objs = placer.getObjects(); + int m2Count = 0, wmoCount = 0; + std::unordered_map pathHist; + float minScale = 1e30f, maxScale = -1e30f; + for (const auto& o : objs) { + if (o.type == wowee::editor::PlaceableType::M2) m2Count++; + else if (o.type == wowee::editor::PlaceableType::WMO) wmoCount++; + pathHist[o.path]++; + if (o.scale < minScale) minScale = o.scale; + if (o.scale > maxScale) maxScale = o.scale; + } + std::printf("objects.json: %s\n", path.c_str()); + std::printf(" total : %zu\n", objs.size()); + std::printf(" M2 doodads : %d\n", m2Count); + std::printf(" WMO buildings: %d\n", wmoCount); + std::printf(" unique paths: %zu\n", pathHist.size()); + if (!objs.empty()) { + std::printf(" scale range : [%.2f, %.2f]\n", minScale, maxScale); + } + return 0; } else if (std::strcmp(argv[i], "--info-creatures") == 0 && i + 1 < argc) { std::string path = argv[++i]; wowee::editor::NpcSpawner spawner;