73 lines
2.3 KiB
Python
73 lines
2.3 KiB
Python
# Scene Workspaces - Blender Add-On
|
|
# Copyright (C) 2024 Francesco Bellini
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
import bpy
|
|
from bpy.app.handlers import persistent
|
|
from .classes.funcs import init_data, draw_workspace_menu
|
|
from .classes.ops import WBS_OT_workspace, WBS_OT_sel_workspace, WBS_OT_move, WBS_OT_sel_all, WBS_OT_remove, WBS_OT_switch, WBS_OT_rename
|
|
from .classes.topbar import TOPBAR_HT_upper_bar
|
|
from .classes.panel import WBS_PT_select_scene_workspaces
|
|
from .classes.menu import WBS_MT_missing_workspaces
|
|
from .classes.prefs import WBSPreferences
|
|
|
|
bl_info = {
|
|
"id": "scene_workspaces",
|
|
"name": "Scene Workspaces",
|
|
"tagline": "Filter and reorder workspaces independently for each scene",
|
|
"blender": (4, 2, 0),
|
|
"location": "Workspaces",
|
|
"category": ["System", "User Interface", "Scene"],
|
|
"support": "COMMUNITY",
|
|
"blender_manifest": "blender_manifest.toml"
|
|
}
|
|
|
|
@persistent
|
|
def load_handler(dummy):
|
|
init_data()
|
|
|
|
classes = [
|
|
WBS_OT_workspace,
|
|
WBS_OT_switch,
|
|
WBS_OT_move,
|
|
WBS_OT_remove,
|
|
WBS_OT_sel_all,
|
|
WBS_OT_sel_workspace,
|
|
WBS_OT_rename,
|
|
WBS_MT_missing_workspaces,
|
|
WBS_PT_select_scene_workspaces,
|
|
WBSPreferences,
|
|
TOPBAR_HT_upper_bar
|
|
]
|
|
|
|
og_header = None;
|
|
|
|
def register():
|
|
global og_header
|
|
og_header = bpy.types.TOPBAR_HT_upper_bar;
|
|
for c in classes:
|
|
bpy.utils.register_class(c)
|
|
bpy.app.handlers.load_post.append(load_handler)
|
|
bpy.types.TOPBAR_MT_workspace_menu.append(draw_workspace_menu)
|
|
|
|
def unregister():
|
|
for c in reversed(classes):
|
|
bpy.utils.unregister_class(c)
|
|
bpy.utils.register_class(og_header)
|
|
bpy.app.handlers.load_post.remove(load_handler)
|
|
bpy.types.TOPBAR_MT_workspace_menu.remove(draw_workspace_menu)
|
|
|
|
if __name__ == "__main__":
|
|
register()
|