feat: dynamic right on selection selection progress
This commit is contained in:
@ -38,7 +38,7 @@ class BlObject(BlDatablock):
|
|||||||
def load(self, data, target):
|
def load(self, data, target):
|
||||||
# Load other meshes metadata
|
# Load other meshes metadata
|
||||||
# utils.dump_anything.load(target, data)
|
# utils.dump_anything.load(target, data)
|
||||||
|
target.uuid = data['uuid']
|
||||||
target.matrix_world = mathutils.Matrix(data["matrix_world"])
|
target.matrix_world = mathutils.Matrix(data["matrix_world"])
|
||||||
|
|
||||||
# Load modifiers
|
# Load modifiers
|
||||||
|
27
delayable.py
27
delayable.py
@ -66,6 +66,33 @@ class ApplyTimer(Timer):
|
|||||||
|
|
||||||
return self._timeout
|
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 CheckNewTimer(Timer):
|
||||||
|
|
||||||
class RedrawTimer(Timer):
|
class RedrawTimer(Timer):
|
||||||
|
@ -135,7 +135,9 @@ class SessionStartOperator(bpy.types.Operator):
|
|||||||
settings.user_uuid = client.add(usr)
|
settings.user_uuid = client.add(usr)
|
||||||
delayables.append(delayable.ClientUpdate(
|
delayables.append(delayable.ClientUpdate(
|
||||||
client_uuid=settings.user_uuid))
|
client_uuid=settings.user_uuid))
|
||||||
|
|
||||||
|
delayables.append(delayable.DynamicRightSelectTimer())
|
||||||
|
|
||||||
for node in client.list():
|
for node in client.list():
|
||||||
try:
|
try:
|
||||||
client.commit(node)
|
client.commit(node)
|
||||||
|
Reference in New Issue
Block a user