I want to batch process nif files, using PyNifly addon, I would like to import a .nif through a script without going through the menu manually.
bpy.ops.import_scene.pynifly() is what I got when enabling developer extras but I get an error when trying to import a file.
Download Blender cube .nif https://www.dropbox.com/s/5xblr15dkie2xkx/Cube.nif?dl=0
Download PyNifly https://github.com/BadDogSkyrim/PyNifly
Script
import bpy
bpy.ops.import_scene.pynifly(filepath="E:/Meshes/10mmAmmo.nif")
Console Error
Python: Traceback (most recent call last):
File "\Text", line 2, in <module>
File "C:\Program Files\Blender Foundation\Blender 3.4\3.4\scripts\modules\bpy\ops.py", line 113, in __call__
ret = _op_call(self.idname_py(), None, kw)
RuntimeError: Error: Import of nif failed, see console window for details
I installed an addon called ActionRecorder and got this information, about the importing process.
Script
bpy.ops.import_scene.pynifly(filepath='', filter_glob='*.nif', files=<bpy_collection[0], IMPORT_SCENE_OT_pynifly.files>, create_bones=True, scale_factor=1.0, rename_bones=True, rename_bones_niftools=False, import_shapes=True, apply_skinning=True)
Error
Error: invalid syntax (<string>, line 1)
System Console Log
====================================
PYNIFLY IMPORT NIF V7.0.0
ERROR:pynifly:Import of nif failed
Traceback (most recent call last):
File "C:\Program Files\Blender Foundation\Blender 3.4\3.4\scripts\addons\io_scene_nifly\__init__.py", line 1955, in execute
NifImporter.do_import(fullfiles, flags)
File "C:\Program Files\Blender Foundation\Blender 3.4\3.4\scripts\addons\io_scene_nifly\__init__.py", line 1874, in do_import
imp = NifImporter(filename, flags, chargen=chargen, scale=scale)
File "C:\Program Files\Blender Foundation\Blender 3.4\3.4\scripts\addons\io_scene_nifly\__init__.py", line 785, in __init__
self.filename = filename[0]
IndexError: list index out of range
INFO:pynifly:
PyNifly IMPORT of [] completed WITH ERRORS {'CANCELLED'}
====================================
Error: Import of nif failed, see console window for details
ERROR:ActionRecorder:Uncaught exception
Traceback (most recent call last):
File "\Text", line 2, in <module>
File "C:\Program Files\Blender Foundation\Blender 3.4\3.4\scripts\modules\bpy\ops.py", line 113, in __call__
ret = _op_call(self.idname_py(), None, kw)
RuntimeError: Error: Import of nif failed, see console window for details