Files

21 lines
1.6 KiB
Python

"""Batch 4 conversion: models/src3 (fixups.py) with UV animation, lights, step-visibility resampling.
Rigid identical views merge to one; models with animated multi-bone views keep every view (one skin FDID each)."""
import sys, json, shutil
from pathlib import Path
sys.path.insert(0, '/mnt/Games/@project/wt-master-merge/ops'); import m2_equipment_convert as c
W = Path(__file__).resolve().parent; M = W / 'models/src3/manifest.json'
kw = dict(allow_qualified_cutout_shader16=True, paired_single_texture_rule=True, convert_ribbons=True, convert_particles=True,
downgrade_hermite=True, convert_uv_animation=True, convert_lights=True, resample_step_visibility=True, drop_unreachable_events=True)
for d in ('conv7', 'conv7a', 'conv7b'): shutil.rmtree(W / 'models' / d, ignore_errors=True)
a = c.batch(M, W / 'models/conv7a', canonicalize_rigid_views=True, **kw)
b = c.batch(M, W / 'models/conv7b', canonicalize_rigid_views=False, **kw)
out = W / 'models/conv7'; out.mkdir(); recs = []
bb = {r['source_sha256']: r for r in b['records']}
for r in a['records']:
src = 'conv7a'
if not r['structural_conversion_complete'] and bb[r['source_sha256']]['structural_conversion_complete']: r = bb[r['source_sha256']]; src = 'conv7b'
for o in r.get('outputs', []): shutil.copy(W / 'models' / src / o['file'], out / o['file'])
r['view_policy'] = 'merged' if src == 'conv7a' else 'all-views'; recs.append(r)
json.dump(dict(records=recs), open(out / 'manifest.json', 'w'), indent=1)
print('converted', sum(r['structural_conversion_complete'] for r in recs), 'all-views', sum(r['view_policy'] == 'all-views' and r['structural_conversion_complete'] for r in recs))