Last active
August 12, 2023 10:12
-
-
Save Danil0v3s/4c923d51d148d61a3b4feaf34b77a644 to your computer and use it in GitHub Desktop.
Rotate SMD in Blender command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy, os | |
from math import radians | |
path = '<smd files path>' | |
error_file = '<error file path>' | |
with open(error_file, 'w', buffering=1) as f: | |
f.write("errors at files\n") | |
for root, dirs, files in os.walk(path): | |
for file in [file for file in files if os.path.splitext(file)[1] == '.smd']: | |
filepath = os.path.join(root,file) | |
outpath = root.replace('Data_out', 'Export') | |
if os.path.isfile(os.path.join(outpath, file)): | |
continue | |
try: | |
bpy.ops.import_scene.smd(filepath=filepath) | |
for scene in bpy.data.scenes: | |
scene.vs.export_path = outpath | |
scene.vs.export_format = 'SMD' | |
scene.vs.up_axis = 'Y' | |
bpy.ops.export_scene.smd() | |
bpy.ops.wm.read_homefile(use_empty=True) | |
except: | |
f.write(filepath+"\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment