79 lines
3.1 KiB
Python
79 lines
3.1 KiB
Python
# Custom Templates - 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.types import TOPBAR_MT_file_new, TOPBAR_MT_file_defaults, TOPBAR_MT_workspace_menu
|
|
from .src.funcs import draw_file_new_templates, draw_file_default_operators, draw_ws_menu_add
|
|
from .src.splash import WM_MT_splash
|
|
from .src.menus import CT_MT_splash_mode, CT_MT_templates_menu, CT_MT_workspace_add, CT_MT_more_templates
|
|
from .src.ops import CT_OT_export_templates, CT_OT_start_from, CT_OT_import_templates, CT_OT_select_template_popup, CT_OT_add_template_popup, CT_OT_add, CT_OT_remove, CT_OT_move_down, CT_OT_move_up, CT_OT_open_preferences, CT_OT_add_templates_from_folder, CT_OT_clear, CT_OT_template_workspaces, CT_OT_add_workspace
|
|
from .src.prefs import CustomTemplatesPreferences, TemplateItem
|
|
|
|
bl_info = {
|
|
"id": "custom_templates",
|
|
"name": "Custom Templates",
|
|
"tagline": "Add your own .blend files as template options for new projects",
|
|
"version": (1, 5, 0),
|
|
"blender": (2, 83, 0),
|
|
"location": "File > New, File > Defaults, Splash Screen",
|
|
"category": "System",
|
|
"support": "COMMUNITY",
|
|
"blender_manifest": "blender_manifest.toml"
|
|
}
|
|
|
|
classes = [WM_MT_splash,
|
|
CT_MT_workspace_add,
|
|
CT_MT_splash_mode,
|
|
CT_MT_templates_menu,
|
|
CT_MT_more_templates,
|
|
CT_OT_add_workspace,
|
|
CT_OT_start_from,
|
|
CT_OT_template_workspaces,
|
|
CT_OT_export_templates,
|
|
CT_OT_import_templates,
|
|
CT_OT_open_preferences,
|
|
CT_OT_move_up,
|
|
CT_OT_move_down,
|
|
CT_OT_add,
|
|
CT_OT_remove,
|
|
CT_OT_clear,
|
|
CT_OT_add_template_popup,
|
|
CT_OT_select_template_popup,
|
|
CT_OT_add_templates_from_folder,
|
|
TemplateItem,
|
|
CustomTemplatesPreferences]
|
|
|
|
og_splash = None
|
|
|
|
def register():
|
|
global og_splash
|
|
og_splash = bpy.types.WM_MT_splash
|
|
for c in classes:
|
|
bpy.utils.register_class(c)
|
|
TOPBAR_MT_file_new.append(draw_file_new_templates)
|
|
TOPBAR_MT_file_defaults.append(draw_file_default_operators)
|
|
TOPBAR_MT_workspace_menu.append(draw_ws_menu_add)
|
|
|
|
def unregister():
|
|
for c in reversed(classes):
|
|
bpy.utils.unregister_class(c)
|
|
bpy.utils.register_class(og_splash)
|
|
TOPBAR_MT_file_new.remove(draw_file_new_templates)
|
|
TOPBAR_MT_file_defaults.remove(draw_file_default_operators)
|
|
TOPBAR_MT_workspace_menu.remove(draw_ws_menu_add)
|
|
|
|
if __name__ == "__main__":
|
|
registers()
|