@ -32,6 +32,8 @@ stop_modal_executor = False
|
||||
modal_executor_queue = None
|
||||
|
||||
# OPERATORS
|
||||
|
||||
|
||||
class SessionStartOperator(bpy.types.Operator):
|
||||
bl_idname = "session.start"
|
||||
bl_label = "start"
|
||||
@ -104,8 +106,6 @@ class SessionStartOperator(bpy.types.Operator):
|
||||
"A session is already hosted on this address")
|
||||
return {"CANCELLED"}
|
||||
|
||||
|
||||
|
||||
# Init user settings
|
||||
usr = presence.User(
|
||||
username=settings.username,
|
||||
@ -115,7 +115,7 @@ class SessionStartOperator(bpy.types.Operator):
|
||||
1),
|
||||
)
|
||||
|
||||
settings.user_uuid = client.add(usr,owner=settings.username)
|
||||
settings.user_uuid = client.add(usr, owner=settings.username)
|
||||
client.commit(settings.user_uuid)
|
||||
|
||||
if settings.init_scene and self.host:
|
||||
@ -142,7 +142,7 @@ class SessionStartOperator(bpy.types.Operator):
|
||||
|
||||
global modal_executor_queue
|
||||
modal_executor_queue = queue.Queue()
|
||||
bpy.ops.wm.modal_executor_operator()
|
||||
bpy.ops.session.apply_armature_operator()
|
||||
|
||||
self.report(
|
||||
{'INFO'},
|
||||
@ -163,7 +163,7 @@ class SessionStopOperator(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
global client, delayables, stop_modal_executor
|
||||
|
||||
stop_modal_executor= True
|
||||
stop_modal_executor = True
|
||||
settings = context.window_manager.session
|
||||
settings.is_admin = False
|
||||
assert(client)
|
||||
@ -274,7 +274,8 @@ class SessionSnapUserOperator(bpy.types.Operator):
|
||||
|
||||
target_client = client.get(uuid=self.target_client)
|
||||
if target_client:
|
||||
rv3d.view_matrix = mathutils.Matrix(target_client.data['view_matrix'])
|
||||
rv3d.view_matrix = mathutils.Matrix(
|
||||
target_client.data['view_matrix'])
|
||||
else:
|
||||
return {"CANCELLED"}
|
||||
|
||||
@ -320,9 +321,10 @@ class SessionCommit(bpy.types.Operator):
|
||||
client.push(self.target)
|
||||
return {"FINISHED"}
|
||||
|
||||
class ModalExecutorOperator(bpy.types.Operator):
|
||||
|
||||
class ApplyArmatureOperator(bpy.types.Operator):
|
||||
"""Operator which runs its self from a timer"""
|
||||
bl_idname = "wm.modal_executor_operator"
|
||||
bl_idname = "session.apply_armature_operator"
|
||||
bl_label = "Modal Executor Operator"
|
||||
|
||||
_timer = None
|
||||
@ -344,7 +346,8 @@ class ModalExecutorOperator(bpy.types.Operator):
|
||||
try:
|
||||
client.apply(node)
|
||||
except Exception as e:
|
||||
logger.error("fail to apply {}: {}".format(node_ref.uuid,e))
|
||||
logger.error(
|
||||
"fail to apply {}: {}".format(node_ref.uuid, e))
|
||||
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
@ -371,7 +374,7 @@ classes = (
|
||||
SessionPropertyRightOperator,
|
||||
SessionApply,
|
||||
SessionCommit,
|
||||
ModalExecutorOperator,
|
||||
ApplyArmatureOperator,
|
||||
)
|
||||
|
||||
|
||||
@ -380,6 +383,7 @@ def register():
|
||||
for cls in classes:
|
||||
register_class(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
global client
|
||||
|
||||
@ -391,5 +395,6 @@ def unregister():
|
||||
for cls in reversed(classes):
|
||||
unregister_class(cls)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
Reference in New Issue
Block a user