feat(editor): add --list-packs introspection + --gen-temple-pack

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.
This commit is contained in:
Kelsi 2026-05-09 12:51:10 -07:00
parent c18d88015a
commit 4e64f833a7
4 changed files with 50 additions and 0 deletions

View file

@ -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",

View file

@ -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},

View file

@ -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 <outDir>\n");
std::printf(" Convenience: emit house + outhouse + chimney + hitching-post + well + signpost + haystack into outDir\n");
std::printf(" --gen-temple-pack <outDir>\n");
std::printf(" Convenience: emit altar + shrine + brazier + pillar + statue + portal + podium into outDir\n");
std::printf(" --gen-mesh-table <wom-base> [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 <wom-base> [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");

View file

@ -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<std::string> 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;
}