Update topbar for only_multiple_scenes.. preference

This commit is contained in:
Francesco Bellini 2024-09-13 22:50:03 +02:00
parent 369f350e02
commit 1273ab83ef

View File

@ -1,7 +1,7 @@
from .. import __package__ as base_package
import bpy
from bpy.types import Header, Panel
from .funcs import get_scene_workspaces, get_use_topbar, get_switch, get_compact
from .funcs import get_scene_workspaces, get_use_topbar, get_switch, get_compact, get_only_with_multiple
# Ref TOPBAR_HT_upper_bar https://projects.blender.org/blender/blender/src/commit/2204157a2c9fc926643b0e39968602c750d9b5e6/scripts/startup/bl_ui/space_topbar.py#L14
class TOPBAR_HT_upper_bar(Header):
@ -29,6 +29,9 @@ class TOPBAR_HT_upper_bar(Header):
use_topbar = get_use_topbar()
compact = get_compact()
switch= get_switch()
only_with_multiple = get_only_with_multiple()
has_multiple = len(bpy.data.scenes) > 1
multiple_satisfied = (not only_with_multiple or only_with_multiple and has_multiple)
if not screen.show_fullscreen:
main_col = layout.column()
@ -37,11 +40,11 @@ class TOPBAR_HT_upper_bar(Header):
main_row = main_col.row()
sy = 1.18
sx = 1.18
if switch:
if switch and multiple_satisfied:
col = main_row.column()
# Show/Hide Custom Topbar
col.operator("sw.switch", text="", emboss=False, icon="CHECKBOX_HLT" if use_topbar else "CHECKBOX_DEHLT")
if not use_topbar:
if not use_topbar or not multiple_satisfied:
# Original
layout.template_ID_tabs(window, "workspace", new="workspace.add", menu="TOPBAR_MT_workspace_menu")
else: