refactor(Blenvy): minor re-orgs

This commit is contained in:
kaosat.dev 2024-05-25 11:14:13 +02:00
parent 8b76a34bec
commit 4f742e7735
4 changed files with 11 additions and 18 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:
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