feat: expose auto-push

This commit is contained in:
Swann Martinez 2019-09-16 13:43:43 +02:00
parent 5b2dc0b57e
commit 3f5d6f50b5
No known key found for this signature in database
GPG Key ID: 414CCAFD8DA720E1
5 changed files with 17 additions and 7 deletions

View File

@ -42,6 +42,7 @@ def generate_supported_types():
props['bl_delay_apply']=_type.bl_delay_apply props['bl_delay_apply']=_type.bl_delay_apply
props['use_as_filter'] = False props['use_as_filter'] = False
props['icon'] = _type.bl_icon props['icon'] = _type.bl_icon
props['auto_push']=_type.bl_automatic_push
# stype_dict[type]['bl_delay_apply']=_type.bl_delay_apply # stype_dict[type]['bl_delay_apply']=_type.bl_delay_apply
stype_dict['supported_types'][_type.bl_rep_class.__name__] = props stype_dict['supported_types'][_type.bl_rep_class.__name__] = props
@ -93,6 +94,7 @@ def save_session_config(self,context):
config["supported_types"][bloc.type_name]['bl_delay_apply'] = bloc.bl_delay_apply config["supported_types"][bloc.type_name]['bl_delay_apply'] = bloc.bl_delay_apply
config["supported_types"][bloc.type_name]['use_as_filter'] = bloc.use_as_filter config["supported_types"][bloc.type_name]['use_as_filter'] = bloc.use_as_filter
config["supported_types"][bloc.type_name]['icon'] = bloc.icon config["supported_types"][bloc.type_name]['icon'] = bloc.icon
config["supported_types"][bloc.type_name]['auto_push'] = bloc.auto_push
# Save out the configuration file # Save out the configuration file
@ -105,6 +107,7 @@ class ReplicatedDatablock(bpy.types.PropertyGroup):
bl_delay_refresh: bpy.props.FloatProperty() bl_delay_refresh: bpy.props.FloatProperty()
bl_delay_apply: bpy.props.FloatProperty() bl_delay_apply: bpy.props.FloatProperty()
use_as_filter: bpy.props.BoolProperty(default=True) use_as_filter: bpy.props.BoolProperty(default=True)
auto_push: bpy.props.BoolProperty(default=True)
icon: bpy.props.StringProperty() icon: bpy.props.StringProperty()
class SessionProps(bpy.types.PropertyGroup): class SessionProps(bpy.types.PropertyGroup):
@ -195,6 +198,8 @@ class SessionProps(bpy.types.PropertyGroup):
rep_value.bl_delay_refresh = config["supported_types"][datablock]['bl_delay_refresh'] rep_value.bl_delay_refresh = config["supported_types"][datablock]['bl_delay_refresh']
rep_value.bl_delay_apply = config["supported_types"][datablock]['bl_delay_apply'] rep_value.bl_delay_apply = config["supported_types"][datablock]['bl_delay_apply']
rep_value.icon = config["supported_types"][datablock]['icon'] rep_value.icon = config["supported_types"][datablock]['icon']
rep_value.auto_push = config["supported_types"][datablock]['auto_push']
def save(self,context): def save(self,context):
config = environment.load_config() config = environment.load_config()
@ -211,6 +216,7 @@ class SessionProps(bpy.types.PropertyGroup):
config["supported_types"][bloc.type_name]['bl_delay_apply'] = bloc.bl_delay_apply config["supported_types"][bloc.type_name]['bl_delay_apply'] = bloc.bl_delay_apply
config["supported_types"][bloc.type_name]['use_as_filter'] = bloc.use_as_filter config["supported_types"][bloc.type_name]['use_as_filter'] = bloc.use_as_filter
config["supported_types"][bloc.type_name]['icon'] = bloc.icon config["supported_types"][bloc.type_name]['icon'] = bloc.icon
config["supported_types"][bloc.type_name]['auto_push'] = bloc.auto_push
environment.save_config(config) environment.save_config(config)

View File

@ -61,7 +61,7 @@ class BlUser(BlDatablock):
bl_id = "users" bl_id = "users"
bl_class = presence.User bl_class = presence.User
bl_rep_class = BlUser bl_rep_class = BlUser
bl_delay_refresh = 1 bl_delay_refresh = .2
bl_delay_apply = 1 bl_delay_apply = .2
bl_automatic_push = True bl_automatic_push = True
bl_icon = 'CON_ARMATURE' bl_icon = 'CON_ARMATURE'

@ -1 +1 @@
Subproject commit 443497886f91af935bfb8bae1a4273c414debff3 Subproject commit 67c195f694b005c25c4881e7078d81286522cd40

View File

@ -80,7 +80,7 @@ class SessionStartOperator(bpy.types.Operator):
_type.bl_class, _type.bl_class,
_type.bl_rep_class, _type.bl_rep_class,
timer=type_local_config.bl_delay_refresh, timer=type_local_config.bl_delay_refresh,
automatic=_type.bl_automatic_push) automatic=type_local_config.auto_push)
if type_local_config.bl_delay_apply > 0: if type_local_config.bl_delay_apply > 0:
delayables.append(delayable.ApplyTimer( delayables.append(delayable.ApplyTimer(
@ -307,8 +307,9 @@ class SessionCommit(bpy.types.Operator):
def redresh_handler(dummy): def redresh_handler(dummy):
global client global client
user = client.get(uuid=bpy.context.window_manager.session.user_uuid) if client:
user.pointer.is_dirty = True user = client.get(uuid=bpy.context.window_manager.session.user_uuid)
user.pointer.is_dirty = True
classes = ( classes = (

5
ui.py
View File

@ -152,14 +152,17 @@ class SESSION_PT_settings_replication(bpy.types.Panel):
line.separator() line.separator()
line.label(text="refresh (sec)") line.label(text="refresh (sec)")
line.label(text="apply (sec)") line.label(text="apply (sec)")
for item in settings.supported_datablock: for item in settings.supported_datablock:
line = flow.row(align=True) line = flow.row(align=True)
line.label(text="", icon=item.icon) # line.label(text="", icon=item.icon)
line.prop(item, "auto_push", text="", icon=item.icon)
line.separator() line.separator()
line.prop(item, "bl_delay_refresh", text="") line.prop(item, "bl_delay_refresh", text="")
line.prop(item, "bl_delay_apply", text="") line.prop(item, "bl_delay_apply", text="")
class SESSION_PT_user(bpy.types.Panel): class SESSION_PT_user(bpy.types.Panel):
bl_idname = "MULTIUSER_USER_PT_panel" bl_idname = "MULTIUSER_USER_PT_panel"
bl_label = "Users" bl_label = "Users"