feat: session widget position and scale settings
feat: ui_scale is now taken in account for session widget text size
This commit is contained in:
parent
760b52c02b
commit
6f364d2b88
@ -502,6 +502,31 @@ class SessionProps(bpy.types.PropertyGroup):
|
||||
description="Show session status on the viewport",
|
||||
default=True,
|
||||
)
|
||||
presence_hud_scale: bpy.props.FloatProperty(
|
||||
name="Text scale",
|
||||
description="Adjust the session widget text scale",
|
||||
min=7,
|
||||
max=90,
|
||||
default=15,
|
||||
)
|
||||
presence_hud_hpos: bpy.props.FloatProperty(
|
||||
name="horizontal position",
|
||||
description="Adjust the session widget horizontal position",
|
||||
min=1,
|
||||
max=90,
|
||||
default=10,
|
||||
step=1,
|
||||
subtype='PERCENTAGE',
|
||||
)
|
||||
presence_hud_vpos: bpy.props.FloatProperty(
|
||||
name="vertical position",
|
||||
description="Adjust the session widget vertical position",
|
||||
min=1,
|
||||
max=94,
|
||||
default=10,
|
||||
step=1,
|
||||
subtype='PERCENTAGE',
|
||||
)
|
||||
filter_owned: bpy.props.BoolProperty(
|
||||
name="filter_owned",
|
||||
description='Show only owned datablocks',
|
||||
|
@ -393,6 +393,8 @@ class SessionStatusWidget(Widget):
|
||||
self.settings.enable_presence
|
||||
|
||||
def draw(self):
|
||||
text_scale = self.settings.presence_hud_scale
|
||||
ui_scale = bpy.context.preferences.view.ui_scale
|
||||
color = [1, 1, 0, 1]
|
||||
state = session.state.get('STATE')
|
||||
state_str = f"{get_state_str(state)}"
|
||||
@ -401,9 +403,11 @@ class SessionStatusWidget(Widget):
|
||||
color = [0, 1, 0, 1]
|
||||
elif state == STATE_INITIAL:
|
||||
color = [1, 0, 0, 1]
|
||||
hpos = (self.settings.presence_hud_hpos*bpy.context.area.width)/100
|
||||
vpos = (self.settings.presence_hud_vpos*bpy.context.area.height)/100
|
||||
|
||||
blf.position(0, 10, 20, 0)
|
||||
blf.size(0, 16, 45)
|
||||
blf.position(0, hpos, vpos, 0)
|
||||
blf.size(0, int(text_scale*ui_scale), 72)
|
||||
blf.color(0, color[0], color[1], color[2], color[3])
|
||||
blf.draw(0, state_str)
|
||||
|
||||
|
@ -451,6 +451,13 @@ class SESSION_PT_presence(bpy.types.Panel):
|
||||
layout.active = settings.enable_presence
|
||||
col = layout.column()
|
||||
col.prop(settings, "presence_show_session_status")
|
||||
row = col.column()
|
||||
row.active = settings.presence_show_session_status
|
||||
row.prop(settings, "presence_hud_scale", expand=True)
|
||||
row = col.column(align=True)
|
||||
row.active = settings.presence_show_session_status
|
||||
row.prop(settings, "presence_hud_hpos", expand=True)
|
||||
row.prop(settings, "presence_hud_vpos", expand=True)
|
||||
col.prop(settings, "presence_show_selected")
|
||||
col.prop(settings, "presence_show_user")
|
||||
row = layout.column()
|
||||
|
Loading…
Reference in New Issue
Block a user