From f6b61f83ae0842b21656d1d04e1b8464281799dc Mon Sep 17 00:00:00 2001 From: "kaosat.dev" Date: Fri, 17 May 2024 23:20:48 +0200 Subject: [PATCH] feat(blenvy): continued work on auto_export refactor --- tools/blenvy/core/blenvy_manager.py | 8 ++++++-- .../gltf_auto_export/auto_export/export_main_scenes.py | 4 ++-- tools/blenvy/gltf_auto_export/helpers/helpers_scenes.py | 6 +++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tools/blenvy/core/blenvy_manager.py b/tools/blenvy/core/blenvy_manager.py index 63f385c..f899d3b 100644 --- a/tools/blenvy/core/blenvy_manager.py +++ b/tools/blenvy/core/blenvy_manager.py @@ -7,6 +7,8 @@ import blenvy.gltf_auto_export.settings as auto_export_settings def update_scene_lists(self, context): blenvy = self# context.window_manager.blenvy + blenvy.main_scene_names = [scene.name for scene in blenvy.main_scenes] # FIXME: unsure + blenvy.library_scene_names = [scene.name for scene in blenvy.library_scenes] # FIXME: unsure upsert_settings(blenvy.settings_save_path, {"common_main_scene_names": [scene.name for scene in blenvy.main_scenes]}) upsert_settings(blenvy.settings_save_path, {"common_library_scene_names": [scene.name for scene in blenvy.library_scenes]}) @@ -74,13 +76,15 @@ class BlenvyManager(PropertyGroup): main_scenes: CollectionProperty(name="main scenes", type=SceneSelector) # type: ignore main_scenes_index: IntProperty(name = "Index for main scenes list", default = 0, update=update_scene_lists) # type: ignore + main_scene_names = [] # FIXME: unsure library_scenes: CollectionProperty(name="library scenes", type=SceneSelector) # type: ignore library_scenes_index: IntProperty(name = "Index for library scenes list", default = 0, update=update_scene_lists) # type: ignore - + library_scene_names = [] # FIXME: unsure + # sub ones auto_export: PointerProperty(type=auto_export_settings.AutoExportSettings) # type: ignore - #components: PointerProperty(type=auto_export_settings.AutoExportSettings) # type: ignore + #components: PointerProperty(type=bevy_component_settings.ComponentSettings) # type: ignore def is_scene_ok(self, scene): try: diff --git a/tools/blenvy/gltf_auto_export/auto_export/export_main_scenes.py b/tools/blenvy/gltf_auto_export/auto_export/export_main_scenes.py index e4b24c6..487bc35 100644 --- a/tools/blenvy/gltf_auto_export/auto_export/export_main_scenes.py +++ b/tools/blenvy/gltf_auto_export/auto_export/export_main_scenes.py @@ -14,8 +14,8 @@ def export_main_scene(scene, blend_file_path, addon_prefs, blueprints_data): export_assets_path_full = getattr(addon_prefs,"export_assets_path_full") export_levels_path_full = getattr(addon_prefs,"export_levels_path_full") - export_blueprints = getattr(addon_prefs,"export_blueprints") - export_separate_dynamic_and_static_objects = getattr(addon_prefs, "export_separate_dynamic_and_static_objects") + export_blueprints = getattr(addon_prefs.auto_export,"export_blueprints") + export_separate_dynamic_and_static_objects = getattr(addon_prefs.auto_export, "export_separate_dynamic_and_static_objects") export_settings = { **gltf_export_preferences, 'use_active_scene': True, diff --git a/tools/blenvy/gltf_auto_export/helpers/helpers_scenes.py b/tools/blenvy/gltf_auto_export/helpers/helpers_scenes.py index 4ffcfc7..40e3667 100644 --- a/tools/blenvy/gltf_auto_export/helpers/helpers_scenes.py +++ b/tools/blenvy/gltf_auto_export/helpers/helpers_scenes.py @@ -146,7 +146,7 @@ def duplicate_object(object, parent, combine_mode, destination_collection, bluep # copies the contents of a collection into another one while replacing library instances with empties def copy_hollowed_collection_into(source_collection, destination_collection, parent_empty=None, filter=None, blueprints_data=None, addon_prefs={}): - collection_instances_combine_mode = getattr(addon_prefs, "collection_instances_combine_mode") + collection_instances_combine_mode = getattr(addon_prefs.auto_export, "collection_instances_combine_mode") for object in source_collection.objects: if object.name.endswith("____bak"): # some objects could already have been handled, ignore them @@ -210,6 +210,10 @@ def get_scenes(addon_prefs): level_scene_names= getattr(addon_prefs, "main_scene_names", []) #list(map(lambda scene: scene.name, getattr(addon_prefs,"main_scenes"))) library_scene_names = getattr(addon_prefs, "library_scene_names", []) #list(map(lambda scene: scene.name, getattr(addon_prefs,"library_scenes"))) + level_scene_names= list(map(lambda scene: scene.name, getattr(addon_prefs,"main_scenes"))) + library_scene_names = list(map(lambda scene: scene.name, getattr(addon_prefs,"library_scenes"))) + + print("level_scene_names", level_scene_names) level_scene_names = list(filter(lambda name: name in bpy.data.scenes, level_scene_names)) library_scene_names = list(filter(lambda name: name in bpy.data.scenes, library_scene_names))