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 os
import bpy import bpy
from .get_standard_exporter_settings import get_standard_exporter_settings
from .preferences import (AutoExportGltfPreferenceNames) from .preferences import (AutoExportGltfPreferenceNames)
def generate_gltf_export_preferences(addon_prefs): def generate_gltf_export_preferences(addon_prefs):
@ -37,11 +39,32 @@ def generate_gltf_export_preferences(addon_prefs):
export_optimize_animation_size=False export_optimize_animation_size=False
) )
for key in addon_prefs.__annotations__.keys(): for key in addon_prefs.__annotations__.keys():
if str(key) not in AutoExportGltfPreferenceNames: if str(key) not in AutoExportGltfPreferenceNames:
#print("overriding setting", key, "value", getattr(addon_prefs,key)) #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 return gltf_export_preferences

View File

@ -1,6 +1,9 @@
import bpy import bpy
def get_standard_exporter_settings(): def get_standard_exporter_settings():
settings_key = 'glTF2ExportSettings'
for scene in bpy.data.scenes: for scene in bpy.data.scenes:
if 'glTF2ExportSettings' in scene: if settings_key in scene:
print("standard exporter settings", scene['glTF2ExportSettings']) 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] return [level_scene_names, level_scenes, library_scene_names, library_scenes]
def inject_blueprints_list_into_main_scene(scene): def inject_blueprints_list_into_main_scene(scene):
print("injecting assets/blueprints data into scene") print("injecting assets/blueprints data into scene")
root_collection = scene.collection root_collection = scene.collection