feat(tools): (re) generating gltf files for examples by script works !

* hack-ish, reuses our pytest boilerplate, but good enough for now
This commit is contained in:
kaosat.dev 2024-03-04 14:15:30 +01:00
parent d0f49c851a
commit c95eead100
2 changed files with 34 additions and 46 deletions

View File

@ -1,8 +0,0 @@
import bpy
def test_fake():
auto_export_operator = bpy.ops.export_scenes.auto_gltf
stored_settings = bpy.data.texts[".gltf_auto_export_settings"]
print("OHHHHHHHHHHHHHHHHHHHHHHHHHHHHH")
print("export settings", stored_settings.as_string())
#auto_export_operator(direct_mode = True)

View File

@ -2,27 +2,24 @@ import os
import bpy import bpy
import subprocess import subprocess
def generate_example_gltf_files(example_path): def test_generate_example_gltf_files():
auto_export_operator = bpy.ops.export_scenes.auto_gltf auto_export_operator = bpy.ops.export_scenes.auto_gltf
stored_settings = bpy.data.texts[".gltf_auto_export_settings"] stored_settings = bpy.data.texts[".gltf_auto_export_settings"]
print("export settings", stored_settings) print("export settings", stored_settings.as_string())
"""auto_export_operator( auto_export_operator(
direct_mode = True, direct_mode = True,
export_output_folder="./models", export_change_detection=False
export_scene_settings=True, )
export_blueprints=True,
export_legacy_mode=False,
export_animations=True
)"""
# blender-template
#clear && /home/ckaos/.local/bin/pytest --blender-executable /home/ckaos/tools/blender/blender-4.0.2-linux-x64/blender tests
if __name__ == "__main__":
examples = [ """
'../examples/bevy_gltf_blueprints/basic', '../examples/bevy_gltf_blueprints/basic',
'../examples/bevy_gltf_blueprints/animation', '../examples/bevy_gltf_blueprints/animation',
'../examples/bevy_gltf_blueprints/basic_xpbd_physics', '../examples/bevy_gltf_blueprints/basic_xpbd_physics',
'../examples/bevy_gltf_blueprints/materials', '../examples/bevy_gltf_blueprints/materials',
"""
examples = [
'../examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles', '../examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles',
] ]
@ -46,7 +43,6 @@ for example_path in examples:
print("blend files", blend_files) print("blend files", blend_files)
for blend_file in blend_files: for blend_file in blend_files:
fake_test_path = os.path.abspath("./internal_gen.py") fake_test_path = os.path.abspath("./internal_generate_example_gltf_files.py")
command = "pytest -svv --blender-executable /home/ckaos/tools/blender/blender-4.0.2-linux-x64/blender --blender-template "+blend_file + " "+fake_test_path command = "pytest -svv --blender-executable /home/ckaos/tools/blender/blender-4.0.2-linux-x64/blender --blender-template "+blend_file + " "+fake_test_path
return_code = subprocess.call(command.split(" "), cwd=example_path) return_code = subprocess.call(command.split(" "), cwd=example_path)
#generate_example_gltf_files(example_path)