feat: snap user not set same user view

This commit is contained in:
Swann
2019-10-15 14:28:34 +02:00
parent c9c359e226
commit 6969e386e2
4 changed files with 12 additions and 3 deletions

View File

@ -15,6 +15,7 @@ class BlUser(BlDatablock):
target.name = data['name'] target.name = data['name']
target.location = data['location'] target.location = data['location']
target.selected_objects = data['selected_objects'] target.selected_objects = data['selected_objects']
utils.dump_anything.load(target, data) utils.dump_anything.load(target, data)
def apply(self): def apply(self):
@ -34,6 +35,8 @@ class BlUser(BlDatablock):
data['location'] = pointer.location data['location'] = pointer.location
data['color'] = pointer.color data['color'] = pointer.color
data['selected_objects'] = pointer.selected_objects data['selected_objects'] = pointer.selected_objects
data['view_matrix'] = pointer.view_matrix
return data return data
def update(self): def update(self):

View File

@ -261,8 +261,8 @@ class SessionSnapUserOperator(bpy.types.Operator):
target_client = client.get(uuid=self.target_client) target_client = client.get(uuid=self.target_client)
if target_client: if target_client:
rv3d.view_location = target_client.data['location'][0] rv3d.view_matrix = mathutils.Matrix(target_client.data['view_matrix'])
rv3d.view_distance = 30.0 # rv3d.view_distance = 30.0
return {"FINISHED"} return {"FINISHED"}

View File

@ -108,6 +108,7 @@ class User():
self.location = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]] self.location = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]
self.selected_objects = [] self.selected_objects = []
self.last_select_objects = [] self.last_select_objects = []
self.view_matrix = None
def update_location(self): def update_location(self):
current_coords = get_client_cam_points() current_coords = get_client_cam_points()
@ -117,6 +118,11 @@ class User():
if current_coords and self.location != current_coords: if current_coords and self.location != current_coords:
self.location = current_coords self.location = current_coords
matrix_dumper = utils.dump_anything.Dumper()
current_vm = matrix_dumper.dump(rv3d.view_matrix)
if self.view_matrix != current_vm:
self.view_matrix = current_vm
def update_selected_objects(self, context): def update_selected_objects(self, context):
self.selected_objects = utils.get_selected_objects(context.scene) self.selected_objects = utils.get_selected_objects(context.scene)