godotengine / godot-tests

Repository for Godot benchmarks, regression tests, etc.
MIT License
34 stars 33 forks source link

Importer tests #10

Closed fire closed 3 years ago

fire commented 3 years ago

Script exporting from the blend file to:

See https://github.com/godotengine/godot/issues/32678#issuecomment-573079580

Export blend to the above formats via CLI

# blender --background --python .\blender-export.py
import bpy
import posixpath
import shutil

blend = "32678-respect-import-hints-with-empty"
bpy.ops.wm.open_mainfile(filepath=blend + ".blend")

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 = "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)
fire commented 3 years ago

Added.