mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-12-22 23:54:10 +00:00
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:
parent
d0f49c851a
commit
c95eead100
@ -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)
|
@ -2,51 +2,47 @@ import os
|
||||
import bpy
|
||||
import subprocess
|
||||
|
||||
def generate_example_gltf_files(example_path):
|
||||
def test_generate_example_gltf_files():
|
||||
auto_export_operator = bpy.ops.export_scenes.auto_gltf
|
||||
stored_settings = bpy.data.texts[".gltf_auto_export_settings"]
|
||||
print("export settings", stored_settings)
|
||||
"""auto_export_operator(
|
||||
direct_mode=True,
|
||||
export_output_folder="./models",
|
||||
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
|
||||
print("export settings", stored_settings.as_string())
|
||||
auto_export_operator(
|
||||
direct_mode = True,
|
||||
export_change_detection=False
|
||||
)
|
||||
|
||||
|
||||
examples = [
|
||||
if __name__ == "__main__":
|
||||
"""
|
||||
'../examples/bevy_gltf_blueprints/basic',
|
||||
'../examples/bevy_gltf_blueprints/animation',
|
||||
'../examples/bevy_gltf_blueprints/basic_xpbd_physics',
|
||||
'../examples/bevy_gltf_blueprints/materials',
|
||||
'../examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles',
|
||||
]
|
||||
"""
|
||||
examples = [
|
||||
|
||||
for example_path in examples:
|
||||
print("generating gltf files for ", example_path)
|
||||
assets_path = os.path.join(example_path, "assets")
|
||||
art_path = os.path.join(example_path, "art")
|
||||
blend_files = []
|
||||
'../examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles',
|
||||
]
|
||||
|
||||
if os.path.exists(assets_path):
|
||||
for file in os.listdir(assets_path):
|
||||
if file.endswith(".blend"):
|
||||
print("file found !", file)
|
||||
blend_files.append(os.path.join("assets", file))
|
||||
if os.path.exists(art_path):
|
||||
for file in os.listdir(art_path):
|
||||
if file.endswith(".blend"):
|
||||
print("file found !", file)
|
||||
blend_files.append(os.path.join("art", file))
|
||||
for example_path in examples:
|
||||
print("generating gltf files for ", example_path)
|
||||
assets_path = os.path.join(example_path, "assets")
|
||||
art_path = os.path.join(example_path, "art")
|
||||
blend_files = []
|
||||
|
||||
|
||||
print("blend files", blend_files)
|
||||
for blend_file in blend_files:
|
||||
fake_test_path = os.path.abspath("./internal_gen.py")
|
||||
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)
|
||||
#generate_example_gltf_files(example_path)
|
||||
if os.path.exists(assets_path):
|
||||
for file in os.listdir(assets_path):
|
||||
if file.endswith(".blend"):
|
||||
print("file found !", file)
|
||||
blend_files.append(os.path.join("assets", file))
|
||||
if os.path.exists(art_path):
|
||||
for file in os.listdir(art_path):
|
||||
if file.endswith(".blend"):
|
||||
print("file found !", file)
|
||||
blend_files.append(os.path.join("art", file))
|
||||
|
||||
|
||||
print("blend files", blend_files)
|
||||
for blend_file in blend_files:
|
||||
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
|
||||
return_code = subprocess.call(command.split(" "), cwd=example_path)
|
||||
|
Loading…
Reference in New Issue
Block a user