Splash: add themes to first time setup in splash screen.
* Add default theme as Blender Dark. * Rename Flatty Light to Blender Light. * When setting theme, reset to default first for consistent results.
This commit is contained in:
parent
6a41691a0d
commit
e1293da014
Notes:
blender-bot
2023-10-04 09:42:55 +02:00
Referenced by issue #57110, Toggling Between Shading modes causes a crash with heavy scenes
|
@ -0,0 +1,6 @@
|
|||
<bpy>
|
||||
<Theme>
|
||||
</Theme>
|
||||
<ThemeStyle>
|
||||
</ThemeStyle>
|
||||
</bpy>
|
|
@ -238,6 +238,13 @@ class ExecutePreset(Operator):
|
|||
|
||||
ext = splitext(filepath)[1].lower()
|
||||
|
||||
if ext not in {".py", ".xml"}:
|
||||
self.report({'ERROR'}, "unknown filetype: %r" % ext)
|
||||
return {'CANCELLED'}
|
||||
|
||||
if hasattr(preset_class, "pre_cb"):
|
||||
preset_class.pre_cb(context)
|
||||
|
||||
# execute the preset using script.python_file_run
|
||||
if ext == ".py":
|
||||
bpy.ops.script.python_file_run(filepath=filepath)
|
||||
|
@ -246,9 +253,9 @@ class ExecutePreset(Operator):
|
|||
rna_xml.xml_file_run(context,
|
||||
filepath,
|
||||
preset_class.preset_xml_map)
|
||||
else:
|
||||
self.report({'ERROR'}, "unknown filetype: %r" % ext)
|
||||
return {'CANCELLED'}
|
||||
|
||||
if hasattr(preset_class, "post_cb"):
|
||||
preset_class.post_cb(context)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
@ -564,6 +571,9 @@ class AddPresetInterfaceTheme(AddPresetBase, Operator):
|
|||
preset_menu = "USERPREF_MT_interface_theme_presets"
|
||||
preset_subdir = "interface_theme"
|
||||
|
||||
def pre_cb(self, context):
|
||||
bpy.ops.ui.reset_default_theme()
|
||||
|
||||
|
||||
class AddPresetKeyconfig(AddPresetBase, Operator):
|
||||
"""Add or remove a Key-config Preset"""
|
||||
|
|
|
@ -2559,8 +2559,6 @@ class WM_MT_splash(Menu):
|
|||
|
||||
col = split.column()
|
||||
|
||||
col.label()
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.label(text="Input and Shortcuts:")
|
||||
text = bpy.path.display_name(context.window_manager.keyconfigs.active.name)
|
||||
|
@ -2570,13 +2568,19 @@ class WM_MT_splash(Menu):
|
|||
|
||||
col.separator()
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.label(text="Theme:")
|
||||
label = bpy.types.USERPREF_MT_interface_theme_presets.bl_label
|
||||
if label == "Presets":
|
||||
label = "Blender Dark"
|
||||
sub.menu("USERPREF_MT_interface_theme_presets", text=label)
|
||||
|
||||
# We need to make switching to a language easier first
|
||||
#sub = col.column(align=False)
|
||||
# sub.label(text="Language:")
|
||||
#userpref = context.user_preferences
|
||||
#sub.prop(userpref.system, "language", text="")
|
||||
|
||||
col.label()
|
||||
col.label()
|
||||
|
||||
layout.label()
|
||||
|
|
|
@ -505,6 +505,9 @@ class USERPREF_MT_interface_theme_presets(Menu):
|
|||
)
|
||||
draw = Menu.draw_preset
|
||||
|
||||
def pre_cb(context):
|
||||
bpy.ops.ui.reset_default_theme()
|
||||
|
||||
|
||||
class USERPREF_PT_theme(Panel):
|
||||
bl_space_type = 'USER_PREFERENCES'
|
||||
|
|
Loading…
Reference in New Issue