refactor(rcf):hide draw
This commit is contained in:
@ -10,7 +10,7 @@ import struct
|
|||||||
import collections
|
import collections
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
class RCFFactory(object):
|
class RCFFactory(object):
|
||||||
@ -240,7 +240,7 @@ class Client():
|
|||||||
for f in self.on_recv:
|
for f in self.on_recv:
|
||||||
f(rcfmsg)
|
f(rcfmsg)
|
||||||
else:
|
else:
|
||||||
await asyncio.sleep(0.001)
|
await asyncio.sleep(0.0001)
|
||||||
|
|
||||||
def push_update(self, key, mtype, body):
|
def push_update(self, key, mtype, body):
|
||||||
rcfmsg = RCFMessage(key, self.id, mtype, body)
|
rcfmsg = RCFMessage(key, self.id, mtype, body)
|
||||||
@ -333,7 +333,7 @@ class Server():
|
|||||||
msg.store(self.property_map)
|
msg.store(self.property_map)
|
||||||
msg.send(self.pub_sock)
|
msg.send(self.pub_sock)
|
||||||
else:
|
else:
|
||||||
await asyncio.sleep(0.001)
|
await asyncio.sleep(0.0001)
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
logger.debug("Stopping server")
|
logger.debug("Stopping server")
|
||||||
|
@ -136,7 +136,7 @@ def match_supported_types(value):
|
|||||||
|
|
||||||
# TODO: Less ugly method
|
# TODO: Less ugly method
|
||||||
def from_bpy(value):
|
def from_bpy(value):
|
||||||
logger.debug(' casting from bpy')
|
# logger.debug(' casting from bpy')
|
||||||
value_type = type(value)
|
value_type = type(value)
|
||||||
value_casted = None
|
value_casted = None
|
||||||
|
|
||||||
@ -176,14 +176,15 @@ def resolve_bpy_path(path):
|
|||||||
|
|
||||||
obj = None
|
obj = None
|
||||||
attribute = path[2]
|
attribute = path[2]
|
||||||
logger.debug("resolving {}".format(path))
|
# logger.debug("resolving {}".format(path))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
obj = getattr(bpy.data, path[0])[path[1]]
|
obj = getattr(bpy.data, path[0])[path[1]]
|
||||||
attribute = getattr(obj, path[2])
|
attribute = getattr(obj, path[2])
|
||||||
logger.debug("done {} : {}".format(obj, attribute))
|
# logger.debug("done {} : {}".format(obj, attribute))
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
logger.debug(" Attribute not found")
|
pass
|
||||||
|
# logger.debug(" Attribute not found")
|
||||||
|
|
||||||
return obj, attribute
|
return obj, attribute
|
||||||
|
|
||||||
@ -241,14 +242,15 @@ def update_scene(msg):
|
|||||||
|
|
||||||
value = to_bpy(msg)
|
value = to_bpy(msg)
|
||||||
# print(msg.get)
|
# print(msg.get)
|
||||||
logger.debug("Updating scene:\n object: {} attribute: {} , value: {}".format(
|
# logger.debug("Updating scene:\n object: {} attribute: {} , value: {}".format(
|
||||||
obj, attr_name, value))
|
# obj, attr_name, value))
|
||||||
|
|
||||||
setattr(obj, attr_name, value)
|
setattr(obj, attr_name, value)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
logger.debug('no need to update scene on our own')
|
pass
|
||||||
|
# logger.debug('no need to update scene on our own')
|
||||||
|
|
||||||
|
|
||||||
def update_ui(msg):
|
def update_ui(msg):
|
||||||
@ -463,7 +465,7 @@ class session_draw_clients(bpy.types.Operator):
|
|||||||
self.draw2d_callback, (), 'WINDOW', 'POST_PIXEL')
|
self.draw2d_callback, (), 'WINDOW', 'POST_PIXEL')
|
||||||
|
|
||||||
self.draw_event = context.window_manager.event_timer_add(
|
self.draw_event = context.window_manager.event_timer_add(
|
||||||
0.01, window=context.window)
|
0.008, window=context.window)
|
||||||
|
|
||||||
def unregister_handlers(self, context):
|
def unregister_handlers(self, context):
|
||||||
if self.draw_event and self.draw3d_handle and self.draw2d_handle:
|
if self.draw_event and self.draw3d_handle and self.draw2d_handle:
|
||||||
|
Reference in New Issue
Block a user