From 4e64f833a79009f517c7bff343b9113600751ee5 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sat, 9 May 2026 12:51:10 -0700 Subject: [PATCH] feat(editor): add --list-packs introspection + --gen-temple-pack MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two related changes: • --list-packs walks kArgRequired and surfaces every flag matching --gen-*-pack (excluding --gen-mesh-* and --gen-texture-* which are individual primitives). Sister command to --list-primitives. Auto-tracks new packs as they're added — no parallel registry. • --gen-temple-pack composite — temple/shrine ritual hall (altar + shrine + brazier + pillar + statue + portal + podium). Fourth themed mesh pack after camp / blacksmith / village. list-packs now surfaces 9 composites including the pre- existing zone-* / project-starter packs that match the naming convention. All 7 temple-pack outputs validate clean. --- tools/editor/cli_arg_required.cpp | 1 + tools/editor/cli_gen_mesh.cpp | 19 +++++++++++++++++++ tools/editor/cli_help.cpp | 3 +++ tools/editor/cli_introspect.cpp | 27 +++++++++++++++++++++++++++ 4 files changed, 50 insertions(+) diff --git a/tools/editor/cli_arg_required.cpp b/tools/editor/cli_arg_required.cpp index df694351..f9782eda 100644 --- a/tools/editor/cli_arg_required.cpp +++ b/tools/editor/cli_arg_required.cpp @@ -59,6 +59,7 @@ const char* const kArgRequired[] = { "--gen-mesh-archery-target", "--gen-mesh-gravel-pile", "--gen-mesh-stone-bench", "--gen-camp-pack", "--gen-blacksmith-pack", "--gen-village-pack", + "--gen-temple-pack", "--gen-mesh-table", "--gen-mesh-lamppost", "--gen-mesh-bed", "--gen-mesh-ladder", "--gen-mesh-well", "--gen-mesh-signpost", "--gen-mesh-mailbox", "--gen-mesh-tombstone", "--gen-mesh-crate", diff --git a/tools/editor/cli_gen_mesh.cpp b/tools/editor/cli_gen_mesh.cpp index 5a82dc55..03f8e10a 100644 --- a/tools/editor/cli_gen_mesh.cpp +++ b/tools/editor/cli_gen_mesh.cpp @@ -6719,6 +6719,24 @@ int handleGenBlacksmithPack(int& i, int /*argc*/, char** argv) { }); } +int handleGenTemplePack(int& i, int /*argc*/, char** argv) { + // Temple / shrine scene: altar (the focal point), shrine + // (auxiliary devotional), brazier (lit on either side of the + // altar), 2 pillars (flanking the altar approach), statue + // (deity figure), portal (entrance gateway). A full ritual + // hall in 7 primitives. + std::string outDir = argv[++i]; + return emitMeshPack(outDir, "temple pack", { + {"--gen-mesh-altar", handleAltar, "altar"}, + {"--gen-mesh-shrine", handleShrine, "shrine"}, + {"--gen-mesh-brazier", handleBrazier, "brazier"}, + {"--gen-mesh-pillar", handlePillar, "pillar"}, + {"--gen-mesh-statue", handleStatue, "statue"}, + {"--gen-mesh-portal", handlePortal, "portal"}, + {"--gen-mesh-podium", handlePodium, "podium"}, + }); +} + int handleGenVillagePack(int& i, int /*argc*/, char** argv) { // Village square scene: a small house, an outhouse beside it, // a chimney for the house roof piece, a hitching post at the @@ -6813,6 +6831,7 @@ constexpr MeshEntry kMeshTable[] = { {"--gen-camp-pack", 1, handleGenCampPack}, {"--gen-blacksmith-pack", 1, handleGenBlacksmithPack}, {"--gen-village-pack", 1, handleGenVillagePack}, + {"--gen-temple-pack", 1, handleGenTemplePack}, {"--gen-mesh-table", 1, handleTable}, {"--gen-mesh-lamppost", 1, handleLamppost}, {"--gen-mesh-bed", 1, handleBed}, diff --git a/tools/editor/cli_help.cpp b/tools/editor/cli_help.cpp index e3a083ae..c6ccd135 100644 --- a/tools/editor/cli_help.cpp +++ b/tools/editor/cli_help.cpp @@ -284,6 +284,8 @@ void printUsage(const char* argv0) { std::printf(" Convenience: emit forge + anvil + workbench + water-trough + crate-stack + hitching-post into outDir\n"); std::printf(" --gen-village-pack \n"); std::printf(" Convenience: emit house + outhouse + chimney + hitching-post + well + signpost + haystack into outDir\n"); + std::printf(" --gen-temple-pack \n"); + std::printf(" Convenience: emit altar + shrine + brazier + pillar + statue + portal + podium into outDir\n"); std::printf(" --gen-mesh-table [width] [depth] [height] [legThick] [topThick]\n"); std::printf(" Table: flat top slab on 4 corner legs (default 1.6/1.0/0.85/0.10/0.06)\n"); std::printf(" --gen-mesh-lamppost [poleH] [poleT] [baseSize] [lanternSize] [lanternH]\n"); @@ -811,6 +813,7 @@ void printUsage(const char* argv0) { std::printf(" --list-commands Print every recognized --flag, one per line, and exit\n"); std::printf(" --list-primitives [--mesh|--texture] [--json]\n"); std::printf(" Filtered list of just procedural primitive flags (--gen-mesh-*, --gen-texture-*)\n"); + std::printf(" --list-packs Print every --gen-*-pack composite flag (camp, blacksmith, village, temple…)\n"); std::printf(" --info-cli-stats [--json]\n"); std::printf(" Meta-stats on the CLI surface (command count by category prefix)\n"); std::printf(" --info-cli-categories\n"); diff --git a/tools/editor/cli_introspect.cpp b/tools/editor/cli_introspect.cpp index 78616f5b..385061b9 100644 --- a/tools/editor/cli_introspect.cpp +++ b/tools/editor/cli_introspect.cpp @@ -371,6 +371,30 @@ int handleVersion(int& /*i*/, int /*argc*/, char** /*argv*/) { return 0; } +int handleListPacks(int& /*i*/, int /*argc*/, char** /*argv*/) { + // Sister to --list-primitives: lists every --gen-*-pack + // composite flag from the shared kArgRequired registry. + // Auto-tracks new packs as they're added — no parallel list. + std::vector packs; + for (std::size_t k = 0; k < kArgRequiredSize; ++k) { + const char* flag = kArgRequired[k]; + std::size_t len = std::strlen(flag); + // Match --gen-*-pack (anything starting with --gen- and + // ending in -pack, but NOT --gen-mesh-* or --gen-texture-* + // which are individual primitives). + if (std::strncmp(flag, "--gen-", 6) != 0) continue; + if (std::strncmp(flag, "--gen-mesh-", 11) == 0) continue; + if (std::strncmp(flag, "--gen-texture-", 14) == 0) continue; + if (len > 5 && std::strcmp(flag + len - 5, "-pack") == 0) { + packs.emplace_back(flag); + } + } + std::sort(packs.begin(), packs.end()); + std::printf("Composite packs (%zu):\n", packs.size()); + for (const auto& p : packs) std::printf(" %s\n", p.c_str()); + return 0; +} + int handleListPrimitives(int& i, int argc, char** argv) { // Focused subset of --list-commands: just the procedural // primitives (--gen-mesh-* and --gen-texture-* flags). Useful @@ -434,6 +458,9 @@ bool handleIntrospect(int& i, int argc, char** argv, int& outRc) { if (std::strcmp(argv[i], "--list-primitives") == 0) { outRc = handleListPrimitives(i, argc, argv); return true; } + if (std::strcmp(argv[i], "--list-packs") == 0) { + outRc = handleListPacks(i, argc, argv); return true; + } if (std::strcmp(argv[i], "--info-cli-stats") == 0) { outRc = handleInfoCliStats(i, argc, argv); return true; }