fix: selection update error
This commit is contained in:
@ -131,6 +131,7 @@ class SessionStartOperator(bpy.types.Operator):
|
||||
|
||||
delayables.append(delayable.ClientUpdate(
|
||||
client_uuid=settings.user_uuid))
|
||||
delayables.append(delayable.DrawClient())
|
||||
|
||||
delayables.append(delayable.DynamicRightSelectTimer())
|
||||
|
||||
@ -304,19 +305,6 @@ class SessionCommit(bpy.types.Operator):
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@persistent
|
||||
def redresh_handler(dummy):
|
||||
"""force to refresh client renderer
|
||||
"""
|
||||
global client
|
||||
|
||||
if client:
|
||||
user = client.get(uuid=bpy.context.window_manager.session.user_uuid)
|
||||
|
||||
if hasattr(user, "pointer"):
|
||||
user.pointer.is_dirty = True
|
||||
|
||||
|
||||
classes = (
|
||||
SessionStartOperator,
|
||||
SessionStopOperator,
|
||||
@ -333,9 +321,6 @@ def register():
|
||||
for cls in classes:
|
||||
register_class(cls)
|
||||
|
||||
bpy.app.handlers.depsgraph_update_post.append(redresh_handler)
|
||||
|
||||
|
||||
def unregister():
|
||||
global client
|
||||
|
||||
@ -347,8 +332,5 @@ def unregister():
|
||||
for cls in reversed(classes):
|
||||
unregister_class(cls)
|
||||
|
||||
bpy.app.handlers.depsgraph_update_post.remove(redresh_handler)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
@ -100,14 +100,15 @@ class User():
|
||||
self.color = color
|
||||
self.location = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]
|
||||
self.selected_objects = []
|
||||
self.last_select_objects = []
|
||||
|
||||
def update_location(self):
|
||||
current_coords = get_client_cam_points()
|
||||
area, region, rv3d = view3d_find()
|
||||
|
||||
current_coords = get_client_cam_points()
|
||||
if current_coords:
|
||||
self.location = list(current_coords)
|
||||
current_coords = list(get_client_cam_points())
|
||||
if current_coords and self.location != current_coords:
|
||||
self.location = current_coords
|
||||
|
||||
def update_selected_objects(self, context):
|
||||
self.selected_objects = utils.get_selected_objects(context.scene)
|
||||
@ -166,10 +167,12 @@ class DrawFactory(object):
|
||||
self.d3d_items.clear()
|
||||
self.d2d_items.clear()
|
||||
|
||||
def flush_selection(self):
|
||||
def flush_selection(self, user):
|
||||
key_to_remove = []
|
||||
select_key = "{}_select".format(user) if user else "select"
|
||||
for k in self.d3d_items.keys():
|
||||
if "select" in k:
|
||||
|
||||
if select_key in k:
|
||||
key_to_remove.append(k)
|
||||
|
||||
for k in key_to_remove:
|
||||
@ -189,8 +192,9 @@ class DrawFactory(object):
|
||||
def draw_client_selection(self, client_uuid, client_color, client_selection):
|
||||
local_user = bpy.context.window_manager.session.user_uuid
|
||||
|
||||
if client_selection and local_user != client_uuid:
|
||||
self.flush_selection()
|
||||
if local_user != client_uuid:
|
||||
self.flush_selection(client_uuid)
|
||||
|
||||
for select_ob in client_selection:
|
||||
drawable_key = "{}_select_{}".format(client_uuid, select_ob)
|
||||
indices = (
|
||||
|
Reference in New Issue
Block a user