3D 리플레이 실감 1단계: 변환기 v2 (스킬 주인 · 투사체 경로 · 앉기/점프 · 무기 상태 · 맞은 자리 · 사망 모션 · 설치/해체) · 공용 애니메이션 anims.glb · 요원 동작(앉기 · 점프 · 착지 · 조준 각 · 사격 반동 · 재장전 · 던지기 · 사망) · 예광 · 작은 이름표 · 요루 분신
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
"""gvr-map-extract 결과(<코드>.glb + <코드>.json)를 사이트용으로 압축한다.
|
||||
pack.py <추출 폴더> <출력 폴더> <버전(예: VALORANT_13.08)>
|
||||
(agents.json 이 있으면 요원 agent_*.glb · 무기 weapon_*.glb 도 같은 폴더에, index.json agents · weapons)
|
||||
(agents.json 이 있으면 요원 agent_*.glb · 무기 weapon_*.glb 도 같은 폴더에, index.json agents · weapons.
|
||||
anims.glb 가 있으면 공용 애니메이션 index.json anims)
|
||||
출력: <출력>/<dir>/<코드>.glb.gz (gltfpack -cc 로 meshopt 압축 · 위치 양자화 → gzip) + <출력>/index.json
|
||||
-ke: 재질 extras(두 층 섞기 B 층) 유지, -vt 14: 반복 UV 가 뭉개지지 않게
|
||||
사이트 서버 data/maps3d 에 그대로 올리면 된다 (site/server/src/maps3d.ts)."""
|
||||
@@ -30,19 +31,19 @@ for name in sorted(os.listdir(src)):
|
||||
print(f"{code}: {info['triangles']} 삼각형 → {size / 1e6:.1f}MB")
|
||||
# 요원 · 무기 (agents 명령 결과 agents.json 이 있으면): 뼈대 · 애니메이션 · 노드 이름을 지킨다 (-kn)
|
||||
agents, weapons = {}, {}
|
||||
def pack_one(file):
|
||||
glb = os.path.join(src, file)
|
||||
if not os.path.exists(glb):
|
||||
return None
|
||||
packed = os.path.join(out, d, file)
|
||||
subprocess.run(['npx', '-y', 'gltfpack@1.3.0', '-i', glb, '-o', packed, '-cc', '-kn', '-ke'], check=True, stdout=subprocess.DEVNULL)
|
||||
with open(packed, 'rb') as f, gzip.open(packed + '.gz', 'wb', 9) as g:
|
||||
shutil.copyfileobj(f, g)
|
||||
os.remove(packed)
|
||||
return os.path.getsize(packed + '.gz')
|
||||
aj = os.path.join(src, 'agents.json')
|
||||
if os.path.exists(aj):
|
||||
a = json.load(open(aj))
|
||||
def pack_one(file):
|
||||
glb = os.path.join(src, file)
|
||||
if not os.path.exists(glb):
|
||||
return None
|
||||
packed = os.path.join(out, d, file)
|
||||
subprocess.run(['npx', '-y', 'gltfpack@1.3.0', '-i', glb, '-o', packed, '-cc', '-kn', '-ke'], check=True, stdout=subprocess.DEVNULL)
|
||||
with open(packed, 'rb') as f, gzip.open(packed + '.gz', 'wb', 9) as g:
|
||||
shutil.copyfileobj(f, g)
|
||||
os.remove(packed)
|
||||
return os.path.getsize(packed + '.gz')
|
||||
for cls, v in a.get('agents', {}).items():
|
||||
size = pack_one(v['file'])
|
||||
if size:
|
||||
@@ -52,7 +53,13 @@ if os.path.exists(aj):
|
||||
if size:
|
||||
weapons[name] = {'file': v['file'], 'bytes': size, 'points': v.get('points') or {}}
|
||||
print(f'요원 {len(agents)} · 무기 {len(weapons)}')
|
||||
idx = {'version': version, 'dir': d, 'updatedAt': datetime.datetime.now(datetime.timezone.utc).isoformat(), 'maps': maps, 'agents': agents, 'weapons': weapons}
|
||||
# 공용 애니메이션 (anims 명령 결과 anims.glb): 뼈 이름으로 요원 몸에 붙인다 (-kn)
|
||||
anims = None
|
||||
if os.path.exists(os.path.join(src, 'anims.glb')):
|
||||
size = pack_one('anims.glb')
|
||||
anims = {'file': 'anims.glb', 'bytes': size}
|
||||
print(f'공용 애니메이션 {size / 1e6:.1f}MB')
|
||||
idx = {'version': version, 'dir': d, 'updatedAt': datetime.datetime.now(datetime.timezone.utc).isoformat(), 'maps': maps, 'agents': agents, 'weapons': weapons, 'anims': anims}
|
||||
tmp = os.path.join(out, 'index.json.tmp')
|
||||
json.dump(idx, open(tmp, 'w'), ensure_ascii=False, indent=1)
|
||||
os.replace(tmp, os.path.join(out, 'index.json'))
|
||||
|
||||
@@ -125,6 +125,7 @@ GVR_USMAP="$usmap" GVR_MANIFEST="$manifest" "$BIN" extract "$raw"
|
||||
# 요원 3D 몸 · 애니메이션 · 무기. 하나라도 실패하면 맵과 같이 올리지 않는다 (사이트의 이전 맵 · 요원 · 무기 유지, 재시도)
|
||||
stage="요원 추출"
|
||||
GVR_USMAP="$usmap" GVR_MANIFEST="$manifest" "$BIN" agents "$raw"
|
||||
GVR_USMAP="$usmap" GVR_MANIFEST="$manifest" "$BIN" anims "$raw"
|
||||
stage="압축"
|
||||
python3 "$GVR_MAPS_HOME/scripts/pack.py" "$raw" "$out" "$version"
|
||||
dir="$(jq -r .dir "$out/index.json")"
|
||||
|
||||
Reference in New Issue
Block a user