fix(rcf): user data initialisation is now client side
This commit is contained in:
10
client.py
10
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:
|
||||
|
4
draw.py
4
draw.py
@ -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)
|
||||
|
10
helpers.py
10
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,6 +60,14 @@ 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
|
||||
|
@ -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
|
||||
|
20
server.py
20
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")
|
||||
|
Reference in New Issue
Block a user