fix user drawing options

This commit is contained in:
Swann 2021-11-18 16:05:24 +01:00
parent c05a12343c
commit 50e86aea15

View File

@ -983,16 +983,19 @@ class SessionLoadSaveOperator(bpy.types.Operator, ImportHelper):
default=False, default=False,
) )
user_skin_radius: bpy.props.FloatProperty( user_skin_radius: bpy.props.FloatProperty(
name="User radius", name="Wireframe radius",
description="User skin radius", description="Wireframe radius",
default=0.005, default=0.005,
) )
user_color_intensity: bpy.props.FloatProperty( user_color_intensity: bpy.props.FloatProperty(
name="User emission intensity", name="Shading intensity",
description="User emission intensity", description="Shading intensity",
default=10.0, default=10.0,
) )
def draw(self, context):
pass
def execute(self, context): def execute(self, context):
from replication.repository import Repository from replication.repository import Repository
@ -1027,13 +1030,45 @@ class SessionLoadSaveOperator(bpy.types.Operator, ImportHelper):
if metadata: if metadata:
draw_user(username, metadata, radius=self.user_skin_radius, intensity=self.user_color_intensity) draw_user(username, metadata, radius=self.user_skin_radius, intensity=self.user_color_intensity)
return {'FINISHED'} return {'FINISHED'}
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
return True return True
class SessionImportUser(bpy.types.Panel):
bl_space_type = 'FILE_BROWSER'
bl_region_type = 'TOOL_PROPS'
bl_label = "Users"
bl_parent_id = "FILE_PT_operator"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
sfile = context.space_data
operator = sfile.active_operator
return operator.bl_idname == "SESSION_OT_load"
def draw_header(self, context):
sfile = context.space_data
operator = sfile.active_operator
self.layout.prop(operator, "draw_users", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False # No animation.
sfile = context.space_data
operator = sfile.active_operator
layout.enabled = operator.draw_users
layout.prop(operator, "user_skin_radius")
layout.prop(operator, "user_color_intensity")
class SessionPresetServerAdd(bpy.types.Operator): class SessionPresetServerAdd(bpy.types.Operator):
"""Add a server to the server list preset""" """Add a server to the server list preset"""
bl_idname = "session.preset_server_add" bl_idname = "session.preset_server_add"
@ -1265,6 +1300,7 @@ classes = (
SessionNotifyOperator, SessionNotifyOperator,
SessionSaveBackupOperator, SessionSaveBackupOperator,
SessionLoadSaveOperator, SessionLoadSaveOperator,
SessionImportUser,
SessionStopAutoSaveOperator, SessionStopAutoSaveOperator,
SessionPurgeOperator, SessionPurgeOperator,
SessionPresetServerAdd, SessionPresetServerAdd,