Hi! I am using this code:
import bpy import sys #Get command line arguments argv = sys.argv argv = argv[argv.index("--") + 1:] # get all args after "—" mdl_in = argv fbx_out = argv + ".fbx" bpy.ops.nvb.importmdl(filepath=mdl_in, filter_glob="*.mdl") bpy.ops.export_scene.fbx(filepath=fbx_out, axis_forward='-Z', axis_up='Y', version='BIN7400', use_selection=False, bake_space_transform=True, use_anim=False, bake_anim=False)
with this batch file:
FOR %%f IN (*.mdl) DO "C:\Path to blender\Blender2.73a\blender.exe" -b --python "C:\path to batch directory and script\convert_fbx.py" -- "%%f"
It works but it can’t find the texture files which are in the same directory (and it spits out another error as well when exporting - about “duplis”).
If I open Blender and manually paste the 2 operation lines of python code it works perfectly.
I got the general code from here:
the exact errors are:
Error: Cannot read ‘filename’ : no such file or directory
Error: Object does not have duplis
These errors do not occur if I open Blender and copy and paste the 2 operation lines of python code, so somewhere along the line the path to the file being converted is being lost/not applied to the imported mesh when looking for the textures I’d guess, probably in the bat file but I don’t really know much about those or Python for that matter.
I’d also like some direction to look in for batch importing exporting 3D files using Blender and Python, can’t seem to find anything concrete. This is my first foray into Python and Blender Scripting, but I am pretty solid with JS and C#.