35 lines
1.4 KiB
Python

from .. import __package__ as base_package
import bpy
def draw_file_new_templates(self, context):
layout = self.layout
prefs = context.preferences.addons[base_package].preferences
if len(prefs.projects) > 0:
layout.separator()
draw_templates_on_col(layout, context)
def draw_templates_on_col(layout, context, splash_mode = False):
prefs = context.preferences.addons[base_package].preferences
for i in range(min(5, len(prefs.projects)) if splash_mode else len(prefs.projects)):
project = prefs.projects[i]
layout.operator(
"wm.read_homefile", text=project.name, icon="FILE_NEW" if splash_mode else "NONE").filepath = project.path
def draw_file_default_operators(self, context):
layout = self.layout
layout.separator()
# 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")