diff --git a/tools/blenvy/auto_export/export/auto_export.py b/tools/blenvy/auto_export/export/auto_export.py index f8f5e2d..c32fadc 100644 --- a/tools/blenvy/auto_export/export/auto_export.py +++ b/tools/blenvy/auto_export/export/auto_export.py @@ -7,7 +7,7 @@ from ...core.scene_helpers import get_main_and_library_scenes from .get_blueprints_to_export import get_blueprints_to_export from .get_levels_to_export import get_levels_to_export -from .get_standard_exporter_settings import get_standard_exporter_settings +from .export_gltf import get_standard_exporter_settings from .export_main_scenes import export_main_scene from .export_blueprints import export_blueprints diff --git a/tools/blenvy/auto_export/export/export_gltf.py b/tools/blenvy/auto_export/export/export_gltf.py index 78cc519..fa78ff7 100644 --- a/tools/blenvy/auto_export/export/export_gltf.py +++ b/tools/blenvy/auto_export/export/export_gltf.py @@ -2,7 +2,11 @@ import json import os import bpy -from .get_standard_exporter_settings import get_standard_exporter_settings +from ...settings import load_settings + +def get_standard_exporter_settings(): + standard_gltf_exporter_settings = load_settings(".blenvy_gltf_settings") + return standard_gltf_exporter_settings if standard_gltf_exporter_settings is not None else {} def generate_gltf_export_preferences(settings): # default values diff --git a/tools/blenvy/auto_export/export/get_standard_exporter_settings.py b/tools/blenvy/auto_export/export/get_standard_exporter_settings.py deleted file mode 100644 index 21dffc0..0000000 --- a/tools/blenvy/auto_export/export/get_standard_exporter_settings.py +++ /dev/null @@ -1,14 +0,0 @@ -import bpy -import json - -def get_standard_exporter_settings(): - standard_gltf_exporter_settings = bpy.data.texts[".blenvy_gltf_settings"] if ".blenvy_gltf_settings" in bpy.data.texts else None - if standard_gltf_exporter_settings != None: - try: - standard_gltf_exporter_settings = json.loads(standard_gltf_exporter_settings.as_string()) - except: - standard_gltf_exporter_settings = {} - else: - standard_gltf_exporter_settings = {} - - return standard_gltf_exporter_settings \ No newline at end of file diff --git a/tools/blenvy/settings.py b/tools/blenvy/settings.py index 79bcf80..b89ef76 100644 --- a/tools/blenvy/settings.py +++ b/tools/blenvy/settings.py @@ -14,8 +14,11 @@ def upsert_settings(name, data): def load_settings(name): stored_settings = bpy.data.texts[name] if name in bpy.data.texts else None - if stored_settings != None: - return json.loads(stored_settings.as_string()) + if stored_settings is not None: + try: + return json.loads(stored_settings.as_string()) + except: + return None return None # checks if old & new settings (dicts really) are identical