chore(auto_export): cleanups

This commit is contained in:
kaosat.dev 2024-04-30 11:59:04 +02:00
parent 49917e3b17
commit dc053562bc
2 changed files with 1 additions and 45 deletions

View File

@ -1,12 +1,9 @@
import json import json
import os
from types import SimpleNamespace
import bpy import bpy
from bpy.types import (PropertyGroup) from bpy.types import (PropertyGroup)
from bpy.props import (PointerProperty, IntProperty, StringProperty) from bpy.props import (PointerProperty, IntProperty, StringProperty)
from .did_export_settings_change import did_export_settings_change
from .get_blueprints_to_export import get_blueprints_to_export from .get_blueprints_to_export import get_blueprints_to_export
from ..constants import TEMPSCENE_PREFIX from ..constants import TEMPSCENE_PREFIX
@ -158,47 +155,6 @@ class AutoExportTracker(PropertyGroup):
# keep it simple, just use Simplenamespace for compatibility with the rest of our code # keep it simple, just use Simplenamespace for compatibility with the rest of our code
# TODO: debounce # TODO: debounce
"""export_settings_changed = did_export_settings_change()
tmp = {}
for k in AutoExportGltfAddonPreferences.__annotations__:
item = AutoExportGltfAddonPreferences.__annotations__[k]
default = item.keywords.get('default', None)
tmp[k] = default
auto_settings = get_auto_exporter_settings()
for k in auto_settings:
tmp[k] = auto_settings[k]
tmp['__annotations__'] = tmp
# path to the current blend file
file_path = bpy.data.filepath
# Get the folder
folder_path = os.path.dirname(file_path)
export_output_folder =tmp["export_output_folder"]
export_models_path = os.path.join(folder_path, export_output_folder)
export_blueprints_path = os.path.join(folder_path, export_output_folder, tmp["export_blueprints_path"]) if tmp["export_blueprints_path"] != '' else folder_path
tmp["export_blueprints_path"] = export_blueprints_path
tmp["export_models_path"] = export_models_path
addon_prefs = SimpleNamespace(**tmp)
#print("cls.changed_objects_per_scene", cls.changed_objects_per_scene)
(collections, collections_to_export, internal_collections, collections_per_scene) = get_blueprints_to_export(cls.changed_objects_per_scene, export_settings_changed, addon_prefs)
#print("collections to export", collections_to_export)
try:
# we save this list of collections in the context
bpy.context.window_manager.exportedCollections.clear()
#TODO: add error handling for this
for collection_name in collections_to_export:
ui_info = bpy.context.window_manager.exportedCollections.add()
ui_info.name = collection_name
except Exception as error:
pass
#self.report({"ERROR"}, "Failed to populate list of exported collections/blueprints")
"""
"""depsgraph = bpy.context.evaluated_depsgraph_get()
for update in depsgraph.updates:
print("update", update)"""
def disable_change_detection(self): def disable_change_detection(self):
#print("disable change detection") #print("disable change detection")
self.change_detection_enabled = False self.change_detection_enabled = False

View File

@ -58,7 +58,7 @@ class GLTF_PT_auto_export_changes_list(bpy.types.Panel):
class GLTF_PT_auto_export_blueprints_list(bpy.types.Panel): class GLTF_PT_auto_export_blueprints_list(bpy.types.Panel):
bl_space_type = 'VIEW_3D' bl_space_type = 'VIEW_3D'
bl_region_type = 'UI' bl_region_type = 'UI'
bl_label = "Blueprints to export" bl_label = "Blueprints"
bl_parent_id = "GLTF_PT_auto_export_SidePanel" bl_parent_id = "GLTF_PT_auto_export_SidePanel"
bl_options = {'DEFAULT_CLOSED'} bl_options = {'DEFAULT_CLOSED'}