feat: progression on session mamnagment

This commit is contained in:
Swann Martinez
2020-01-20 18:55:03 +01:00
parent ff932b0cdf
commit 07df42d087
5 changed files with 28 additions and 9 deletions

View File

@ -18,7 +18,7 @@ class BlUser(BlDatablock):
def construct(self, data): def construct(self, data):
user = bpy.data.window_managers['WinMan'].online_users.add() user = bpy.data.window_managers['WinMan'].online_users.add()
user.name = self.uuid user.name = data['name']
user.username = data['name'] user.username = data['name']
user.current_frame = data['current_frame'] user.current_frame = data['current_frame']
@ -55,7 +55,7 @@ class BlUser(BlDatablock):
self.pointer.is_dirty = True self.pointer.is_dirty = True
def resolve(self): def resolve(self):
self.pointer = bpy.data.window_managers['WinMan'].online_users.get(self.uuid) self.pointer = bpy.data.window_managers['WinMan'].online_users.get(self.data['name'])
def is_valid(self): def is_valid(self):
return True return True

View File

@ -211,3 +211,21 @@ class ClientUpdate(Timer):
if client: if client:
client.pointer.update_location() client.pointer.update_location()
# sync online users
session_users = operators.client.online_users
ui_users = bpy.context.window_manager.online_users
for index, user in enumerate(ui_users):
if user.username not in session_users.keys():
ui_users.remove(index)
bpy.context.window_manager.session.presence_show_user = False
bpy.context.window_manager.session.presence_show_user = True
presence.refresh_3d_view()
break
for user in session_users:
if user not in ui_users:
new_key = ui_users.add()
new_key.name = user
new_key.username = user

View File

@ -56,11 +56,12 @@ class SessionStartOperator(bpy.types.Operator):
# TODO: Sync server clients # TODO: Sync server clients
users.clear() users.clear()
#load our infos into the local user list
local_user = users.add() # #load our infos into the local user list
local_user.name = 'localhost' # local_user = users.add()
local_user.username = settings.username # local_user.name = 'localhost'
local_user.current_frame = context.scene.frame_current # local_user.username = settings.username
# local_user.current_frame = context.scene.frame_current
# save config # save config
settings.save(context) settings.save(context)

View File

@ -218,7 +218,7 @@ class SESSION_UL_users(bpy.types.UIList):
if item.username in user: if item.username in user:
ping = str(user_stat['latency']) ping = str(user_stat['latency'])
break break
split = layout.split(factor=0.3) split = layout.split(factor=0.3)
split.label(text=item.username) split.label(text=item.username)
split.label(text=str(item.current_frame)) split.label(text=str(item.current_frame))