Add for each blend.

This commit is contained in:
K. S. Ernest (iFire) Lee
2020-09-27 12:30:30 -07:00
parent 4e680fa760
commit 11a8671a9c
4 changed files with 35 additions and 1074 deletions

View File

@@ -2,28 +2,33 @@
import bpy
import posixpath
import shutil
import os
blend = "32678-respect-import-hints-with-empty"
bpy.ops.wm.open_mainfile(filepath="blend/" + blend + ".blend")
directory = "blend"
for filename in os.listdir(directory):
if filename.endswith(".blend"):
print(filename)
bpy.ops.wm.open_mainfile(filepath="blend/" + filename)
strip_file_name = filename.rsplit(".blend", 1)[0]
export_type = "gltf"
shutil.rmtree(export_type, ignore_errors=True)
posixpath.os.mkdir(export_type, mode=0o777)
bpy.ops.export_scene.gltf(
filepath=export_type + "/" + blend + ".gltf",
export_format="GLTF_SEPARATE",
export_copyright="The MIT License (MIT) Copyright (c) 2016 Godot Engine",
)
export_type = "gltf"
shutil.rmtree(export_type, ignore_errors=True)
posixpath.os.mkdir(export_type, mode=0o777)
bpy.ops.export_scene.gltf(
filepath=export_type + "/" + strip_file_name + ".gltf",
export_format="GLTF_SEPARATE",
export_copyright="The MIT License (MIT) Copyright (c) 2016 Godot Engine",
)
export_type = "obj"
shutil.rmtree(export_type, ignore_errors=True)
posixpath.os.mkdir(export_type, mode=0o777)
bpy.ops.export_scene.obj(filepath=export_type + "/" + strip_file_name + "." + export_type)
export_type = "obj"
shutil.rmtree(export_type, ignore_errors=True)
posixpath.os.mkdir(export_type, mode=0o777)
bpy.ops.export_scene.obj(filepath=export_type + "/" + blend + "." + export_type)
export_type = "fbx"
shutil.rmtree(export_type, ignore_errors=True)
posixpath.os.mkdir(export_type, mode=0o777)
bpy.ops.export_scene.fbx(filepath=export_type + "/" + blend + "." + export_type)
export_type = "fbx"
shutil.rmtree(export_type, ignore_errors=True)
posixpath.os.mkdir(export_type, mode=0o777)
bpy.ops.export_scene.fbx(filepath=export_type + "/" + strip_file_name + "." + export_type)
else:
continue

Binary file not shown.