Minor refactor
This commit is contained in:
parent
bab5a57099
commit
2f0eaaef13
@ -13,7 +13,6 @@ def draw_file_new_templates(self, context):
|
|||||||
draw_addon_separator(layout)
|
draw_addon_separator(layout)
|
||||||
draw_templates_on_col(layout, context)
|
draw_templates_on_col(layout, context)
|
||||||
|
|
||||||
|
|
||||||
def draw_templates_on_col(layout, context, splash_mode = False):
|
def draw_templates_on_col(layout, context, splash_mode = False):
|
||||||
layout.operator_context = 'INVOKE_DEFAULT'
|
layout.operator_context = 'INVOKE_DEFAULT'
|
||||||
|
|
||||||
@ -23,7 +22,6 @@ def draw_templates_on_col(layout, context, splash_mode = False):
|
|||||||
layout.operator(
|
layout.operator(
|
||||||
"wm.read_homefile", text=project.name, icon="FILE_NEW" if splash_mode else "NONE").filepath = project.path
|
"wm.read_homefile", text=project.name, icon="FILE_NEW" if splash_mode else "NONE").filepath = project.path
|
||||||
|
|
||||||
|
|
||||||
def draw_file_default_operators(self, context):
|
def draw_file_default_operators(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
draw_addon_separator(layout)
|
draw_addon_separator(layout)
|
||||||
@ -40,3 +38,4 @@ def draw_file_default_operators(self, context):
|
|||||||
if bpy.data.filepath != "":
|
if bpy.data.filepath != "":
|
||||||
layout.operator("custom_templates.add_template_popup",
|
layout.operator("custom_templates.add_template_popup",
|
||||||
text="Use current as new template")
|
text="Use current as new template")
|
||||||
|
|
@ -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 .. import __package__ as base_package
|
||||||
from .draw import draw_templates_on_col
|
from .draw import draw_templates_on_col
|
||||||
import bpy
|
import bpy
|
||||||
|
# Clone of the WM_MT_splash (the section under the image of the Splash)
|
||||||
# Ref WM_MT_splash https://projects.blender.org/blender/blender/src/commit/5a9fe638dedb179050c4929ea8fcdec80d221af2/scripts/startup/bl_operators/wm.py#L3296
|
# It's edited (only in #Templates part) to add a menu in the New File section
|
||||||
# Ref TOPBAR_MT_file_new https://projects.blender.org/blender/blender/src/commit/5a9fe638dedb179050c4929ea8fcdec80d221af2/scripts/startup/bl_ui/space_topbar.py#L286
|
# to switch between blender's original templates and Custom Templates.
|
||||||
|
# If you have no custom templates, the default templates are displayed
|
||||||
# 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
|
|
||||||
class WM_MT_splash(bpy.types.Menu):
|
class WM_MT_splash(bpy.types.Menu):
|
||||||
bl_label="Splash"
|
bl_label="Splash"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user