Skip to content

Instantly share code, notes, and snippets.

@florensie
Created August 27, 2023 12:57
Show Gist options
  • Save florensie/eff2c6e5e3ae7b238832343bf8a2a091 to your computer and use it in GitHub Desktop.
Save florensie/eff2c6e5e3ae7b238832343bf8a2a091 to your computer and use it in GitHub Desktop.
from pathlib import Path
import shutil
import argparse
DEFAULT_TYPES = 'SMs,SKMs,AnimSeqs,AnimComps,AnimMonts'
def main(in_path, out_path, internal_name, types):
in_path = Path(in_path)
out_path = Path(out_path)
types = types.split(',')
for subdirectory in types:
type_path = in_path / subdirectory / internal_name / "Content"
for file in type_path.rglob('*.fbx'):
out_file = out_path / "Game" / file.relative_to(type_path)
print(f"Copying {file.relative_to(in_path)} to {out_file.relative_to(out_path)}")
out_file.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(file, out_file)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Copies only FBX files to your CAS output directory")
parser.add_argument('indir', type=Path, help="CUE4Parse dump directory")
parser.add_argument('outdir', type=Path, help="CAS json dump directory")
parser.add_argument('--internalname', '-n', type=str, default="Game",
help="The internal name of the game, should be the same as what you used in CUE4Parse")
parser.add_argument('--types', '-t', type=str, default=DEFAULT_TYPES,
help=f"Comma separated list of types without spaces (default: {DEFAULT_TYPES})")
args = parser.parse_args()
main(args.indir, args.outdir, args.internalname, args.types)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment