feat(rcf): cleanup
This commit is contained in:
@ -27,7 +27,7 @@ except:
|
|||||||
import message
|
import message
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
CONNECT_TIMEOUT = 2
|
CONNECT_TIMEOUT = 2
|
||||||
WAITING_TIME = 0.001
|
WAITING_TIME = 0.001
|
||||||
@ -277,7 +277,7 @@ def rcf_client_agent(ctx, pipe,queue):
|
|||||||
# logging.info("{}: received from {}:{},{} {}".format(rcfmsg.key,
|
# logging.info("{}: received from {}:{},{} {}".format(rcfmsg.key,
|
||||||
# server.address, rcfmsg.id, server.port, action))
|
# server.address, rcfmsg.id, server.port, action))
|
||||||
else:
|
else:
|
||||||
logger.info("{} nothing to do".format(agent.id))
|
logger.debug("{} nothing to do".format(agent.id))
|
||||||
|
|
||||||
logger.info("exit thread")
|
logger.info("exit thread")
|
||||||
stop = False
|
stop = False
|
||||||
|
6
draw.py
6
draw.py
@ -133,6 +133,10 @@ class HUD(object):
|
|||||||
clients = self.client.get("Client")
|
clients = self.client.get("Client")
|
||||||
|
|
||||||
for client in clients:
|
for client in clients:
|
||||||
|
name = client[0].split('/')[1]
|
||||||
|
local_username = bpy.context.scene.session_settings.username
|
||||||
|
|
||||||
|
if name != local_username:
|
||||||
try:
|
try:
|
||||||
indices = (
|
indices = (
|
||||||
(1, 3), (2, 1), (3, 0), (2, 0)
|
(1, 3), (2, 1), (3, 0), (2, 0)
|
||||||
@ -141,7 +145,7 @@ class HUD(object):
|
|||||||
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
|
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
|
||||||
position = client[1][b'location']
|
position = client[1][b'location']
|
||||||
color = client[1][b'color']
|
color = client[1][b'color']
|
||||||
name = client[0].split('/')[1]
|
|
||||||
batch = batch_for_shader(
|
batch = batch_for_shader(
|
||||||
shader, 'LINES', {"pos": position}, indices=indices)
|
shader, 'LINES', {"pos": position}, indices=indices)
|
||||||
|
|
||||||
|
18
operators.py
18
operators.py
@ -68,24 +68,12 @@ def upload_client_instance_position():
|
|||||||
if client_instance:
|
if client_instance:
|
||||||
|
|
||||||
key = "Client/{}".format(username)
|
key = "Client/{}".format(username)
|
||||||
# key = "Object/Cube"
|
|
||||||
print(key)
|
|
||||||
try:
|
try:
|
||||||
current_coords = draw.get_client_view_rect()
|
current_coords = draw.get_client_view_rect()
|
||||||
client = client_instance.get(key)
|
client = client_instance.get(key)
|
||||||
# print((client[0][1][b'location']))
|
|
||||||
|
|
||||||
|
|
||||||
# if data is None:
|
|
||||||
# data = {}
|
|
||||||
# data['location'] = current_coords
|
|
||||||
# color = bpy.context.scene.session_settings.client_instance_color
|
|
||||||
# data['color'] = (color.r, color.g, color.b, 1)
|
|
||||||
# client_instance.push_update(key, 'client_instance', data)
|
|
||||||
if current_coords != client[0][1][b'location']:
|
if current_coords != client[0][1][b'location']:
|
||||||
print(current_coords)
|
|
||||||
print(client[0][1][b'location'])
|
|
||||||
# client[0][1][b'color'] = [0,1,1,1]
|
|
||||||
client[0][1][b'location'] = current_coords
|
client[0][1][b'location'] = current_coords
|
||||||
client_instance.set(key, client[0][1])
|
client_instance.set(key, client[0][1])
|
||||||
except:
|
except:
|
||||||
@ -153,7 +141,7 @@ def draw_tick():
|
|||||||
# refresh_window()
|
# refresh_window()
|
||||||
# Upload
|
# Upload
|
||||||
upload_client_instance_position()
|
upload_client_instance_position()
|
||||||
return 1
|
return .2
|
||||||
|
|
||||||
|
|
||||||
def register_ticks():
|
def register_ticks():
|
||||||
@ -384,7 +372,7 @@ class session_snapview(bpy.types.Operator):
|
|||||||
bl_description = "Description that shows in blender tooltips"
|
bl_description = "Description that shows in blender tooltips"
|
||||||
bl_options = {"REGISTER"}
|
bl_options = {"REGISTER"}
|
||||||
|
|
||||||
target_client_instance = bpy.props.StringProperty()
|
target_client = bpy.props.StringProperty()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
|
Reference in New Issue
Block a user