Compare commits

...

3 Commits

Author SHA1 Message Date
Mark Moissette
b0b241df21
Merge f27c8a078c into 9b50d77790 2024-08-12 12:35:42 +00:00
kaosat.dev
f27c8a078c refactor(Blender): export_scene_settings => match_blender_visuals
* also updated name & description for more clarity
2024-08-12 14:34:55 +02:00
kaosat.dev
8f854e1b61 feat(Bevy): SaveLoadPlugin is now disabled on wasm & ExportRegistryPlugin is disabled in non dev mode based on debug_assertions 2024-08-12 14:33:12 +02:00
11 changed files with 28 additions and 29 deletions

View File

@ -65,9 +65,10 @@ impl Plugin for BlenvyPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_plugins(( app.add_plugins((
ComponentsFromGltfPlugin::default(), ComponentsFromGltfPlugin::default(),
#[cfg(not(target_arch = "wasm32"))] #[cfg(debug_assertions)] // we only need the export registry plugin at dev time
ExportRegistryPlugin::default(), ExportRegistryPlugin::default(),
BlueprintsPlugin::default(), BlueprintsPlugin::default(),
#[cfg(not(target_arch = "wasm32"))] // save & load is only for non wasm platforms
SaveLoadPlugin::default() SaveLoadPlugin::default()
)) ))
.insert_resource(BlenvyConfig { .insert_resource(BlenvyConfig {

View File

@ -26,7 +26,7 @@ def auto_export(changes_per_scene, changes_per_collection, changes_per_material,
try: try:
#should we use change detection or not #should we use change detection or not
change_detection = getattr(settings.auto_export, "change_detection") 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") export_blueprints_enabled = getattr(settings.auto_export, "export_blueprints")
split_out_materials = getattr(settings.auto_export, "split_out_materials") split_out_materials = getattr(settings.auto_export, "split_out_materials")
split_out_animations = getattr(settings.auto_export, "split_out_animations") 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.add_blueprint(blueprint)
#bpy.context.window_manager.blueprints_registry.refresh_blueprints() #bpy.context.window_manager.blueprints_registry.refresh_blueprints()
if export_scene_settings: if match_blender_visuals:
# inject/ update scene components # inject/ update scene components
upsert_scene_components(settings.level_scenes) upsert_scene_components(settings.level_scenes)
#inject/ update light shadow information #inject/ update light shadow information
@ -153,7 +153,7 @@ def auto_export(changes_per_scene, changes_per_collection, changes_per_material,
finally: finally:
# FIXME: error handling ? also redundant # FIXME: error handling ? also redundant
if export_scene_settings: if match_blender_visuals:
# inject/ update scene components # inject/ update scene components
remove_scene_components(settings.level_scenes) remove_scene_components(settings.level_scenes)

View File

@ -15,7 +15,7 @@ parameter_names_whitelist_common = [
# which auto export settings changes should trigger a re-export # which auto export settings changes should trigger a re-export
parameter_names_whitelist_auto_export = [ parameter_names_whitelist_auto_export = [
# auto export # auto export
'export_scene_settings', 'match_blender_visuals',
'export_blueprints', 'export_blueprints',
'export_separate_dynamic_and_static_objects', 'export_separate_dynamic_and_static_objects',
'split_out_materials', 'split_out_materials',

View File

@ -45,12 +45,10 @@ class AutoExportSettings(PropertyGroup):
update=save_settings update=save_settings
) # type: ignore ) # type: ignore
# scenes # matching visuals between Blender & Bevy
match_blender_visuals: BoolProperty(
# scene components name='Match Blender visuals in Bevy',
export_scene_settings: BoolProperty( description='Adds a number of components for AmbientLighting, Bloom, AO to try and match the look & feel of visuals from Blender in Bevy',
name='Export scene settings',
description='Export scene settings ie AmbientLighting, Bloom, AO etc',
default=False, default=False,
update=save_settings update=save_settings
) # type: ignore ) # type: ignore

View File

@ -23,7 +23,7 @@ def draw_settings_ui(layout, auto_export_settings):
op.filepath="____dummy____" op.filepath="____dummy____"
op.gltf_export_id = "blenvy" # we specify that we are in a special case 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, panel = layout.panel("Change Detection", default_closed=False)
header.label(text="Change Detection") header.label(text="Change Detection")

View File

@ -104,7 +104,7 @@ def test_export_complex(setup_data):
#blenvy.project_root_path = #blenvy.project_root_path =
#blenvy.blueprints_path #blenvy.blueprints_path
blenvy.auto_export.auto_export = True 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.export_blueprints = True
blenvy.auto_export.split_out_materials = True blenvy.auto_export.split_out_materials = True

View File

@ -51,7 +51,7 @@ def test_export_external_blueprints(setup_data):
#blenvy.project_root_path = #blenvy.project_root_path =
#blenvy.blueprints_path #blenvy.blueprints_path
blenvy.auto_export.auto_export = True 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.export_blueprints = True
#blenvy.auto_export.split_out_materials = True #blenvy.auto_export.split_out_materials = True

View File

@ -105,7 +105,7 @@ def test_export_complex(setup_data):
#blenvy.project_root_path = #blenvy.project_root_path =
#blenvy.blueprints_path #blenvy.blueprints_path
blenvy.auto_export.auto_export = True 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.export_blueprints = True
blenvy.auto_export.split_out_materials = True blenvy.auto_export.split_out_materials = True

View File

@ -142,7 +142,7 @@ def test_export_changed_parameters(setup_data):
direct_mode=True, direct_mode=True,
project_root_path = os.path.abspath(setup_data["root_path"]), project_root_path = os.path.abspath(setup_data["root_path"]),
export_output_folder="./models", export_output_folder="./models",
export_scene_settings=True, match_blender_visuals=True,
export_blueprints=True, export_blueprints=True,
split_out_materials=True split_out_materials=True
) )
@ -161,7 +161,7 @@ def test_export_changed_parameters(setup_data):
direct_mode=True, direct_mode=True,
project_root_path = os.path.abspath(setup_data["root_path"]), project_root_path = os.path.abspath(setup_data["root_path"]),
export_output_folder="./models", export_output_folder="./models",
export_scene_settings=True, match_blender_visuals=True,
export_blueprints=True, export_blueprints=True,
split_out_materials=True split_out_materials=True
) )
@ -186,7 +186,7 @@ def test_export_changed_parameters(setup_data):
direct_mode=True, direct_mode=True,
project_root_path = os.path.abspath(setup_data["root_path"]), project_root_path = os.path.abspath(setup_data["root_path"]),
export_output_folder="./models", export_output_folder="./models",
export_scene_settings=True, match_blender_visuals=True,
export_blueprints=True, export_blueprints=True,
split_out_materials=True split_out_materials=True
) )
@ -202,7 +202,7 @@ def test_export_changed_parameters(setup_data):
direct_mode=True, direct_mode=True,
project_root_path = os.path.abspath(setup_data["root_path"]), project_root_path = os.path.abspath(setup_data["root_path"]),
export_output_folder="./models", export_output_folder="./models",
export_scene_settings=True, match_blender_visuals=True,
export_blueprints=True, export_blueprints=True,
split_out_materials=True split_out_materials=True
) )
@ -231,7 +231,7 @@ def test_export_changed_parameters(setup_data):
direct_mode=True, direct_mode=True,
project_root_path = os.path.abspath(setup_data["root_path"]), project_root_path = os.path.abspath(setup_data["root_path"]),
export_output_folder="./models", export_output_folder="./models",
export_scene_settings=True, match_blender_visuals=True,
export_blueprints=True, export_blueprints=True,
split_out_materials=False split_out_materials=False
) )
@ -247,7 +247,7 @@ def test_export_changed_parameters(setup_data):
direct_mode=True, direct_mode=True,
project_root_path = os.path.abspath(setup_data["root_path"]), project_root_path = os.path.abspath(setup_data["root_path"]),
export_output_folder="./models", export_output_folder="./models",
export_scene_settings=True, match_blender_visuals=True,
export_blueprints=True, export_blueprints=True,
split_out_materials=False split_out_materials=False
) )

View File

@ -82,7 +82,7 @@ def test_export_do_not_export_blueprints(setup_data):
direct_mode=True, direct_mode=True,
project_root_path = os.path.abspath(setup_data["root_path"]), project_root_path = os.path.abspath(setup_data["root_path"]),
export_output_folder="assets/models", export_output_folder="assets/models",
export_scene_settings=True, match_blender_visuals=True,
export_blueprints=False, export_blueprints=False,
) )
assert os.path.exists(os.path.join(setup_data["models_path"], "World.glb")) == True 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, direct_mode=True,
project_root_path = os.path.abspath(setup_data["root_path"]), project_root_path = os.path.abspath(setup_data["root_path"]),
export_output_folder="./models", export_output_folder="./models",
export_scene_settings=True, match_blender_visuals=True,
export_blueprints=True, export_blueprints=True,
blueprints_path = "assets/other_blueprints" blueprints_path = "assets/other_blueprints"
) )
@ -135,7 +135,7 @@ def test_export_materials_library(setup_data):
direct_mode=True, direct_mode=True,
project_root_path = os.path.abspath(setup_data["root_path"]), project_root_path = os.path.abspath(setup_data["root_path"]),
export_output_folder="./models", export_output_folder="./models",
export_scene_settings=True, match_blender_visuals=True,
export_blueprints=True, export_blueprints=True,
split_out_materials = True split_out_materials = True
) )
@ -162,7 +162,7 @@ def test_export_materials_library_custom_path(setup_data):
direct_mode=True, direct_mode=True,
project_root_path = os.path.abspath(setup_data["root_path"]), project_root_path = os.path.abspath(setup_data["root_path"]),
export_output_folder="./models", export_output_folder="./models",
export_scene_settings=True, match_blender_visuals=True,
export_blueprints=True, export_blueprints=True,
split_out_materials = True, split_out_materials = True,
materials_path="assets/other_materials" materials_path="assets/other_materials"
@ -221,7 +221,7 @@ def test_export_do_not_export_marked_assets(setup_data):
direct_mode=True, direct_mode=True,
project_root_path = os.path.abspath(setup_data["root_path"]), project_root_path = os.path.abspath(setup_data["root_path"]),
export_output_folder="./models", export_output_folder="./models",
export_scene_settings=True, match_blender_visuals=True,
export_blueprints=True, export_blueprints=True,
) )
assert os.path.exists(os.path.join(setup_data["levels_path"], "World.glb")) == 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, direct_mode=True,
project_root_path = os.path.abspath(setup_data["root_path"]), project_root_path = os.path.abspath(setup_data["root_path"]),
export_output_folder="./models", export_output_folder="./models",
export_scene_settings=True, match_blender_visuals=True,
export_blueprints=True, export_blueprints=True,
export_separate_dynamic_and_static_objects = 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, direct_mode=True,
project_root_path = os.path.abspath(setup_data["root_path"]), project_root_path = os.path.abspath(setup_data["root_path"]),
export_output_folder="./models", export_output_folder="./models",
export_scene_settings=True, match_blender_visuals=True,
export_blueprints=True, export_blueprints=True,
) )
assert os.path.exists(os.path.join(setup_data["levels_path"], "World.glb")) == True assert os.path.exists(os.path.join(setup_data["levels_path"], "World.glb")) == True

View File

@ -31,7 +31,7 @@ def run_auto_export(setup_data):
direct_mode=True, direct_mode=True,
project_root_path = os.path.abspath(setup_data["root_path"]), project_root_path = os.path.abspath(setup_data["root_path"]),
export_output_folder="./models", export_output_folder="./models",
export_scene_settings=True, match_blender_visuals=True,
export_blueprints=True, export_blueprints=True,
split_out_materials=False split_out_materials=False
) )