From f27c8a078cce7a868ba2178311f76e725a18a0ac Mon Sep 17 00:00:00 2001 From: "kaosat.dev" Date: Mon, 12 Aug 2024 14:34:55 +0200 Subject: [PATCH] refactor(Blender): export_scene_settings => match_blender_visuals * also updated name & description for more clarity --- .../add_ons/auto_export/common/auto_export.py | 6 +++--- .../add_ons/auto_export/common/settings_diff.py | 2 +- tools/blenvy/add_ons/auto_export/settings.py | 10 ++++------ tools/blenvy/add_ons/auto_export/ui.py | 2 +- tools/blenvy/tests/test_bevy_integration.py | 2 +- .../blenvy/tests/test_bevy_integration_prepare.py | 2 +- tools/blenvy/tests/test_bevy_integration_simple.py | 2 +- tools/blenvy/tests/test_changed_parameters.py | 12 ++++++------ tools/blenvy/tests/test_export_parameters.py | 14 +++++++------- tools/blenvy/tests/test_helpers.py | 2 +- 10 files changed, 26 insertions(+), 28 deletions(-) diff --git a/tools/blenvy/add_ons/auto_export/common/auto_export.py b/tools/blenvy/add_ons/auto_export/common/auto_export.py index 2b272b4..8da82ee 100644 --- a/tools/blenvy/add_ons/auto_export/common/auto_export.py +++ b/tools/blenvy/add_ons/auto_export/common/auto_export.py @@ -26,7 +26,7 @@ def auto_export(changes_per_scene, changes_per_collection, changes_per_material, try: #should we use change detection or not change_detection = getattr(settings.auto_export, "change_detection") - export_scene_settings = getattr(settings.auto_export, "export_scene_settings") + match_blender_visuals = getattr(settings.auto_export, "match_blender_visuals") export_blueprints_enabled = getattr(settings.auto_export, "export_blueprints") split_out_materials = getattr(settings.auto_export, "split_out_materials") split_out_animations = getattr(settings.auto_export, "split_out_animations") @@ -54,7 +54,7 @@ def auto_export(changes_per_scene, changes_per_collection, changes_per_material, bpy.context.window_manager.blueprints_registry.add_blueprint(blueprint) #bpy.context.window_manager.blueprints_registry.refresh_blueprints() - if export_scene_settings: + if match_blender_visuals: # inject/ update scene components upsert_scene_components(settings.level_scenes) #inject/ update light shadow information @@ -153,7 +153,7 @@ def auto_export(changes_per_scene, changes_per_collection, changes_per_material, finally: # FIXME: error handling ? also redundant - if export_scene_settings: + if match_blender_visuals: # inject/ update scene components remove_scene_components(settings.level_scenes) diff --git a/tools/blenvy/add_ons/auto_export/common/settings_diff.py b/tools/blenvy/add_ons/auto_export/common/settings_diff.py index be31d90..dfdc64c 100644 --- a/tools/blenvy/add_ons/auto_export/common/settings_diff.py +++ b/tools/blenvy/add_ons/auto_export/common/settings_diff.py @@ -15,7 +15,7 @@ parameter_names_whitelist_common = [ # which auto export settings changes should trigger a re-export parameter_names_whitelist_auto_export = [ # auto export - 'export_scene_settings', + 'match_blender_visuals', 'export_blueprints', 'export_separate_dynamic_and_static_objects', 'split_out_materials', diff --git a/tools/blenvy/add_ons/auto_export/settings.py b/tools/blenvy/add_ons/auto_export/settings.py index f309cce..ab7b1b4 100644 --- a/tools/blenvy/add_ons/auto_export/settings.py +++ b/tools/blenvy/add_ons/auto_export/settings.py @@ -45,12 +45,10 @@ class AutoExportSettings(PropertyGroup): update=save_settings ) # type: ignore - # scenes - - # scene components - export_scene_settings: BoolProperty( - name='Export scene settings', - description='Export scene settings ie AmbientLighting, Bloom, AO etc', + # matching visuals between Blender & Bevy + match_blender_visuals: BoolProperty( + name='Match Blender visuals in Bevy', + description='Adds a number of components for AmbientLighting, Bloom, AO to try and match the look & feel of visuals from Blender in Bevy', default=False, update=save_settings ) # type: ignore diff --git a/tools/blenvy/add_ons/auto_export/ui.py b/tools/blenvy/add_ons/auto_export/ui.py index 8c86dca..6f1fe01 100644 --- a/tools/blenvy/add_ons/auto_export/ui.py +++ b/tools/blenvy/add_ons/auto_export/ui.py @@ -23,7 +23,7 @@ def draw_settings_ui(layout, auto_export_settings): op.filepath="____dummy____" op.gltf_export_id = "blenvy" # we specify that we are in a special case - section.prop(auto_export_settings, "export_scene_settings") + section.prop(auto_export_settings, "match_blender_visuals") header, panel = layout.panel("Change Detection", default_closed=False) header.label(text="Change Detection") diff --git a/tools/blenvy/tests/test_bevy_integration.py b/tools/blenvy/tests/test_bevy_integration.py index 09490d8..599bb79 100644 --- a/tools/blenvy/tests/test_bevy_integration.py +++ b/tools/blenvy/tests/test_bevy_integration.py @@ -104,7 +104,7 @@ def test_export_complex(setup_data): #blenvy.project_root_path = #blenvy.blueprints_path blenvy.auto_export.auto_export = True - blenvy.auto_export.export_scene_settings = True + blenvy.auto_export.match_blender_visuals = True blenvy.auto_export.export_blueprints = True blenvy.auto_export.split_out_materials = True diff --git a/tools/blenvy/tests/test_bevy_integration_prepare.py b/tools/blenvy/tests/test_bevy_integration_prepare.py index 51461a5..e86111d 100644 --- a/tools/blenvy/tests/test_bevy_integration_prepare.py +++ b/tools/blenvy/tests/test_bevy_integration_prepare.py @@ -51,7 +51,7 @@ def test_export_external_blueprints(setup_data): #blenvy.project_root_path = #blenvy.blueprints_path blenvy.auto_export.auto_export = True - blenvy.auto_export.export_scene_settings = True + blenvy.auto_export.match_blender_visuals = True blenvy.auto_export.export_blueprints = True #blenvy.auto_export.split_out_materials = True diff --git a/tools/blenvy/tests/test_bevy_integration_simple.py b/tools/blenvy/tests/test_bevy_integration_simple.py index b7834c7..aadd219 100644 --- a/tools/blenvy/tests/test_bevy_integration_simple.py +++ b/tools/blenvy/tests/test_bevy_integration_simple.py @@ -105,7 +105,7 @@ def test_export_complex(setup_data): #blenvy.project_root_path = #blenvy.blueprints_path blenvy.auto_export.auto_export = True - blenvy.auto_export.export_scene_settings = True + blenvy.auto_export.match_blender_visuals = True blenvy.auto_export.export_blueprints = True blenvy.auto_export.split_out_materials = True diff --git a/tools/blenvy/tests/test_changed_parameters.py b/tools/blenvy/tests/test_changed_parameters.py index 6dba68e..85b2151 100644 --- a/tools/blenvy/tests/test_changed_parameters.py +++ b/tools/blenvy/tests/test_changed_parameters.py @@ -142,7 +142,7 @@ def test_export_changed_parameters(setup_data): direct_mode=True, project_root_path = os.path.abspath(setup_data["root_path"]), export_output_folder="./models", - export_scene_settings=True, + match_blender_visuals=True, export_blueprints=True, split_out_materials=True ) @@ -161,7 +161,7 @@ def test_export_changed_parameters(setup_data): direct_mode=True, project_root_path = os.path.abspath(setup_data["root_path"]), export_output_folder="./models", - export_scene_settings=True, + match_blender_visuals=True, export_blueprints=True, split_out_materials=True ) @@ -186,7 +186,7 @@ def test_export_changed_parameters(setup_data): direct_mode=True, project_root_path = os.path.abspath(setup_data["root_path"]), export_output_folder="./models", - export_scene_settings=True, + match_blender_visuals=True, export_blueprints=True, split_out_materials=True ) @@ -202,7 +202,7 @@ def test_export_changed_parameters(setup_data): direct_mode=True, project_root_path = os.path.abspath(setup_data["root_path"]), export_output_folder="./models", - export_scene_settings=True, + match_blender_visuals=True, export_blueprints=True, split_out_materials=True ) @@ -231,7 +231,7 @@ def test_export_changed_parameters(setup_data): direct_mode=True, project_root_path = os.path.abspath(setup_data["root_path"]), export_output_folder="./models", - export_scene_settings=True, + match_blender_visuals=True, export_blueprints=True, split_out_materials=False ) @@ -247,7 +247,7 @@ def test_export_changed_parameters(setup_data): direct_mode=True, project_root_path = os.path.abspath(setup_data["root_path"]), export_output_folder="./models", - export_scene_settings=True, + match_blender_visuals=True, export_blueprints=True, split_out_materials=False ) diff --git a/tools/blenvy/tests/test_export_parameters.py b/tools/blenvy/tests/test_export_parameters.py index c5be050..15583fa 100644 --- a/tools/blenvy/tests/test_export_parameters.py +++ b/tools/blenvy/tests/test_export_parameters.py @@ -82,7 +82,7 @@ def test_export_do_not_export_blueprints(setup_data): direct_mode=True, project_root_path = os.path.abspath(setup_data["root_path"]), export_output_folder="assets/models", - export_scene_settings=True, + match_blender_visuals=True, export_blueprints=False, ) assert os.path.exists(os.path.join(setup_data["models_path"], "World.glb")) == True @@ -109,7 +109,7 @@ def test_export_custom_blueprints_path(setup_data): direct_mode=True, project_root_path = os.path.abspath(setup_data["root_path"]), export_output_folder="./models", - export_scene_settings=True, + match_blender_visuals=True, export_blueprints=True, blueprints_path = "assets/other_blueprints" ) @@ -135,7 +135,7 @@ def test_export_materials_library(setup_data): direct_mode=True, project_root_path = os.path.abspath(setup_data["root_path"]), export_output_folder="./models", - export_scene_settings=True, + match_blender_visuals=True, export_blueprints=True, split_out_materials = True ) @@ -162,7 +162,7 @@ def test_export_materials_library_custom_path(setup_data): direct_mode=True, project_root_path = os.path.abspath(setup_data["root_path"]), export_output_folder="./models", - export_scene_settings=True, + match_blender_visuals=True, export_blueprints=True, split_out_materials = True, materials_path="assets/other_materials" @@ -221,7 +221,7 @@ def test_export_do_not_export_marked_assets(setup_data): direct_mode=True, project_root_path = os.path.abspath(setup_data["root_path"]), export_output_folder="./models", - export_scene_settings=True, + match_blender_visuals=True, export_blueprints=True, ) assert os.path.exists(os.path.join(setup_data["levels_path"], "World.glb")) == True @@ -254,7 +254,7 @@ def test_export_separate_dynamic_and_static_objects(setup_data): direct_mode=True, project_root_path = os.path.abspath(setup_data["root_path"]), export_output_folder="./models", - export_scene_settings=True, + match_blender_visuals=True, export_blueprints=True, export_separate_dynamic_and_static_objects = True ) @@ -282,7 +282,7 @@ def test_export_should_not_generate_orphan_data(setup_data): direct_mode=True, project_root_path = os.path.abspath(setup_data["root_path"]), export_output_folder="./models", - export_scene_settings=True, + match_blender_visuals=True, export_blueprints=True, ) assert os.path.exists(os.path.join(setup_data["levels_path"], "World.glb")) == True diff --git a/tools/blenvy/tests/test_helpers.py b/tools/blenvy/tests/test_helpers.py index 75812c1..1e45045 100644 --- a/tools/blenvy/tests/test_helpers.py +++ b/tools/blenvy/tests/test_helpers.py @@ -31,7 +31,7 @@ def run_auto_export(setup_data): direct_mode=True, project_root_path = os.path.abspath(setup_data["root_path"]), export_output_folder="./models", - export_scene_settings=True, + match_blender_visuals=True, export_blueprints=True, split_out_materials=False )