Naming refactor
This commit is contained in:
parent
98aa91d3e5
commit
727b535cba
@ -14,9 +14,9 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# 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.draw import draw_file_new_templates, draw_file_default_operators
|
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
|
from .classes.splash import WM_MT_splash, CT_MT_splash_mode, CT_OT_splash_custom, CT_OT_splash_default
|
||||||
|
from .classes.ots import CustomTemplatesPreferences, TemplateItem, CT_OT_export_templates, CT_OT_import_templates, CT_MT_export, 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
|
||||||
|
|
||||||
bl_info = {
|
bl_info = {
|
||||||
"id": "custom_templates",
|
"id": "custom_templates",
|
||||||
@ -31,26 +31,26 @@ bl_info = {
|
|||||||
|
|
||||||
classes = [WM_MT_splash,
|
classes = [WM_MT_splash,
|
||||||
TemplateItem,
|
TemplateItem,
|
||||||
OT_ExportTemplates,
|
CT_OT_export_templates,
|
||||||
OT_ImportTemplates,
|
CT_OT_import_templates,
|
||||||
OT_SplashCustom,
|
CT_OT_splash_custom,
|
||||||
OT_SplashDefault,
|
CT_OT_splash_default,
|
||||||
OT_OpenAddonPreferences,
|
CT_OT_open_preferences,
|
||||||
CUSTOM_MT_splash_mode,
|
CT_MT_splash_mode,
|
||||||
CUSTOM_MT_Export_Menu,
|
CT_MT_export,
|
||||||
OT_MoveUpTemplateItem,
|
CT_OT_move_up,
|
||||||
OT_MoveDownTemplateItem,
|
CT_OT_move_down,
|
||||||
OT_AddTemplateItem,
|
CT_OT_add,
|
||||||
OT_RemoveTemplateItem,
|
CT_OT_remove,
|
||||||
OT_AddTemplatePopup,
|
CT_OT_add_template_popup,
|
||||||
OT_SelectTemplatePopup,
|
CT_OT_select_template_popup,
|
||||||
CustomTemplatesPreferences]
|
CustomTemplatesPreferences]
|
||||||
|
|
||||||
original_splash = None;
|
og_splash = None;
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
global original_splash
|
global og_splash
|
||||||
original_splash = bpy.types.WM_MT_splash;
|
og_splash = bpy.types.WM_MT_splash;
|
||||||
for c in classes:
|
for c in classes:
|
||||||
bpy.utils.register_class(c)
|
bpy.utils.register_class(c)
|
||||||
bpy.types.TOPBAR_MT_file_new.append(draw_file_new_templates)
|
bpy.types.TOPBAR_MT_file_new.append(draw_file_new_templates)
|
||||||
@ -59,7 +59,7 @@ def register():
|
|||||||
def unregister():
|
def unregister():
|
||||||
for c in reversed(classes):
|
for c in reversed(classes):
|
||||||
bpy.utils.unregister_class(c)
|
bpy.utils.unregister_class(c)
|
||||||
bpy.utils.register_class(original_splash)
|
bpy.utils.register_class(og_splash)
|
||||||
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_defaults.remove(draw_file_default_operators)
|
bpy.types.TOPBAR_MT_file_defaults.remove(draw_file_default_operators)
|
||||||
|
|
||||||
|
@ -7,9 +7,9 @@ def draw_file_new_templates(self, context):
|
|||||||
prefs = context.preferences.addons[base_package].preferences
|
prefs = context.preferences.addons[base_package].preferences
|
||||||
if len(prefs.projects) > 0:
|
if len(prefs.projects) > 0:
|
||||||
layout.separator()
|
layout.separator()
|
||||||
draw_templates_on_col(layout, context)
|
draw_templates(layout, context)
|
||||||
|
|
||||||
def draw_templates_on_col(layout, context, splash_mode = False):
|
def draw_templates(layout, context, splash_mode = False):
|
||||||
prefs = context.preferences.addons[base_package].preferences
|
prefs = context.preferences.addons[base_package].preferences
|
||||||
for i in range(min(5, len(prefs.projects)) if splash_mode else len(prefs.projects)):
|
for i in range(min(5, len(prefs.projects)) if splash_mode else len(prefs.projects)):
|
||||||
project = prefs.projects[i]
|
project = prefs.projects[i]
|
||||||
@ -19,17 +19,14 @@ def draw_templates_on_col(layout, context, splash_mode = False):
|
|||||||
def draw_file_default_operators(self, context):
|
def draw_file_default_operators(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
layout.separator()
|
layout.separator()
|
||||||
# Manage Template
|
layout.operator("ct.open_preferences",
|
||||||
layout.operator("custom_templates.open_preferences",
|
|
||||||
text="Manage templates")
|
text="Manage templates")
|
||||||
# Import/Export
|
layout.menu("CT_MT_export", text="Import/Export")
|
||||||
layout.menu("custom_templates.export_menu", text="Import/Export")
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
# Select new custom template
|
layout.operator("ct.select_template_popup",
|
||||||
layout.operator("custom_templates.select_template_popup",
|
|
||||||
text="Select new custom template")
|
text="Select new custom template")
|
||||||
# Use current as new template (only with an active saved .blend file opened)
|
|
||||||
if bpy.data.filepath != "":
|
if bpy.data.filepath != "":
|
||||||
layout.operator("custom_templates.add_template_popup",
|
# Only with an active saved .blend file
|
||||||
|
layout.operator("ct.add_template_popup",
|
||||||
text="Use current as new template")
|
text="Use current as new template")
|
||||||
|
|
@ -1,4 +1,5 @@
|
|||||||
from .. import __package__ as base_package
|
from .. import __package__ as base_package
|
||||||
|
import os
|
||||||
import bpy
|
import bpy
|
||||||
import json
|
import json
|
||||||
from bpy.types import Operator, PropertyGroup, AddonPreferences
|
from bpy.types import Operator, PropertyGroup, AddonPreferences
|
||||||
@ -28,14 +29,14 @@ class CustomTemplatesPreferences(AddonPreferences):
|
|||||||
self, "projects", self, "active_template_index")
|
self, "projects", self, "active_template_index")
|
||||||
|
|
||||||
col = row.column(align=True)
|
col = row.column(align=True)
|
||||||
col.menu("custom_templates.export_menu", icon='DOWNARROW_HLT', text="")
|
col.menu("CT_MT_export", icon='DOWNARROW_HLT', text="")
|
||||||
col.separator()
|
col.separator()
|
||||||
col.operator("custom_templates.add", icon='ADD', text="")
|
col.operator("ct.add", icon='ADD', text="")
|
||||||
if self.projects:
|
if self.projects:
|
||||||
col.operator("custom_templates.remove", icon='REMOVE', text="")
|
col.operator("ct.remove", icon='REMOVE', text="")
|
||||||
col.separator()
|
col.separator()
|
||||||
col.operator("custom_templates.move_up", icon='TRIA_UP', text="")
|
col.operator("ct.move_up", icon='TRIA_UP', text="")
|
||||||
col.operator("custom_templates.move_down", icon='TRIA_DOWN', text="")
|
col.operator("ct.move_down", icon='TRIA_DOWN', text="")
|
||||||
|
|
||||||
if self.projects:
|
if self.projects:
|
||||||
project = self.projects[self.active_template_index]
|
project = self.projects[self.active_template_index]
|
||||||
@ -55,22 +56,21 @@ class CustomTemplatesPreferences(AddonPreferences):
|
|||||||
if len(self.projects) > 5:
|
if len(self.projects) > 5:
|
||||||
box.label(text="Note: Only the first 5 templates in the list will be shown in the splash screen.")
|
box.label(text="Note: Only the first 5 templates in the list will be shown in the splash screen.")
|
||||||
|
|
||||||
class CUSTOM_MT_Export_Menu(bpy.types.Menu):
|
class CT_MT_export(bpy.types.Menu):
|
||||||
bl_idname = "custom_templates.export_menu"
|
|
||||||
bl_label = "Import/Export custom templates"
|
bl_label = "Import/Export custom templates"
|
||||||
bl_description = "Allows you to save al load your custom templates (using json format)"
|
bl_description = "Allows you to save al load your custom templates (using json format)"
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
layout.operator("custom_templates.export_templates", text="Export templates")
|
layout.operator("ct.export_templates", text="Export templates")
|
||||||
layout.operator("custom_templates.import_templates", text="Import templates")
|
layout.operator("ct.import_templates", text="Import templates")
|
||||||
|
|
||||||
class OT_ExportTemplates(bpy.types.Operator):
|
class CT_OT_export_templates(bpy.types.Operator):
|
||||||
bl_idname = "custom_templates.export_templates"
|
bl_idname = "ct.export_templates"
|
||||||
bl_label = "Export custom templates"
|
bl_label = "Export custom templates"
|
||||||
bl_description = "Export the current list of templates to JSON file"
|
bl_description = "Export the current list of templates to JSON file"
|
||||||
|
|
||||||
filepath: StringProperty(subtype="FILE_PATH", description="Select the path for the exported file", default="custom_templates.json")
|
filepath: StringProperty(subtype="FILE_PATH", description="Select the path for the exported file", default="templates.json")
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
prefs = context.preferences.addons[base_package].preferences
|
prefs = context.preferences.addons[base_package].preferences
|
||||||
@ -85,8 +85,8 @@ class OT_ExportTemplates(bpy.types.Operator):
|
|||||||
context.window_manager.fileselect_add(self)
|
context.window_manager.fileselect_add(self)
|
||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
|
||||||
class OT_ImportTemplates(bpy.types.Operator):
|
class CT_OT_import_templates(bpy.types.Operator):
|
||||||
bl_idname = "custom_templates.import_templates"
|
bl_idname = "ct.import_templates"
|
||||||
bl_label = "Import custom templates"
|
bl_label = "Import custom templates"
|
||||||
bl_description = "Import a list of templates from JSON file (note that this will override the current templates list)"
|
bl_description = "Import a list of templates from JSON file (note that this will override the current templates list)"
|
||||||
|
|
||||||
@ -95,6 +95,7 @@ class OT_ImportTemplates(bpy.types.Operator):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
prefs = context.preferences.addons[base_package].preferences
|
prefs = context.preferences.addons[base_package].preferences
|
||||||
|
|
||||||
|
if os.path.exists(self.filepath):
|
||||||
with open(self.filepath, 'r') as f:
|
with open(self.filepath, 'r') as f:
|
||||||
projects = json.load(f)
|
projects = json.load(f)
|
||||||
|
|
||||||
@ -106,6 +107,8 @@ class OT_ImportTemplates(bpy.types.Operator):
|
|||||||
prefs.active_template_index = 0
|
prefs.active_template_index = 0
|
||||||
|
|
||||||
self.report({'INFO'}, f"Projects imported from {self.filepath}")
|
self.report({'INFO'}, f"Projects imported from {self.filepath}")
|
||||||
|
else:
|
||||||
|
self.report({'WARNING'}, f"Import cancelled: path not found ({self.filepath})")
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
@ -113,8 +116,8 @@ class OT_ImportTemplates(bpy.types.Operator):
|
|||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
|
||||||
# Templates list oeprators
|
# Templates list oeprators
|
||||||
class OT_AddTemplateItem(Operator):
|
class CT_OT_add(Operator):
|
||||||
bl_idname = "custom_templates.add"
|
bl_idname = "ct.add"
|
||||||
bl_label = "Add Template"
|
bl_label = "Add Template"
|
||||||
bl_description = "Add new template"
|
bl_description = "Add new template"
|
||||||
|
|
||||||
@ -122,25 +125,22 @@ class OT_AddTemplateItem(Operator):
|
|||||||
prefs = context.preferences.addons[base_package].preferences
|
prefs = context.preferences.addons[base_package].preferences
|
||||||
prefs.projects.add()
|
prefs.projects.add()
|
||||||
prefs.active_template_index = len(prefs.projects) - 1
|
prefs.active_template_index = len(prefs.projects) - 1
|
||||||
self.report({'INFO'}, f"Empty template added")
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
class OT_RemoveTemplateItem(Operator):
|
class CT_OT_remove(Operator):
|
||||||
bl_idname = "custom_templates.remove"
|
bl_idname = "ct.remove"
|
||||||
bl_label = "Remove Template"
|
bl_label = "Remove Template"
|
||||||
bl_description = "Remove selected template"
|
bl_description = "Remove selected template"
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
prefs = context.preferences.addons[base_package].preferences
|
prefs = context.preferences.addons[base_package].preferences
|
||||||
self.report(
|
|
||||||
{'INFO'}, f'Template "{prefs.projects[prefs.active_template_index].name}" removed{" (`"+prefs.projects[prefs.active_template_index].path+"`)" if prefs.projects[prefs.active_template_index].path != "" else "" }')
|
|
||||||
prefs.projects.remove(prefs.active_template_index)
|
prefs.projects.remove(prefs.active_template_index)
|
||||||
prefs.active_template_index = min(
|
prefs.active_template_index = min(
|
||||||
max(0, prefs.active_template_index - 1), len(prefs.projects) - 1)
|
max(0, prefs.active_template_index - 1), len(prefs.projects) - 1)
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
class OT_MoveUpTemplateItem(Operator):
|
class CT_OT_move_up(Operator):
|
||||||
bl_idname = "custom_templates.move_up"
|
bl_idname = "ct.move_up"
|
||||||
bl_label = "Move Up"
|
bl_label = "Move Up"
|
||||||
bl_description = "Move the selected template up in the list"
|
bl_description = "Move the selected template up in the list"
|
||||||
|
|
||||||
@ -151,14 +151,13 @@ class OT_MoveUpTemplateItem(Operator):
|
|||||||
if index > 0:
|
if index > 0:
|
||||||
prefs.projects.move(index, index - 1)
|
prefs.projects.move(index, index - 1)
|
||||||
prefs.active_template_index -= 1
|
prefs.active_template_index -= 1
|
||||||
self.report({'INFO'}, f"Templates list re-ordered")
|
|
||||||
else:
|
else:
|
||||||
self.report({'WARNING'}, "Template is already at the top")
|
self.report({'WARNING'}, "Template is already at the top")
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
class OT_MoveDownTemplateItem(Operator):
|
class CT_OT_move_down(Operator):
|
||||||
bl_idname = "custom_templates.move_down"
|
bl_idname = "ct.move_down"
|
||||||
bl_label = "Move Down"
|
bl_label = "Move Down"
|
||||||
bl_description = "Move the selected template down in the list"
|
bl_description = "Move the selected template down in the list"
|
||||||
|
|
||||||
@ -169,14 +168,13 @@ class OT_MoveDownTemplateItem(Operator):
|
|||||||
if index < len(prefs.projects) - 1:
|
if index < len(prefs.projects) - 1:
|
||||||
prefs.projects.move(index, index + 1)
|
prefs.projects.move(index, index + 1)
|
||||||
prefs.active_template_index += 1
|
prefs.active_template_index += 1
|
||||||
self.report({'INFO'}, f"Templates list re-ordered")
|
|
||||||
else:
|
else:
|
||||||
self.report({'WARNING'}, "Template is already at the bottom")
|
self.report({'WARNING'}, "Template is already at the bottom")
|
||||||
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
# Popups of File > Defaults
|
# Popups of File > Defaults
|
||||||
def check_if_present(self, prefs, path):
|
def already_present(self, prefs, path):
|
||||||
for p in prefs.projects:
|
for p in prefs.projects:
|
||||||
if p.path == path:
|
if p.path == path:
|
||||||
already_present = True
|
already_present = True
|
||||||
@ -185,8 +183,8 @@ def check_if_present(self, prefs, path):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
class OT_AddTemplatePopup(Operator):
|
class CT_OT_add_template_popup(Operator):
|
||||||
bl_idname = "custom_templates.add_template_popup"
|
bl_idname = "ct.add_template_popup"
|
||||||
bl_label = "Use as template"
|
bl_label = "Use as template"
|
||||||
bl_description = "Use the current .blend file to create a new template occurency"
|
bl_description = "Use the current .blend file to create a new template occurency"
|
||||||
|
|
||||||
@ -195,14 +193,11 @@ class OT_AddTemplatePopup(Operator):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
prefs = context.preferences.addons[base_package].preferences
|
prefs = context.preferences.addons[base_package].preferences
|
||||||
current_file_path = bpy.data.filepath
|
current_file_path = bpy.data.filepath
|
||||||
if check_if_present(self, prefs, current_file_path):
|
if not already_present(self, prefs, current_file_path):
|
||||||
return {'FINISHED'}
|
|
||||||
if current_file_path:
|
if current_file_path:
|
||||||
new_project = prefs.projects.add()
|
new_project = prefs.projects.add()
|
||||||
new_project.name = self.project_name
|
new_project.name = self.project_name
|
||||||
new_project.path = current_file_path
|
new_project.path = current_file_path
|
||||||
self.report(
|
|
||||||
{'INFO'}, f"Template '{self.project_name}' added successfully!")
|
|
||||||
else:
|
else:
|
||||||
self.report({'ERROR'}, "Current file is not saved on disk.")
|
self.report({'ERROR'}, "Current file is not saved on disk.")
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
@ -210,8 +205,8 @@ class OT_AddTemplatePopup(Operator):
|
|||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
return context.window_manager.invoke_props_dialog(self)
|
return context.window_manager.invoke_props_dialog(self)
|
||||||
|
|
||||||
class OT_SelectTemplatePopup(Operator):
|
class CT_OT_select_template_popup(Operator):
|
||||||
bl_idname = "custom_templates.select_template_popup"
|
bl_idname = "ct.select_template_popup"
|
||||||
bl_label = "Select a new custom template"
|
bl_label = "Select a new custom template"
|
||||||
bl_description = "Create a new template occurency by selecting an existing .blend file"
|
bl_description = "Create a new template occurency by selecting an existing .blend file"
|
||||||
|
|
||||||
@ -220,21 +215,18 @@ class OT_SelectTemplatePopup(Operator):
|
|||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
prefs = context.preferences.addons[base_package].preferences
|
prefs = context.preferences.addons[base_package].preferences
|
||||||
if check_if_present(self, prefs, self.project_path):
|
if not already_present(self, prefs, self.project_path):
|
||||||
return {'FINISHED'}
|
|
||||||
new_project = prefs.projects.add()
|
new_project = prefs.projects.add()
|
||||||
new_project.name = self.project_name
|
new_project.name = self.project_name
|
||||||
new_project.path = self.project_path
|
new_project.path = self.project_path
|
||||||
self.report(
|
|
||||||
{'INFO'}, f"Template '{self.project_name}' selected and added successfully!")
|
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
return context.window_manager.invoke_props_dialog(self)
|
return context.window_manager.invoke_props_dialog(self)
|
||||||
|
|
||||||
# Open Preferences
|
# Open Preferences
|
||||||
class OT_OpenAddonPreferences(Operator):
|
class CT_OT_open_preferences(Operator):
|
||||||
bl_idname = "custom_templates.open_preferences"
|
bl_idname = "ct.open_preferences"
|
||||||
bl_label = "Open Custom Templates Preferences"
|
bl_label = "Open Custom Templates Preferences"
|
||||||
bl_description = "Open the preferences for the Custom Templates add-on"
|
bl_description = "Open the preferences for the Custom Templates add-on"
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Ref WM_MT_splash https://projects.blender.org/blender/blender/src/commit/5a9fe638dedb179050c4929ea8fcdec80d221af2/scripts/startup/bl_operators/wm.py#L3296
|
# 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
|
# 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
|
||||||
import bpy
|
import bpy
|
||||||
# Clone of the WM_MT_splash (the section under the image of the Splash)
|
# 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
|
# It's edited (only in #Templates part) to add a menu in the New File section
|
||||||
@ -24,13 +24,13 @@ class WM_MT_splash(bpy.types.Menu):
|
|||||||
if prefs.override_splash and len(prefs.projects) > 0:
|
if prefs.override_splash and len(prefs.projects) > 0:
|
||||||
colA.label(text="Custom Templates")
|
colA.label(text="Custom Templates")
|
||||||
col1.operator_context = 'INVOKE_DEFAULT'
|
col1.operator_context = 'INVOKE_DEFAULT'
|
||||||
draw_templates_on_col(col1, context, True)
|
draw_templates(col1, context, True)
|
||||||
else:
|
else:
|
||||||
colA.label(text="New File")
|
colA.label(text="New File")
|
||||||
# Call original code
|
# Call original code
|
||||||
bpy.types.TOPBAR_MT_file_new.draw_ex(col1, context, use_splash=True)
|
bpy.types.TOPBAR_MT_file_new.draw_ex(col1, context, use_splash=True)
|
||||||
colB = ct_split.column()
|
colB = ct_split.column()
|
||||||
colB.menu("custom_templates.splash_mode", icon='DOWNARROW_HLT', text="")
|
colB.menu("CT_MT_splash_mode", icon='DOWNARROW_HLT', text="")
|
||||||
|
|
||||||
# Recent
|
# Recent
|
||||||
col2 = split.column()
|
col2 = split.column()
|
||||||
@ -72,8 +72,8 @@ class WM_MT_splash(bpy.types.Menu):
|
|||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
class CUSTOM_MT_splash_mode(bpy.types.Menu):
|
class CT_MT_splash_mode(bpy.types.Menu):
|
||||||
bl_idname = "custom_templates.splash_mode"
|
bl_idname = "CT_MT_splash_mode"
|
||||||
bl_label = "Custom Templates Switch"
|
bl_label = "Custom Templates Switch"
|
||||||
bl_description = "Swtich between Blender's default and your Custom Templates"
|
bl_description = "Swtich between Blender's default and your Custom Templates"
|
||||||
|
|
||||||
@ -87,13 +87,13 @@ class CUSTOM_MT_splash_mode(bpy.types.Menu):
|
|||||||
else:
|
else:
|
||||||
def_check = "CHECKMARK"
|
def_check = "CHECKMARK"
|
||||||
|
|
||||||
layout.operator("custom_templates.open_preferences", text="Manage templates")
|
layout.operator("ct.open_preferences", text="Manage templates")
|
||||||
layout.separator()
|
layout.separator()
|
||||||
layout.operator("custom_templates.splash_custom", text="Use Custom Templates", icon=ct_check)
|
layout.operator("ct.splash_custom", text="Use Custom Templates", icon=ct_check)
|
||||||
layout.operator("custom_templates.splash_default", text="Use Blender's Default", icon=def_check)
|
layout.operator("ct.splash_default", text="Use Blender's Default", icon=def_check)
|
||||||
|
|
||||||
class OT_SplashDefault(bpy.types.Operator):
|
class CT_OT_splash_default(bpy.types.Operator):
|
||||||
bl_idname = "custom_templates.splash_default"
|
bl_idname = "ct.splash_default"
|
||||||
bl_label = "Display default Blender's templates"
|
bl_label = "Display default Blender's templates"
|
||||||
bl_description = "Use Blender's default templates in the Splash Screen"
|
bl_description = "Use Blender's default templates in the Splash Screen"
|
||||||
|
|
||||||
@ -102,8 +102,8 @@ class OT_SplashDefault(bpy.types.Operator):
|
|||||||
prefs.override_splash = False
|
prefs.override_splash = False
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
class OT_SplashCustom(bpy.types.Operator):
|
class CT_OT_splash_custom(bpy.types.Operator):
|
||||||
bl_idname = "custom_templates.splash_custom"
|
bl_idname = "ct.splash_custom"
|
||||||
bl_label = "Display your custom templates"
|
bl_label = "Display your custom templates"
|
||||||
bl_description = "Use your custom templates in the Splash Screen (limited to first 5)"
|
bl_description = "Use your custom templates in the Splash Screen (limited to first 5)"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user