import bpy from bpy.types import Menu from .funcs import get_scene_workspaces class SW_MT_copy_from(Menu): bl_label = "Copy and link workspaces from other scenes" def draw(self, context): layout = self.layout layout.label(text="Copy workspaces from scene") layout.separator() for s in bpy.data.scenes: if s.name != bpy.context.scene.name: layout.operator("sw.copy_from_scene", text=s.name, icon="SCENE_DATA").scene = s.name class SW_MT_missing_workspaces(Menu): bl_label = "Link other workspaces to this scene" def draw(self, context): layout = self.layout present = len(bpy.data.workspaces) > len(get_scene_workspaces()) if present: layout.operator("sw.link_all", text="Link all workspaces") layout.separator() for w in bpy.data.workspaces: if w.name not in get_scene_workspaces(): layout.operator("sw.link_workspace", text=w.name, icon="LINKED").workspace = w.name