Files
AIGame/Tools/t2_accessory_static.py
T

46 lines
2.0 KiB
Python

#!/usr/bin/env python3
"""T2 accessory static stage: Hunyuan GLB -> 400-tri / 512 XPbr bake -> Characters/Animal/{Name}/{Name}T2/ -> SetupCharacter prefab.
Only the FBX and the two XPbr PNGs are copied; Unity creates the metas and SetupCharacter creates the Test/XPbr material and
the static prefab. The accessory has no rig, so loose islands are fine. Placement on the head bone is BuildT2Visuals.BuildPrefabs.
Usage:
python Tools/t2_accessory_static.py # every partner whose T2 GLB exists
python Tools/t2_accessory_static.py FireCat BudBud # selected only
"""
from __future__ import annotations
import shutil
import sys
from pathlib import Path
from enemy_static_pipeline import ROOT, run, unity
PARTNERS = ["RockBall", "FireCat", "BudBud", "SparkBird", "BubbleTurtle", "RockRhino", "FlameLion", "VineSprite", "ThunderLeopard", "TideWhale"]
def main() -> None:
wanted = sys.argv[1:] or PARTNERS
for name in wanted:
low = name.lower()
glb = ROOT / f"Tools/output/t2_3d/{name}/{low}_t2.glb"
if not glb.exists():
print(f"{name}: no GLB yet, skipped", flush=True)
continue
game = ROOT / f"Tools/output/t2_game/{low}_t2_game"
run([sys.executable, "Tools/model_tools/model_lowpoly_bake.py", str(glb), "-o", str(game), "--tris", "400", "--size", "512",
"--callback-file", str(game / "bake_status.json")])
xpbr = game / f"{low}_t2_xpbr"
actor = name + "T2"
dest = ROOT / f"AIClient/Assets/Bundles/Characters/Animal/{name}/{actor}"
dest.mkdir(parents=True, exist_ok=True)
shutil.copy2(xpbr / f"{low}_t2.fbx", dest / f"{actor}.fbx")
shutil.copy2(xpbr / f"{low}_t2_base.png", dest / f"{actor}_base.png")
shutil.copy2(xpbr / f"{low}_t2_mix.png", dest / f"{actor}_mix.png")
out = unity("AgentScripts/SetupCharacter.cs", "SetupCharacter.Run", [f"Animal/{name}", actor, 0.15])
print(f"{name}: installed {dest.relative_to(ROOT)}", flush=True)
if __name__ == "__main__":
main()