Prefs: Removed warning message for splash screen issue, remove [-] button with no templates, Fix index access issue importing shorter list

This commit is contained in:
doc-code 2024-08-26 16:01:26 +02:00
parent ba9e026291
commit 2992585cd5

View File

@ -31,7 +31,8 @@ class CustomTemplatesPreferences(AddonPreferences):
col.menu("custom_templates.export_menu", icon='DOWNARROW_HLT', text="")
col.separator()
col.operator("custom_templates.add", icon='ADD', text="")
col.operator("custom_templates.remove", icon='REMOVE', text="")
if self.projects:
col.operator("custom_templates.remove", icon='REMOVE', text="")
col.separator()
col.operator("custom_templates.move_up", icon='TRIA_UP', text="")
col.operator("custom_templates.move_down", icon='TRIA_DOWN', text="")
@ -45,18 +46,14 @@ class CustomTemplatesPreferences(AddonPreferences):
box = layout.box()
if self.override_splash and len(self.projects) == 0:
box.label(text="There are currently no templates.")
elif self.override_splash:
box.label(text="Custom templates will be shown in the Splash Screen.")
if not self.override_splash or len(self.projects) == 0:
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.")
if len(self.projects) > 5:
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):
bl_idname = "custom_templates.export_menu"
@ -106,6 +103,7 @@ class OT_ImportTemplates(bpy.types.Operator):
item = prefs.projects.add()
item.name = project["name"]
item.path = project["path"]
prefs.active_template_index = 0
self.report({'INFO'}, f"Projects imported from {self.filepath}")
return {'FINISHED'}