Update panel UX
This commit is contained in:
parent
ea2c0fa883
commit
14fa397c1b
@ -1,6 +1,6 @@
|
|||||||
import bpy
|
import bpy
|
||||||
from bpy.types import Panel
|
from bpy.types import Panel
|
||||||
from .funcs import get_scene_workspaces, workspace_ops
|
from .funcs import prop_name, prop_i_name, get_active, get_scene_workspaces, workspace_ops
|
||||||
|
|
||||||
class SW_PT_select_scene_workspaces(Panel):
|
class SW_PT_select_scene_workspaces(Panel):
|
||||||
bl_idname = "sw.select_scene_workspaces"
|
bl_idname = "sw.select_scene_workspaces"
|
||||||
@ -9,37 +9,36 @@ class SW_PT_select_scene_workspaces(Panel):
|
|||||||
bl_region_type = 'WINDOW'
|
bl_region_type = 'WINDOW'
|
||||||
bl_context = "scene"
|
bl_context = "scene"
|
||||||
bl_options = {'DEFAULT_CLOSED'}
|
bl_options = {'DEFAULT_CLOSED'}
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
layout.alignment = 'LEFT'
|
||||||
layout.label(text="Workspaces linked to this Scene:")
|
layout.label(text="Workspaces linked to this Scene")
|
||||||
box = layout.box()
|
row = layout.row()
|
||||||
sw = get_scene_workspaces()
|
sw = get_scene_workspaces()
|
||||||
if not sw:
|
if not sw:
|
||||||
|
box = row.box()
|
||||||
box.label(text="There are no workspaces linked right now...")
|
box.label(text="There are no workspaces linked right now...")
|
||||||
box.operator("sw.link_all")
|
box.operator("sw.link_all")
|
||||||
else:
|
else:
|
||||||
i = 0
|
i = get_active()
|
||||||
|
active = sw[i]
|
||||||
|
r = row.box().column(align=True)
|
||||||
for w in sw:
|
for w in sw:
|
||||||
box.scale_y = .4
|
op = r.operator("sw.select", text=w, icon="RADIOBUT_ON" if active == w else "RADIOBUT_OFF", emboss=active == w)
|
||||||
box2 = box.box()
|
op.workspace = w
|
||||||
row = box2.row(align=True)
|
r = row.column(align=True)
|
||||||
row.scale_y = 2.1
|
workspace_ops(r, i, False, active)
|
||||||
row.label(text=f"{w}")
|
|
||||||
workspace_ops(row, i, False, w)
|
|
||||||
i += 1
|
|
||||||
box.separator()
|
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
layout.label(text="Link other workspaces")
|
layout.label(text="Link other workspaces")
|
||||||
box2 = layout.box()
|
box2 = layout.box()
|
||||||
row = box2.row()
|
row = box2.row()
|
||||||
row_count = 0
|
row_count = 0
|
||||||
l = [x for x in bpy.data.workspaces if x.name not in sw]
|
l = [x for x in bpy.data.workspaces if x.name not in sw]
|
||||||
for w in l:
|
for w in l:
|
||||||
if row_count > 0 and row_count % 4 == 0:
|
if row_count > 0 and row_count % 3 == 0:
|
||||||
row = box2.row()
|
row = box2.row()
|
||||||
row.operator("sw.link_workspace", text=w.name).workspace = w.name
|
row.operator("sw.link_workspace", text=w.name).workspace = w.name
|
||||||
row_count += 1
|
row_count += 1
|
||||||
@ -47,4 +46,4 @@ class SW_PT_select_scene_workspaces(Panel):
|
|||||||
layout.separator()
|
layout.separator()
|
||||||
layout.operator("sw.link_all")
|
layout.operator("sw.link_all")
|
||||||
else:
|
else:
|
||||||
box2.label(text="All workspaces are currently linked.")
|
row.label(text="All workspaces are currently linked.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user