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-05-19 21:35:12 +00:00
|
|
|
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
|
2024-05-13 08:28:44 +00:00
|
|
|
|
|
|
|
from .bevy_components.registry.registry import ComponentsRegistry,MissingBevyType
|
2024-05-17 12:30:15 +00:00
|
|
|
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)
|
2024-05-13 08:28:44 +00:00
|
|
|
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)
|
|
|
|
|
|
|
|
# auto export
|
2024-05-14 21:49:45 +00:00
|
|
|
from .gltf_auto_export import gltf_post_export_callback
|
2024-05-13 08:28:44 +00:00
|
|
|
from .gltf_auto_export.auto_export.operators import AutoExportGLTF
|
|
|
|
from .gltf_auto_export.auto_export.tracker import AutoExportTracker
|
2024-05-17 12:30:15 +00:00
|
|
|
from .gltf_auto_export.settings import AutoExportSettings
|
|
|
|
|
2024-05-13 08:28:44 +00:00
|
|
|
# asset management
|
2024-05-15 11:25:30 +00:00
|
|
|
from .assets.ui import Blenvy_assets
|
2024-05-16 12:09:40 +00:00
|
|
|
from .assets.assets_registry import Asset, AssetsRegistry
|
2024-05-15 21:32:01 +00:00
|
|
|
from .assets.operators import OT_Add_asset_filebrowser, OT_add_bevy_asset, OT_remove_bevy_asset, OT_test_bevy_assets
|
2024-05-13 08:28:44 +00:00
|
|
|
|
|
|
|
# blueprints management
|
|
|
|
from .blueprints.ui import GLTF_PT_auto_export_blueprints_list
|
|
|
|
from .blueprints.blueprints_registry import BlueprintsRegistry
|
|
|
|
from .blueprints.operators import OT_select_blueprint
|
|
|
|
|
|
|
|
# blenvy core
|
|
|
|
from .core.blenvy_manager import BlenvyManager
|
|
|
|
from .core.operators import OT_switch_bevy_tooling
|
2024-05-16 13:27:30 +00:00
|
|
|
from .core.scene_helpers import (SceneSelector)
|
|
|
|
from .core.ui.ui import (BLENVY_PT_SidePanel)
|
|
|
|
from .core.ui.scenes_list import SCENES_LIST_OT_actions, SCENE_UL_Blenvy
|
2024-05-19 09:04:34 +00:00
|
|
|
from .core.ui.assets_folder_browser import OT_OpenAssetsFolderBrowser
|
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
|
|
|
|
SceneSelector,
|
|
|
|
SCENE_UL_Blenvy,
|
|
|
|
SCENES_LIST_OT_actions,
|
2024-05-17 12:30:15 +00:00
|
|
|
OT_OpenAssetsFolderBrowser,
|
2024-05-16 13:27:30 +00:00
|
|
|
|
2024-05-13 08:28:44 +00:00
|
|
|
# blenvy
|
|
|
|
BLENVY_PT_SidePanel,
|
|
|
|
|
|
|
|
# bevy components
|
|
|
|
AddComponentOperator,
|
|
|
|
CopyComponentOperator,
|
|
|
|
PasteComponentOperator,
|
|
|
|
RemoveComponentOperator,
|
2024-05-19 21:35:12 +00:00
|
|
|
RemoveComponentFromAllItemsOperator,
|
2024-05-13 08:28:44 +00:00
|
|
|
Fix_Component_Operator,
|
|
|
|
OT_rename_component,
|
|
|
|
RenameHelper,
|
|
|
|
GenerateComponent_From_custom_property_Operator,
|
|
|
|
Toggle_ComponentVisibility,
|
|
|
|
|
|
|
|
ComponentDefinitionsList,
|
|
|
|
ClearComponentDefinitionsList,
|
|
|
|
|
|
|
|
ComponentMetadata,
|
|
|
|
ComponentsMeta,
|
|
|
|
MissingBevyType,
|
|
|
|
ComponentsRegistry,
|
|
|
|
|
2024-05-17 12:30:15 +00:00
|
|
|
OT_OpenSchemaFileBrowser,
|
2024-05-13 08:28:44 +00:00
|
|
|
ReloadRegistryOperator,
|
|
|
|
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_object,
|
|
|
|
OT_select_component_name_to_replace,
|
|
|
|
|
|
|
|
BEVY_COMPONENTS_PT_ComponentsPanel,
|
|
|
|
BEVY_COMPONENTS_PT_AdvancedToolsPanel,
|
2024-05-17 12:30:15 +00:00
|
|
|
#BEVY_COMPONENTS_PT_Configuration,
|
2024-05-13 08:28:44 +00:00
|
|
|
MISSING_TYPES_UL_List,
|
|
|
|
BEVY_COMPONENTS_PT_MissingTypesPanel,
|
|
|
|
|
|
|
|
Generic_LIST_OT_SelectItem,
|
|
|
|
Generic_LIST_OT_AddItem,
|
|
|
|
Generic_LIST_OT_RemoveItem,
|
|
|
|
GENERIC_LIST_OT_actions,
|
|
|
|
|
|
|
|
GENERIC_MAP_OT_actions,
|
|
|
|
|
|
|
|
# gltf auto export
|
|
|
|
AutoExportGLTF,
|
|
|
|
AutoExportTracker,
|
2024-05-17 12:30:15 +00:00
|
|
|
AutoExportSettings,
|
2024-05-13 08:28:44 +00:00
|
|
|
|
|
|
|
# blenvy
|
|
|
|
BlenvyManager,
|
|
|
|
OT_switch_bevy_tooling,
|
|
|
|
|
2024-05-16 12:09:40 +00:00
|
|
|
Asset,
|
2024-05-13 08:28:44 +00:00
|
|
|
AssetsRegistry,
|
|
|
|
OT_add_bevy_asset,
|
|
|
|
OT_remove_bevy_asset,
|
2024-05-15 21:32:01 +00:00
|
|
|
OT_test_bevy_assets,
|
2024-05-13 21:36:13 +00:00
|
|
|
OT_Add_asset_filebrowser,
|
2024-05-15 11:25:30 +00:00
|
|
|
Blenvy_assets,
|
2024-05-13 08:28:44 +00:00
|
|
|
|
|
|
|
BlueprintsRegistry,
|
|
|
|
OT_select_blueprint,
|
|
|
|
GLTF_PT_auto_export_blueprints_list,
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
@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):
|
|
|
|
registry = bpy.context.window_manager.components_registry
|
2024-05-17 12:30:15 +00:00
|
|
|
if registry is not None:
|
2024-05-13 08:28:44 +00:00
|
|
|
registry.load_settings()
|
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)
|
|
|
|
|
|
|
|
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)
|