refactor(Blenvy): moved components & auto export into a sub folder for clarity

This commit is contained in:
kaosat.dev 2024-05-25 13:26:30 +02:00
parent 26e75742b2
commit ea982d330f
57 changed files with 33 additions and 39 deletions

View File

@ -17,22 +17,20 @@ from bpy.props import (StringProperty)
# components management
from .bevy_components.components.operators import CopyComponentOperator, Fix_Component_Operator, OT_rename_component, RemoveComponentFromAllItemsOperator, RemoveComponentOperator, GenerateComponent_From_custom_property_Operator, PasteComponentOperator, AddComponentOperator, RenameHelper, Toggle_ComponentVisibility
from .bevy_components.registry.registry import ComponentsRegistry,MissingBevyType
from .bevy_components.registry.operators import (COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_ALL, COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_CURRENT, COMPONENTS_OT_REFRESH_PROPGROUPS_FROM_CUSTOM_PROPERTIES_ALL, COMPONENTS_OT_REFRESH_PROPGROUPS_FROM_CUSTOM_PROPERTIES_CURRENT, OT_select_component_name_to_replace, OT_select_object, ReloadRegistryOperator, OT_OpenSchemaFileBrowser)
from .bevy_components.registry.ui import (BEVY_COMPONENTS_PT_Configuration, BEVY_COMPONENTS_PT_AdvancedToolsPanel, BEVY_COMPONENTS_PT_MissingTypesPanel, MISSING_TYPES_UL_List)
from .bevy_components.components.metadata import (ComponentMetadata, ComponentsMeta)
from .bevy_components.components.lists import GENERIC_LIST_OT_actions, Generic_LIST_OT_AddItem, Generic_LIST_OT_RemoveItem, Generic_LIST_OT_SelectItem
from .bevy_components.components.maps import GENERIC_MAP_OT_actions
from .bevy_components.components.definitions_list import (ComponentDefinitionsList, ClearComponentDefinitionsList)
from .bevy_components.components.ui import (BEVY_COMPONENTS_PT_ComponentsPanel)
from .add_ons.bevy_components.components.operators import CopyComponentOperator, Fix_Component_Operator, OT_rename_component, RemoveComponentFromAllItemsOperator, RemoveComponentOperator, GenerateComponent_From_custom_property_Operator, PasteComponentOperator, AddComponentOperator, RenameHelper, Toggle_ComponentVisibility
from .add_ons.bevy_components.registry.registry import ComponentsRegistry,MissingBevyType
from .add_ons.bevy_components.registry.operators import (COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_ALL, COMPONENTS_OT_REFRESH_CUSTOM_PROPERTIES_CURRENT, COMPONENTS_OT_REFRESH_PROPGROUPS_FROM_CUSTOM_PROPERTIES_ALL, COMPONENTS_OT_REFRESH_PROPGROUPS_FROM_CUSTOM_PROPERTIES_CURRENT, OT_select_component_name_to_replace, OT_select_object, ReloadRegistryOperator, OT_OpenSchemaFileBrowser)
from .add_ons.bevy_components.registry.ui import (BEVY_COMPONENTS_PT_Configuration, BEVY_COMPONENTS_PT_AdvancedToolsPanel, BEVY_COMPONENTS_PT_MissingTypesPanel, MISSING_TYPES_UL_List)
from .add_ons.bevy_components.components.metadata import (ComponentMetadata, ComponentsMeta)
from .add_ons.bevy_components.components.lists import GENERIC_LIST_OT_actions, Generic_LIST_OT_AddItem, Generic_LIST_OT_RemoveItem, Generic_LIST_OT_SelectItem
from .add_ons.bevy_components.components.maps import GENERIC_MAP_OT_actions
from .add_ons.bevy_components.components.definitions_list import (ComponentDefinitionsList, ClearComponentDefinitionsList)
from .add_ons.bevy_components.components.ui import (BEVY_COMPONENTS_PT_ComponentsPanel)
# auto export
from .auto_export import gltf_post_export_callback
from .auto_export.export.tracker import AutoExportTracker
from .auto_export.settings import AutoExportSettings
from .add_ons.auto_export import gltf_post_export_callback
from .add_ons.auto_export.export.tracker import AutoExportTracker
from .add_ons.auto_export.settings import AutoExportSettings
# asset management
from .assets.ui import Blenvy_assets

View File

@ -3,7 +3,9 @@ import os
import bpy
import traceback
from ...core.scene_helpers import get_main_and_library_scenes
from blenvy.core.scene_helpers import get_main_and_library_scenes
from blenvy.blueprints.blueprints_scan import blueprints_scan
from blenvy.blueprints.blueprint_helpers import inject_export_path_into_internal_blueprints
from .get_blueprints_to_export import get_blueprints_to_export
from .get_levels_to_export import get_levels_to_export
@ -14,9 +16,6 @@ from .export_blueprints import export_blueprints
from .export_materials import cleanup_materials, export_materials
from ..modules.bevy_scene_components import remove_scene_components, upsert_scene_components
from ...blueprints.blueprints_scan import blueprints_scan
from ...blueprints.blueprint_helpers import inject_export_path_into_internal_blueprints
"""this is the main 'central' function for all auto export """
def auto_export(changes_per_scene, changed_export_parameters, settings):

View File

@ -2,7 +2,7 @@ import json
import os
import bpy
from ...settings import load_settings
from blenvy.settings import load_settings
def get_standard_exporter_settings():
standard_gltf_exporter_settings = load_settings(".blenvy_gltf_settings")

View File

@ -1,13 +1,13 @@
import os
import bpy
from pathlib import Path
from blenvy.blueprints.blueprint_helpers import inject_blueprints_list_into_main_scene, remove_blueprints_list_from_main_scene
from ..constants import TEMPSCENE_PREFIX
from ..helpers.generate_and_export import generate_and_export
from .export_gltf import (generate_gltf_export_preferences, export_gltf)
from ..modules.bevy_dynamic import is_object_dynamic, is_object_static
from ..helpers.helpers_scenes import clear_hollow_scene, copy_hollowed_collection_into
from ...blueprints.blueprint_helpers import inject_blueprints_list_into_main_scene, remove_blueprints_list_from_main_scene
def export_main_scene(scene, blend_file_path, settings, blueprints_data):
gltf_export_preferences = generate_gltf_export_preferences(settings)

View File

@ -2,9 +2,9 @@ import os
import bpy
from pathlib import Path
from ...core.helpers_collections import (traverse_tree)
from ...core.object_makers import make_cube
from ...materials.materials_helpers import get_all_materials
from blenvy.core.helpers_collections import (traverse_tree)
from blenvy.core.object_makers import make_cube
from blenvy.materials.materials_helpers import get_all_materials
from ..helpers.generate_and_export import generate_and_export
from .export_gltf import (generate_gltf_export_preferences)

View File

@ -1,6 +1,6 @@
from ...core.scene_helpers import get_main_and_library_scenes
from ...blueprints.blueprint_helpers import find_blueprints_not_on_disk
from blenvy.core.scene_helpers import get_main_and_library_scenes
from blenvy.blueprints.blueprint_helpers import find_blueprints_not_on_disk
# TODO: this should also take the split/embed mode into account: if a nested collection changes AND embed is active, its container collection should also be exported
def get_blueprints_to_export(changes_per_scene, changed_export_parameters, blueprints_data, settings):

View File

@ -1,6 +1,5 @@
import bpy
from ...core.scene_helpers import get_main_and_library_scenes
from ...blueprints.blueprint_helpers import check_if_blueprint_on_disk
from blenvy.core.scene_helpers import get_main_and_library_scenes
from blenvy.blueprints.blueprint_helpers import check_if_blueprint_on_disk
# IF collection_instances_combine_mode is not 'split' check for each scene if any object in changes_per_scene has an instance in the scene
def changed_object_in_scene(scene_name, changes_per_scene, blueprints_data, collection_instances_combine_mode):

View File

@ -1,7 +1,6 @@
import bpy
from .project_diff import get_changes_per_scene, project_diff, serialize_current
from ...settings import are_settings_identical
from .auto_export import auto_export
from .settings_diff import get_setting_changes

View File

@ -1,6 +1,6 @@
import bpy
from ...settings import are_settings_identical, load_settings, upsert_settings
from blenvy.settings import are_settings_identical, load_settings, upsert_settings
# which settings are specific to auto_export # TODO: can we infer this ?
auto_export_parameter_names = [

View File

@ -1,6 +1,6 @@
import bpy
from blenvy.core.helpers_collections import (set_active_collection)
from ..export.export_gltf import export_gltf
from ...core.helpers_collections import (set_active_collection)
"""
generates a temporary scene, fills it with data, cleans up after itself

View File

@ -1,6 +1,6 @@
import json
import bpy
from ...core.object_makers import (make_empty)
from blenvy.core.object_makers import (make_empty)
# these are mostly for when using this add-on together with the bevy_components add-on

View File

@ -1,6 +1,6 @@
import bpy
from ...core.object_makers import make_empty
from blenvy.core.object_makers import make_empty
# TODO: replace this with placing scene level custom properties once support for that has been added to bevy_gltf
def upsert_scene_components(main_scenes):

View File

@ -4,7 +4,7 @@ from bpy_types import (Operator)
from bpy.props import (StringProperty)
from bpy_extras.io_utils import ImportHelper
from ...settings import upsert_settings
from blenvy.settings import upsert_settings
from ..components.metadata import apply_customProperty_values_to_item_propertyGroups, apply_propertyGroup_values_to_item_customProperties, ensure_metadata_for_all_items
from ..propGroups.prop_groups import generate_propertyGroups_for_components

View File

@ -6,7 +6,7 @@ from pathlib import Path
from bpy_types import (PropertyGroup)
from bpy.props import (StringProperty, BoolProperty, FloatProperty, FloatVectorProperty, IntProperty, IntVectorProperty, EnumProperty, PointerProperty, CollectionProperty)
from ...settings import load_settings
from blenvy.settings import load_settings
from ..propGroups.prop_groups import generate_propertyGroups_for_components
from ..components.metadata import ComponentMetadata, ensure_metadata_for_all_items

View File

@ -4,7 +4,7 @@ from bpy_types import (PropertyGroup)
from bpy.props import (EnumProperty, PointerProperty, StringProperty, CollectionProperty, IntProperty)
from .scene_helpers import SceneSelector
from ..settings import upsert_settings, load_settings
import blenvy.auto_export.settings as auto_export_settings
import blenvy.add_ons.auto_export.settings as auto_export_settings
def update_scene_lists(self, context):
blenvy = self# context.window_manager.blenvy

View File

@ -1,7 +1,6 @@
import bpy
import blenvy.bevy_components.ui as components_ui
import blenvy.auto_export.ui as auto_export_ui
from blenvy.settings import load_settings
import blenvy.add_ons.bevy_components.ui as components_ui
import blenvy.add_ons.auto_export.ui as auto_export_ui
# from ...bevy_components.components import ui# as components_ui
######################################################