feat: dynamic right on selection selection progress

This commit is contained in:
Swann 2019-09-18 23:55:30 +02:00
parent e17909ebe8
commit c26e71cd6a
3 changed files with 31 additions and 2 deletions

View File

@ -38,7 +38,7 @@ class BlObject(BlDatablock):
def load(self, data, target):
# Load other meshes metadata
# utils.dump_anything.load(target, data)
target.uuid = data['uuid']
target.matrix_world = mathutils.Matrix(data["matrix_world"])
# Load modifiers

View File

@ -66,6 +66,33 @@ class ApplyTimer(Timer):
return self._timeout
class DynamicRightSelectTimer(Timer):
def __init__(self, timout=1):
super().__init__(timout)
self.last_selection=[]
def execute(self):
if operators.client:
users = operators.client.list(filter=BlUser)
for user in users:
user_ref = operators.client.get(uuid=user)
settings = bpy.context.window_manager.session
if user_ref.buffer['name'] != settings.username:
for obj in bpy.data.objects:
obj.hide_select = obj.name in user_ref.buffer['selected_objects']
elif user_ref.pointer:
if user_ref.pointer.selected_objects != self.last_selection:
self.last_selection = user_ref.pointer.selected_objects
# update our rights
for selected_obj in self.last_selection:
node = operators.client.get(reference=bpy.data.objects[selected_obj])
node.owner = settings.username
operators.client.change_owner(node.uuid, settings.username)
return self._timeout
# class CheckNewTimer(Timer):
class RedrawTimer(Timer):

View File

@ -135,7 +135,9 @@ class SessionStartOperator(bpy.types.Operator):
settings.user_uuid = client.add(usr)
delayables.append(delayable.ClientUpdate(
client_uuid=settings.user_uuid))
delayables.append(delayable.DynamicRightSelectTimer())
for node in client.list():
try:
client.commit(node)