Minor refactor

This commit is contained in:
Francesco Bellini 2024-08-18 17:00:04 +02:00
parent bab5a57099
commit 2f0eaaef13
2 changed files with 8 additions and 10 deletions

View File

@ -12,7 +12,6 @@ def draw_file_new_templates(self, context):
if len(prefs.projects) > 0:
draw_addon_separator(layout)
draw_templates_on_col(layout, context)
def draw_templates_on_col(layout, context, splash_mode = False):
layout.operator_context = 'INVOKE_DEFAULT'
@ -23,7 +22,6 @@ def draw_templates_on_col(layout, context, splash_mode = False):
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
draw_addon_separator(layout)
@ -39,4 +37,5 @@ def draw_file_default_operators(self, context):
# 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")
text="Use current as new template")

View File

@ -1,13 +1,12 @@
# Ref WM_MT_splash https://projects.blender.org/blender/blender/src/commit/5a9fe638dedb179050c4929ea8fcdec80d221af2/scripts/startup/bl_operators/wm.py#L3296
# Ref TOPBAR_MT_file_new https://projects.blender.org/blender/blender/src/commit/5a9fe638dedb179050c4929ea8fcdec80d221af2/scripts/startup/bl_ui/space_topbar.py#L286
from .. import __package__ as base_package
from .draw import draw_templates_on_col
import bpy
# Ref WM_MT_splash https://projects.blender.org/blender/blender/src/commit/5a9fe638dedb179050c4929ea8fcdec80d221af2/scripts/startup/bl_operators/wm.py#L3296
# Ref TOPBAR_MT_file_new https://projects.blender.org/blender/blender/src/commit/5a9fe638dedb179050c4929ea8fcdec80d221af2/scripts/startup/bl_ui/space_topbar.py#L286
# This is a python clone of the WM_MT_splash (the section under the image of the Splash)
# It's edited (only in #Templates part) to add a menu in the New File section to switch between blender's original templates and Custom Templates.
# Without custom templates, the default templates are displayed
# Clone of the WM_MT_splash (the section under the image of the Splash)
# It's edited (only in #Templates part) to add a menu in the New File section
# to switch between blender's original templates and Custom Templates.
# If you have no custom templates, the default templates are displayed
class WM_MT_splash(bpy.types.Menu):
bl_label="Splash"