From d6fa3dd76b04e01b930728814e9905990913f433 Mon Sep 17 00:00:00 2001 From: doc-code Date: Sun, 18 Aug 2024 16:57:06 +0200 Subject: [PATCH] Update preferences to add override_splash prop --- addon/classes/ots.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/addon/classes/ots.py b/addon/classes/ots.py index da19a91..bb31d5a 100644 --- a/addon/classes/ots.py +++ b/addon/classes/ots.py @@ -2,7 +2,7 @@ from .. import __package__ as base_package import bpy import json from bpy.types import Operator, PropertyGroup, AddonPreferences -from bpy.props import StringProperty, CollectionProperty, IntProperty +from bpy.props import StringProperty, CollectionProperty, IntProperty, BoolProperty # Preferences class TemplateItem(PropertyGroup): @@ -13,18 +13,15 @@ class TemplateItem(PropertyGroup): class CustomTemplatesPreferences(AddonPreferences): bl_idname = base_package - + + override_splash: BoolProperty(default=True, name="Override Splash Screen's 'New File' list", description="Override splashscreen's 'New File' list") projects: CollectionProperty(type=TemplateItem) active_template_index: IntProperty( description="Index of the selected template") def draw(self, context): layout = self.layout - - layout.label( - text="Here you can setup your own .blend files that will be shown in the `File > New` menu.") - layout.label( - text="You can also use `File > Defaults > Select new custom template` and `File > Defaults > Use current as new template` to update this preferences.") + layout.label(text="Your custom templates:") row = layout.row() row.template_list("UI_UL_list", "custom_templates", @@ -43,7 +40,24 @@ class CustomTemplatesPreferences(AddonPreferences): project = self.projects[self.active_template_index] layout.prop(project, "name") layout.prop(project, "path") - + + layout.prop(self, "override_splash") + box = layout.box() + if self.override_splash and len(self.projects) == 0: + box.label(text="There are currently no templates.") + box.label(text="The default Blender list will be shown in the Splash Screen.") + else: + box.label(text="The list 'New File' in the Splash Screen will be replaced with your templates.") + + layout.separator() + layout.label(text="Note:") + box = layout.box() + box.label(text="This add-on override the entire Splash Screen (section under the image).") + box.label(text="Disabling this extension, will leave only the image.") + box.label(text="Use `Blender > System > Reload Scripts` or restart Blender to restore it.") + box.label(text="This is only needed after disabling this add-on.") + + class CUSTOM_MT_Export_Menu(bpy.types.Menu): bl_idname = "custom_templates.export_menu" bl_label = "Import/Export custom templates"