feat(auto_export): experimenting with ways of getting standard gltf export settings & using them

This commit is contained in:
kaosat.dev 2024-03-22 23:35:10 +01:00
parent ce473a357e
commit 37dd6a990c
3 changed files with 29 additions and 6 deletions

View File

@ -1,5 +1,7 @@
import os
import bpy
from .get_standard_exporter_settings import get_standard_exporter_settings
from .preferences import (AutoExportGltfPreferenceNames)
def generate_gltf_export_preferences(addon_prefs):
@ -37,10 +39,31 @@ def generate_gltf_export_preferences(addon_prefs):
export_optimize_animation_size=False
)
for key in addon_prefs.__annotations__.keys():
if str(key) not in AutoExportGltfPreferenceNames:
#print("overriding setting", key, "value", getattr(addon_prefs,key))
gltf_export_preferences[key] = getattr(addon_prefs,key)
gltf_export_preferences[key] = getattr(addon_prefs, key)
"""standard_gltf_exporter_settings = get_standard_exporter_settings()
print("standard settings", standard_gltf_exporter_settings)
constant_keys = [
'export_cameras',
'export_extras', # For custom exported properties.
'export_lights',
]
# a certain number of essential params should NEVER be overwritten , no matter the settings of the standard exporter
for key in standard_gltf_exporter_settings.keys():
if str(key) not in constant_keys:
gltf_export_preferences[key] = standard_gltf_exporter_settings.get(key)
print("final export preferences", gltf_export_preferences)"""
return gltf_export_preferences

View File

@ -1,6 +1,9 @@
import bpy
def get_standard_exporter_settings():
settings_key = 'glTF2ExportSettings'
for scene in bpy.data.scenes:
if 'glTF2ExportSettings' in scene:
print("standard exporter settings", scene['glTF2ExportSettings'])
if settings_key in scene:
settings = scene[settings_key]
#print("standard exporter settings", settings, dict(settings))
return dict(settings)

View File

@ -208,9 +208,6 @@ def get_scenes(addon_prefs):
return [level_scene_names, level_scenes, library_scene_names, library_scenes]
def inject_blueprints_list_into_main_scene(scene):
print("injecting assets/blueprints data into scene")
root_collection = scene.collection