Implement custom splash screen, and updates for functions moving
This commit is contained in:
parent
d6fa3dd76b
commit
bab5a57099
@ -15,6 +15,8 @@
|
|||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
import bpy
|
import bpy
|
||||||
from .classes.ots import CustomTemplatesPreferences, TemplateItem, OT_ExportTemplates, OT_ImportTemplates, CUSTOM_MT_Export_Menu, OT_SelectTemplatePopup, OT_AddTemplatePopup, OT_AddTemplateItem, OT_RemoveTemplateItem, OT_MoveDownTemplateItem, OT_MoveUpTemplateItem, OT_OpenAddonPreferences
|
from .classes.ots import CustomTemplatesPreferences, TemplateItem, OT_ExportTemplates, OT_ImportTemplates, CUSTOM_MT_Export_Menu, OT_SelectTemplatePopup, OT_AddTemplatePopup, OT_AddTemplateItem, OT_RemoveTemplateItem, OT_MoveDownTemplateItem, OT_MoveUpTemplateItem, OT_OpenAddonPreferences
|
||||||
|
from .classes.draw import draw_file_new_templates, draw_file_default_operators
|
||||||
|
from .classes.splash import WM_MT_splash, CUSTOM_MT_splash_mode, OT_SplashCustom, OT_SplashDefault
|
||||||
|
|
||||||
bl_info = {
|
bl_info = {
|
||||||
"id": "custom_templates",
|
"id": "custom_templates",
|
||||||
@ -27,42 +29,14 @@ bl_info = {
|
|||||||
"blender_manifest": "blender_manifest.toml"
|
"blender_manifest": "blender_manifest.toml"
|
||||||
}
|
}
|
||||||
|
|
||||||
def draw_addon_separator(layout):
|
classes = [WM_MT_splash,
|
||||||
layout.separator()
|
TemplateItem,
|
||||||
layout.label(text="Custom Templates")
|
|
||||||
layout.separator()
|
|
||||||
|
|
||||||
def draw_file_new_templates(self, context):
|
|
||||||
layout = self.layout
|
|
||||||
prefs = context.preferences.addons[__package__].preferences
|
|
||||||
|
|
||||||
if len(prefs.projects) > 0:
|
|
||||||
draw_addon_separator(layout)
|
|
||||||
|
|
||||||
for project in prefs.projects:
|
|
||||||
layout.operator(
|
|
||||||
"wm.read_homefile", text=project.name).filepath = project.path
|
|
||||||
|
|
||||||
def draw_file_default_operators(self, context):
|
|
||||||
layout = self.layout
|
|
||||||
draw_addon_separator(layout)
|
|
||||||
# Manage Template
|
|
||||||
layout.operator("custom_templates.open_preferences",
|
|
||||||
text="Manage templates")
|
|
||||||
# Import/Export
|
|
||||||
layout.menu("custom_templates.export_menu", text="Import/Export")
|
|
||||||
layout.separator()
|
|
||||||
# Select new custom template
|
|
||||||
layout.operator("custom_templates.select_template_popup",
|
|
||||||
text="Select new custom template")
|
|
||||||
# Use current as new template (only with an active saved .blend file opened)
|
|
||||||
if bpy.data.filepath != "":
|
|
||||||
layout.operator("custom_templates.add_template_popup",
|
|
||||||
text="Use current as new template")
|
|
||||||
|
|
||||||
classes = [TemplateItem,
|
|
||||||
OT_ExportTemplates,
|
OT_ExportTemplates,
|
||||||
OT_ImportTemplates,
|
OT_ImportTemplates,
|
||||||
|
OT_SplashCustom,
|
||||||
|
OT_SplashDefault,
|
||||||
|
OT_OpenAddonPreferences,
|
||||||
|
CUSTOM_MT_splash_mode,
|
||||||
CUSTOM_MT_Export_Menu,
|
CUSTOM_MT_Export_Menu,
|
||||||
OT_MoveUpTemplateItem,
|
OT_MoveUpTemplateItem,
|
||||||
OT_MoveDownTemplateItem,
|
OT_MoveDownTemplateItem,
|
||||||
@ -70,14 +44,12 @@ classes = [TemplateItem,
|
|||||||
OT_RemoveTemplateItem,
|
OT_RemoveTemplateItem,
|
||||||
OT_AddTemplatePopup,
|
OT_AddTemplatePopup,
|
||||||
OT_SelectTemplatePopup,
|
OT_SelectTemplatePopup,
|
||||||
OT_OpenAddonPreferences,
|
|
||||||
CustomTemplatesPreferences]
|
CustomTemplatesPreferences]
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
for c in classes:
|
for c in classes:
|
||||||
bpy.utils.register_class(c)
|
bpy.utils.register_class(c)
|
||||||
bpy.types.TOPBAR_MT_file_new.remove(draw_file_new_templates)
|
bpy.types.TOPBAR_MT_file_new.remove(draw_file_new_templates)
|
||||||
bpy.types.TOPBAR_MT_file_new.remove(draw_file_default_operators)
|
|
||||||
bpy.types.TOPBAR_MT_file_new.append(draw_file_new_templates)
|
bpy.types.TOPBAR_MT_file_new.append(draw_file_new_templates)
|
||||||
bpy.types.TOPBAR_MT_file_defaults.append(draw_file_default_operators)
|
bpy.types.TOPBAR_MT_file_defaults.append(draw_file_default_operators)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user