2024-05-13 08:28:44 +00:00
|
|
|
bl_info = {
|
|
|
|
"name": "blenvy",
|
|
|
|
"author": "kaosigh",
|
|
|
|
"version": (0, 1, 0),
|
|
|
|
"blender": (3, 4, 0),
|
|
|
|
"location": "File > Import-Export",
|
|
|
|
"description": "tooling for the Bevy engine",
|
|
|
|
"warning": "",
|
|
|
|
"wiki_url": "https://github.com/kaosat-dev/Blender_bevy_components_workflow",
|
|
|
|
"tracker_url": "https://github.com/kaosat-dev/Blender_bevy_components_workflow/issues/new",
|
|
|
|
"category": "Import-Export"
|
|
|
|
}
|
|
|
|
|
|
|
|
import bpy
|
|
|
|
from bpy.app.handlers import persistent
|
|
|
|
from bpy.props import (StringProperty)
|
|
|
|
|
2024-05-17 12:30:15 +00:00
|
|
|
|
2024-05-13 08:28:44 +00:00
|
|
|
# components management
|
2024-06-12 17:33:12 +00:00
|
|
|
from .add_ons.bevy_components.components.operators import BLENVY_OT_component_copy, BLENVY_OT_component_fix, BLENVY_OT_component_rename_component, BLENVY_OT_component_remove_from_all_items, BLENVY_OT_component_remove, BLENVY_OT_component_from_custom_property, BLENVY_OT_component_paste, BLENVY_OT_component_add, RenameHelper, BLENVY_OT_component_toggle_visibility, BLENVY_OT_components_refresh_custom_properties_all, BLENVY_OT_components_refresh_custom_properties_current, BLENVY_OT_components_refresh_propgroups_all, BLENVY_OT_components_refresh_propgroups_current
|
2024-05-25 11:26:30 +00:00
|
|
|
from .add_ons.bevy_components.registry.registry import ComponentsRegistry,MissingBevyType
|
2024-06-12 17:33:12 +00:00
|
|
|
from .add_ons.bevy_components.registry.operators import (BLENVY_OT_components_registry_reload, BLENVY_OT_components_registry_browse_schema)
|
2024-06-12 10:41:50 +00:00
|
|
|
from .add_ons.bevy_components.registry.ui import (BLENVY_PT_components_missing_types_panel, BLENVY_UL_components_missing_types)
|
2024-05-25 11:26:30 +00:00
|
|
|
from .add_ons.bevy_components.components.metadata import (ComponentMetadata, ComponentsMeta)
|
2024-06-13 14:11:06 +00:00
|
|
|
from .add_ons.bevy_components.components.lists import BLENVY_OT_component_list_actions
|
2024-06-12 10:41:50 +00:00
|
|
|
from .add_ons.bevy_components.components.maps import BLENVY_OT_component_map_actions
|
|
|
|
from .add_ons.bevy_components.components.ui import BLENVY_PT_components_panel, BLENVY_PT_component_tools_panel
|
2024-05-26 16:33:06 +00:00
|
|
|
from .add_ons.bevy_components.settings import ComponentsSettings
|
2024-06-12 17:33:12 +00:00
|
|
|
from .add_ons.bevy_components.utils import BLENVY_OT_item_select
|
2024-05-13 08:28:44 +00:00
|
|
|
|
|
|
|
# auto export
|
2024-05-25 11:26:30 +00:00
|
|
|
from .add_ons.auto_export import gltf_post_export_callback
|
2024-05-29 21:34:47 +00:00
|
|
|
from .add_ons.auto_export.common.tracker import AutoExportTracker
|
2024-05-25 11:26:30 +00:00
|
|
|
from .add_ons.auto_export.settings import AutoExportSettings
|
2024-05-17 12:30:15 +00:00
|
|
|
|
2024-05-13 08:28:44 +00:00
|
|
|
# asset management
|
2024-06-12 10:41:50 +00:00
|
|
|
from .assets.ui import BLENVY_PT_assets_panel
|
2024-05-16 12:09:40 +00:00
|
|
|
from .assets.assets_registry import Asset, AssetsRegistry
|
2024-06-12 10:41:50 +00:00
|
|
|
from .assets.operators import BLENVY_OT_assets_browse, BLENVY_OT_assets_add, BLENVY_OT_assets_remove, BLENVY_OT_assets_generate_files
|
2024-05-13 08:28:44 +00:00
|
|
|
|
2024-06-04 21:16:16 +00:00
|
|
|
# levels management
|
2024-06-12 10:41:50 +00:00
|
|
|
from .levels.ui import BLENVY_PT_levels_panel
|
|
|
|
from .levels.operators import BLENVY_OT_level_select
|
2024-06-04 21:16:16 +00:00
|
|
|
|
2024-05-13 08:28:44 +00:00
|
|
|
# blueprints management
|
2024-06-12 10:41:50 +00:00
|
|
|
from .blueprints.ui import BLENVY_PT_blueprints_panel
|
2024-05-13 08:28:44 +00:00
|
|
|
from .blueprints.blueprints_registry import BlueprintsRegistry
|
2024-06-12 10:41:50 +00:00
|
|
|
from .blueprints.operators import BLENVY_OT_blueprint_select
|
2024-05-13 08:28:44 +00:00
|
|
|
|
|
|
|
# blenvy core
|
|
|
|
from .core.blenvy_manager import BlenvyManager
|
2024-07-19 12:13:48 +00:00
|
|
|
from .core.operators import BLENVY_OT_configuration_switch, BLENVY_OT_tooling_switch
|
2024-05-16 13:27:30 +00:00
|
|
|
from .core.ui.ui import (BLENVY_PT_SidePanel)
|
2024-06-12 10:41:50 +00:00
|
|
|
from .core.ui.scenes_list import BLENVY_OT_scenes_list_actions
|
|
|
|
from .assets.assets_folder_browser import BLENVY_OT_assets_paths_browse
|
2024-05-13 08:28:44 +00:00
|
|
|
|
2024-05-14 21:49:45 +00:00
|
|
|
|
|
|
|
# this needs to be here, as it is how Blender's gltf exporter callbacks are defined, at the add-on root level
|
|
|
|
def glTF2_post_export_callback(data):
|
|
|
|
gltf_post_export_callback(data)
|
|
|
|
|
|
|
|
|
2024-05-13 08:28:44 +00:00
|
|
|
classes = [
|
2024-05-16 13:27:30 +00:00
|
|
|
# common/core
|
2024-06-12 10:41:50 +00:00
|
|
|
BLENVY_OT_scenes_list_actions,
|
|
|
|
BLENVY_OT_assets_paths_browse,
|
2024-05-16 13:27:30 +00:00
|
|
|
|
2024-05-13 08:28:44 +00:00
|
|
|
# blenvy
|
|
|
|
BLENVY_PT_SidePanel,
|
|
|
|
|
|
|
|
# bevy components
|
2024-05-26 16:33:06 +00:00
|
|
|
ComponentsSettings,
|
2024-06-12 10:41:50 +00:00
|
|
|
BLENVY_OT_component_add,
|
|
|
|
BLENVY_OT_component_copy,
|
|
|
|
BLENVY_OT_component_paste,
|
|
|
|
BLENVY_OT_component_remove,
|
|
|
|
BLENVY_OT_component_remove_from_all_items,
|
|
|
|
BLENVY_OT_component_fix,
|
|
|
|
BLENVY_OT_component_rename_component,
|
2024-05-13 08:28:44 +00:00
|
|
|
RenameHelper,
|
2024-06-12 10:41:50 +00:00
|
|
|
BLENVY_OT_component_from_custom_property,
|
|
|
|
BLENVY_OT_component_toggle_visibility,
|
2024-05-13 08:28:44 +00:00
|
|
|
|
|
|
|
ComponentMetadata,
|
|
|
|
ComponentsMeta,
|
|
|
|
MissingBevyType,
|
|
|
|
ComponentsRegistry,
|
|
|
|
|
2024-06-12 10:41:50 +00:00
|
|
|
BLENVY_OT_components_registry_browse_schema,
|
|
|
|
BLENVY_OT_components_registry_reload,
|
|
|
|
BLENVY_OT_components_refresh_custom_properties_all,
|
|
|
|
BLENVY_OT_components_refresh_custom_properties_current,
|
|
|
|
BLENVY_OT_components_refresh_propgroups_all,
|
|
|
|
BLENVY_OT_components_refresh_propgroups_current,
|
2024-05-13 08:28:44 +00:00
|
|
|
|
2024-06-12 17:33:12 +00:00
|
|
|
BLENVY_OT_item_select,
|
2024-05-13 08:28:44 +00:00
|
|
|
|
2024-06-12 10:41:50 +00:00
|
|
|
BLENVY_PT_components_panel,
|
|
|
|
BLENVY_PT_component_tools_panel,
|
|
|
|
BLENVY_UL_components_missing_types,
|
|
|
|
BLENVY_PT_components_missing_types_panel,
|
2024-05-13 08:28:44 +00:00
|
|
|
|
2024-06-12 10:41:50 +00:00
|
|
|
BLENVY_OT_component_list_actions,
|
|
|
|
BLENVY_OT_component_map_actions,
|
2024-05-26 16:33:06 +00:00
|
|
|
|
2024-05-13 08:28:44 +00:00
|
|
|
# gltf auto export
|
|
|
|
AutoExportTracker,
|
2024-05-17 12:30:15 +00:00
|
|
|
AutoExportSettings,
|
2024-05-13 08:28:44 +00:00
|
|
|
|
|
|
|
# blenvy
|
|
|
|
BlenvyManager,
|
2024-06-12 10:41:50 +00:00
|
|
|
BLENVY_OT_tooling_switch,
|
2024-07-19 12:13:48 +00:00
|
|
|
BLENVY_OT_configuration_switch,
|
2024-05-13 08:28:44 +00:00
|
|
|
|
2024-05-16 12:09:40 +00:00
|
|
|
Asset,
|
2024-05-13 08:28:44 +00:00
|
|
|
AssetsRegistry,
|
2024-06-12 10:41:50 +00:00
|
|
|
BLENVY_OT_assets_add,
|
|
|
|
BLENVY_OT_assets_remove,
|
|
|
|
BLENVY_OT_assets_generate_files,
|
|
|
|
BLENVY_OT_assets_browse,
|
|
|
|
BLENVY_PT_assets_panel,
|
2024-05-13 08:28:44 +00:00
|
|
|
|
2024-06-12 10:41:50 +00:00
|
|
|
BLENVY_PT_levels_panel,
|
|
|
|
BLENVY_OT_level_select,
|
2024-06-04 21:16:16 +00:00
|
|
|
|
2024-05-13 08:28:44 +00:00
|
|
|
BlueprintsRegistry,
|
2024-06-12 10:41:50 +00:00
|
|
|
BLENVY_OT_blueprint_select,
|
|
|
|
BLENVY_PT_blueprints_panel,
|
2024-05-13 08:28:44 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
@persistent
|
|
|
|
def post_update(scene, depsgraph):
|
|
|
|
bpy.context.window_manager.auto_export_tracker.deps_post_update_handler( scene, depsgraph)
|
|
|
|
|
|
|
|
@persistent
|
|
|
|
def post_save(scene, depsgraph):
|
|
|
|
bpy.context.window_manager.auto_export_tracker.save_handler( scene, depsgraph)
|
|
|
|
|
|
|
|
@persistent
|
|
|
|
def post_load(file_name):
|
2024-05-25 08:46:14 +00:00
|
|
|
print("POST LOAD")
|
2024-05-17 12:30:15 +00:00
|
|
|
blenvy = bpy.context.window_manager.blenvy
|
|
|
|
if blenvy is not None:
|
|
|
|
blenvy.load_settings()
|
2024-05-13 08:28:44 +00:00
|
|
|
|
|
|
|
def register():
|
|
|
|
for cls in classes:
|
|
|
|
bpy.utils.register_class(cls)
|
|
|
|
|
|
|
|
bpy.app.handlers.load_post.append(post_load)
|
|
|
|
# for some reason, adding these directly to the tracker class in register() do not work reliably
|
|
|
|
bpy.app.handlers.depsgraph_update_post.append(post_update)
|
|
|
|
bpy.app.handlers.save_post.append(post_save)
|
|
|
|
|
2024-07-14 23:37:13 +00:00
|
|
|
|
|
|
|
""" handle = object()
|
|
|
|
|
|
|
|
subscribe_to = bpy.types.Scene, "name" #
|
|
|
|
|
|
|
|
def notify_test(context):
|
|
|
|
#if (context.scene.type == 'MESH'):
|
|
|
|
print("Renamed", dir(context), context.scenes)
|
|
|
|
|
|
|
|
bpy.msgbus.subscribe_rna(
|
|
|
|
key=subscribe_to,
|
|
|
|
owner=bpy,
|
|
|
|
args=(bpy.context,),
|
|
|
|
notify=notify_test,
|
|
|
|
)"""
|
|
|
|
|
|
|
|
|
|
|
|
#bpy.msgbus.publish_rna(key=subscribe_to)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-13 08:28:44 +00:00
|
|
|
def unregister():
|
|
|
|
for cls in classes:
|
|
|
|
bpy.utils.unregister_class(cls)
|
|
|
|
bpy.app.handlers.load_post.remove(post_load)
|
|
|
|
bpy.app.handlers.depsgraph_update_post.remove(post_update)
|
|
|
|
bpy.app.handlers.save_post.remove(post_save)
|