feat(tools): added boilerplate for internal tools

* clean zip file generator for blender add-on releases
 * wip for example gltf file generator
This commit is contained in:
kaosat.dev 2024-03-04 13:00:36 +01:00
parent 641f84e1bf
commit 6c8593f82d
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,15 @@
import bpy
def generate_example_gltf_files(example_path):
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
)"""
#clear && /home/ckaos/.local/bin/pytest --blender-executable /home/ckaos/tools/blender/blender-4.0.2-linux-x64/blender tests

View File

@ -0,0 +1,28 @@
import os
import zipfile
ignore_list = ['.pytest_cache', '__pycache__']
def zipdir(path, ziph):
# ziph is zipfile handle
for root, dirs, files in os.walk(path):
# filter out invalid paths
root_path = os.path.normpath(root)
root_path = root_path.split(os.sep)
add_file = True
for sub_path in root_path:
if sub_path in ignore_list:
add_file = False
break
if add_file:
for file in files:
ziph.write(os.path.join(root, file),
os.path.relpath(os.path.join(root, file),
os.path.join(path, '..')))
with zipfile.ZipFile("bevy_components.zip", mode="w") as archive:
zipdir('./bevy_components', archive)
with zipfile.ZipFile("gltf_auto_export.zip", mode="w") as archive:
zipdir('./gltf_auto_export', archive)