diff --git a/TODO.md b/TODO.md index 7abc7be..bd72c32 100644 --- a/TODO.md +++ b/TODO.md @@ -226,7 +226,7 @@ Blender side: - [ ] materials_path custom property should be ignored both in the list of fixable component AND on export - [ ] if we want to add material_infos & others as normal components they should not be editable, so we need another attribute, and adapt the UI for that - - [ ] if material library is toggled, then changes to materials should not change the blueprints that are using them ? + - [ ] if material library is toggled, then changes to materials should not change the blueprints that are using them => not really: as the name & co might change - [ ] material assets seem to be added to list regardless of whether material exports are enabled or not - [ ] review & upgrade overall logic of material libraries, their names & output path - [ ] persist exported materials path in blueprints so that it can be read from library file users @@ -253,6 +253,7 @@ Blender side: - [x] rename all "main scene xx" to "level scene" - [x] make sure the "add scene" button is not available unless you have actually selected one - [x] make auto export be on by default, however bail out early by detecting if there are any level/blueprint scenes +- [x] remove custom components to filter out correctly from exported blueprints list Bevy Side: - [x] deprecate BlueprintName & BlueprintPath & use BlueprintInfo instead diff --git a/tools/blenvy/add_ons/auto_export/common/duplicate_object.py b/tools/blenvy/add_ons/auto_export/common/duplicate_object.py index 7157118..26ee995 100644 --- a/tools/blenvy/add_ons/auto_export/common/duplicate_object.py +++ b/tools/blenvy/add_ons/auto_export/common/duplicate_object.py @@ -3,16 +3,7 @@ import bpy from blenvy.core.object_makers import (make_empty) from blenvy.add_ons.bevy_components.utils import is_component_valid_and_enabled from ..constants import custom_properties_to_filter_out - -def remove_unwanted_custom_properties(object): - to_remove = [] - component_names = list(object.keys()) # to avoid 'IDPropertyGroup changed size during iteration' issues - for component_name in component_names: - if not is_component_valid_and_enabled(object, component_name): - to_remove.append(component_name) - for cp in custom_properties_to_filter_out + to_remove: - if cp in object: - del object[cp] +from ..utils import remove_unwanted_custom_properties # TODO: rename actions ? # reference https://github.com/KhronosGroup/glTF-Blender-IO/blob/main/addons/io_scene_gltf2/blender/exp/animation/gltf2_blender_gather_action.py#L481 diff --git a/tools/blenvy/add_ons/auto_export/common/generate_temporary_scene_and_export.py b/tools/blenvy/add_ons/auto_export/common/generate_temporary_scene_and_export.py index 191f2bb..1b2e13e 100644 --- a/tools/blenvy/add_ons/auto_export/common/generate_temporary_scene_and_export.py +++ b/tools/blenvy/add_ons/auto_export/common/generate_temporary_scene_and_export.py @@ -6,6 +6,9 @@ from .duplicate_object import duplicate_object from .export_gltf import export_gltf from blenvy.core.scene_helpers import add_scene_property from ..constants import custom_properties_to_filter_out +from ..utils import remove_unwanted_custom_properties + + """ generates a temporary scene, fills it with data, cleans up after itself * named using temp_scene_name @@ -27,6 +30,9 @@ def generate_temporary_scene_and_export(settings, gltf_export_settings, gltf_out print("entry in additional data", entry, "value", additional_data[entry], "in", additional_data.name) temp_scene[entry] = additional_data[entry] + # we remove everything from the black list + remove_unwanted_custom_properties(temp_scene) + # save active scene active_scene = bpy.context.window.scene # and selected collection diff --git a/tools/blenvy/add_ons/auto_export/constants.py b/tools/blenvy/add_ons/auto_export/constants.py index 1f34ab2..88fa5f6 100644 --- a/tools/blenvy/add_ons/auto_export/constants.py +++ b/tools/blenvy/add_ons/auto_export/constants.py @@ -7,5 +7,5 @@ custom_properties_to_filter_out = [ 'components_meta', 'Components_meta', '_combine', 'template', 'Blenvy_scene_type', 'blenvy_scene_type', - 'Materials_path', 'Export_path' + 'materials_path', 'export_path', ] diff --git a/tools/blenvy/add_ons/auto_export/ui.py b/tools/blenvy/add_ons/auto_export/ui.py index 34f0585..94f9f61 100644 --- a/tools/blenvy/add_ons/auto_export/ui.py +++ b/tools/blenvy/add_ons/auto_export/ui.py @@ -58,10 +58,7 @@ def draw_settings_ui(layout, auto_export_settings): # materials section.prop(auto_export_settings, "export_materials_library") - section = section.box() - section.enabled = controls_enabled and auto_export_settings.export_materials_library - #section.prop(auto_export_settings, "materials_path") - + diff --git a/tools/blenvy/add_ons/auto_export/utils.py b/tools/blenvy/add_ons/auto_export/utils.py index 1581061..8bd4779 100644 --- a/tools/blenvy/add_ons/auto_export/utils.py +++ b/tools/blenvy/add_ons/auto_export/utils.py @@ -2,6 +2,18 @@ import posixpath import bpy from pathlib import Path from blenvy.assets.assets_scan import get_blueprint_asset_tree, get_level_scene_assets_tree2 +from blenvy.add_ons.bevy_components.utils import is_component_valid_and_enabled +from .constants import custom_properties_to_filter_out + +def remove_unwanted_custom_properties(object): + to_remove = [] + component_names = list(object.keys()) # to avoid 'IDPropertyGroup changed size during iteration' issues + for component_name in component_names: + if not is_component_valid_and_enabled(object, component_name): + to_remove.append(component_name) + for cp in custom_properties_to_filter_out + to_remove: + if cp in object: + del object[cp] def assets_to_fake_ron(list_like): result = [] diff --git a/tools/blenvy/core/blenvy_manager.py b/tools/blenvy/core/blenvy_manager.py index bf14d24..f0a5506 100644 --- a/tools/blenvy/core/blenvy_manager.py +++ b/tools/blenvy/core/blenvy_manager.py @@ -183,13 +183,6 @@ class BlenvyManager(PropertyGroup): print("setting", setting, settings[setting]) setattr(self, setting, settings[setting]) except:pass - """if "mode" in settings: - self.mode = settings["mode"] - - asset_path_names = ['project_root_path', 'assets_path', 'blueprints_path', 'levels_path', 'materials_path'] - for asset_path_name in asset_path_names: - if asset_path_name in settings: - setattr(self, asset_path_name, settings[asset_path_name])""" self.settings_save_enabled = True