diff --git a/client.py b/client.py index 3ee7619..0718207 100644 --- a/client.py +++ b/client.py @@ -256,6 +256,16 @@ def rcf_client_agent(ctx, pipe,queue): if agent.state == State.SYNCING: # Store snapshot if rcfmsg.key == "SNAPSHOT_END": + client_key = "Client/{}".format(agent.id.decode()) + + client_dict = {} + client_dict['location'] = [[0,0,0],[0,0,0],[0,0,0],[0,0,0]] + client_dict['color'] = [0,1,1,1] + client_dict['active_object'] = '' + client_store = message.RCFMessage(key=client_key, id=agent.id.decode(),body=client_dict) + logger.info(client_store) + client_store.store(agent.property_map) + logger.info("snapshot complete") agent.state = State.ACTIVE else: diff --git a/draw.py b/draw.py index 27c0d3c..e7ee189 100644 --- a/draw.py +++ b/draw.py @@ -135,7 +135,7 @@ class HUD(object): for client in clients: name = client[0].split('/')[1] local_username = bpy.context.scene.session_settings.username - + if name != local_username: try: indices = ( @@ -143,8 +143,8 @@ class HUD(object): ) shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR') - position = client[1][b'location'] - color = client[1][b'color'] + position = client[1]['location'] + color = client[1]['color'] batch = batch_for_shader( shader, 'LINES', {"pos": position}, indices=indices) diff --git a/helpers.py b/helpers.py index 17b3645..6081b07 100644 --- a/helpers.py +++ b/helpers.py @@ -42,7 +42,7 @@ def load(key, value): load_default(target=target, data=value, create=True, type=target_type) elif target_type == 'Client': - pass + load_client(key.split('/')[1],value) def resolve_bpy_path(path): @@ -60,7 +60,15 @@ def resolve_bpy_path(path): return item +def load_client(client=None,data=None): + if client and data: + # Draw client + #Load selected object + if data['active_object']: + print("toto") + pass + def load_mesh(target=None, data=None, create=False): import bmesh diff --git a/operators.py b/operators.py index eecd212..9f22a1c 100644 --- a/operators.py +++ b/operators.py @@ -73,8 +73,8 @@ def upload_client_instance_position(): current_coords = draw.get_client_view_rect() client = client_instance.get(key) - if current_coords != client[0][1][b'location']: - client[0][1][b'location'] = current_coords + if current_coords != client[0][1]['location']: + client[0][1]['location'] = current_coords client_instance.set(key, client[0][1]) except: pass diff --git a/server.py b/server.py index 35bdb74..b261924 100644 --- a/server.py +++ b/server.py @@ -66,18 +66,18 @@ class RCFServerAgent(): request = msg[1] if request == b"SNAPSHOT_REQUEST": - client_key = "Client/{}".format(identity.decode()) + # client_key = "Client/{}".format(identity.decode()) - if client_key not in self.property_map.keys(): - logger.info("New user:{}".format(identity.decode())) + # if client_key not in self.property_map.keys(): + # logger.info("New user:{}".format(identity.decode())) - client_dict = {} - client_dict['location'] = [[0,0,0],[0,0,0],[0,0,0],[0,0,0]] - client_dict['color'] = [0,1,1,1] - client_dict['active_object'] = '' - client_store = message.RCFMessage(key=client_key, id=identity,body=client_dict) - logger.info(client_store) - client_store.store(self.property_map) + # client_dict = {} + # client_dict['location'] = [[0,0,0],[0,0,0],[0,0,0],[0,0,0]] + # client_dict['color'] = [0,1,1,1] + # client_dict['active_object'] = '' + # client_store = message.RCFMessage(key=client_key, id=identity,body=client_dict) + # logger.info(client_store) + # client_store.store(self.property_map) pass else: logger.info("Bad snapshot request")