2021-05-28 16:30:20 -04:00
|
|
|
import bpy
|
|
|
|
import os
|
2021-05-30 07:53:13 -04:00
|
|
|
import itertools
|
2021-05-28 16:30:20 -04:00
|
|
|
from pathlib import Path
|
2021-06-01 04:36:49 -04:00
|
|
|
import sys
|
|
|
|
|
|
|
|
argv = sys.argv
|
|
|
|
try:
|
|
|
|
index = argv.index("--") + 1
|
|
|
|
except ValueError:
|
|
|
|
index = len(argv)
|
|
|
|
argv = argv[index:]
|
2021-05-29 09:10:46 -04:00
|
|
|
|
2021-06-08 01:03:44 -04:00
|
|
|
bpy.ops.preferences.addon_enable(module='io_scene_niftools')
|
|
|
|
|
2021-05-28 16:30:20 -04:00
|
|
|
curdir = Path(__file__).parent
|
2021-06-01 04:36:49 -04:00
|
|
|
blend_path = Path(argv[0])
|
|
|
|
nif_path = Path(argv[1])
|
|
|
|
nif_parent = nif_path.parent
|
|
|
|
|
|
|
|
print("CONVERTING: " + str(blend_path) + " -> " + str(nif_path))
|
|
|
|
try:
|
|
|
|
nif_parent.mkdir(parents=True)
|
|
|
|
except FileExistsError:
|
|
|
|
pass
|
|
|
|
bpy.ops.wm.open_mainfile(filepath=str(blend_path))
|
|
|
|
bpy.ops.export_scene.nif(filepath=str(nif_path))
|