diff --git a/addon/sw/topbar.py b/addon/sw/topbar.py index 6e88322..3269571 100644 --- a/addon/sw/topbar.py +++ b/addon/sw/topbar.py @@ -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: