BurningTimesAi/공유/기획/FirstRising/맵/tools/props_copy.py

25 lines
1.3 KiB
Python
Raw Permalink Normal View History

# -*- coding: utf-8 -*-
# 블렌더로 만든 소품(준비 폴더)을 FR 프로젝트로 옮긴다 — FBX · 아틀라스 텍스처 · props.json 만(미리보기 그림 · 로그는 옮기지 않는다).
# python props_copy.py [테마 ...]
import os, shutil, sys, json
SRC = r"C:\BurningTimes\FR_maps_staging\_work\props"
DST = r"C:\BurningTimes\FirstRising\Assets\BurningTimes\Maps\_Shared\Props"
themes = sys.argv[1:] or [d for d in os.listdir(SRC) if os.path.isfile(os.path.join(SRC, d, "props.json"))]
total = 0
for t in themes:
src, dst = os.path.join(SRC, t), os.path.join(DST, t)
os.makedirs(dst, exist_ok=True)
listing = json.load(open(os.path.join(src, "props.json"), encoding="utf-8"))
keep = {"props.json"} | {p["file"] for p in listing["props"]} | set(listing["textures"].values())
n = 0
for f in sorted(keep):
shutil.copy2(os.path.join(src, f), os.path.join(dst, f))
n += 1
# 목록에서 빠진 옛 FBX 는 지우지 않고 알리기만 한다
stale = [f for f in os.listdir(dst) if f.lower().endswith(".fbx") and f not in keep]
size = sum(os.path.getsize(os.path.join(dst, f)) for f in keep)
print("%-10s 파일 %d · %.1f MB%s" % (t, n, size / 1e6, (" · 목록에 없는 FBX " + ", ".join(stale)) if stale else ""))
total += n
print("옮긴 파일", total)