STEAM GROUP
Blender Source Tools BleST
STEAM GROUP
Blender Source Tools BleST
360
IN-GAME
1,957
ONLINE
Founded
8 November, 2013
Showing 1-2 of 2 entries
3
batch convert smd to obj not working
i am not knowledgeable about python in the slightest. i found a script online that is meant to convert a directory from one format to another. i adjusted it to what i thought would do the job for converting smd to obj, but i'm getting an error:

Originally posted by blender:
Python: Traceback (most recent call last):
File "\Text", line 31, in <module>
File "\Text", line 26, in convert_recursive
File "C:\Program Files\Blender Foundation\Blender 2.93\2.93\scripts\modules\bpy\ops.py", line 132, in __call__
ret = _op_call(self.idname_py(), None, kw)
AttributeError: Calling operator "bpy.ops.import_scene.smd" error, could not be found

location: <unknown location>:-1

seems it's not even seeing smd import as an option? but the python tooltip says this is the command, so what am i missing?

here is the script i'm running:

CONVERT_DIR = "C:/4zarr/models" import os def file_iter(path, ext): for dirpath, dirnames, filenames in os.walk(path): for filename in filenames: ext = os.path.splitext(filename)[1] if ext.lower().endswith(ext): yield os.path.join(dirpath, filename) import bpy def reset_blend(): bpy.ops.wm.read_factory_settings(use_empty=True) def convert_recursive(base_path): for filepath_src in file_iter(base_path, ".smd"): filepath_dst = os.path.splitext(filepath_src)[0] + ".obj" print("Converting %r -> %r" % (filepath_src, filepath_dst)) reset_blend() bpy.ops.import_scene.smd(filepath=filepath_src) bpy.ops.export_scene.obj(filepath=filepath_dst) if __name__ == "__main__": convert_recursive(CONVERT_DIR)

thanks
Showing 1-2 of 2 entries