fix: session quit on server lost
This commit is contained in:
parent
8b7716ac3c
commit
ece88f3dda
@ -194,6 +194,7 @@ class DrawClient(Draw):
|
||||
def execute(self):
|
||||
session = getattr(operators, 'client', None)
|
||||
renderer = getattr(presence, 'renderer', None)
|
||||
|
||||
if session and renderer:
|
||||
settings = bpy.context.window_manager.session
|
||||
users = session.online_users
|
||||
@ -220,6 +221,10 @@ class ClientUpdate(Timer):
|
||||
renderer = getattr(presence, 'renderer', None)
|
||||
|
||||
if session and renderer:
|
||||
# Check if session has been closes prematurely
|
||||
if session.state == 0:
|
||||
bpy.ops.session.stop()
|
||||
|
||||
local_user = operators.client.online_users.get(
|
||||
session_info.username)
|
||||
if not local_user:
|
||||
|
@ -155,8 +155,12 @@ class DrawFactory(object):
|
||||
self.register_handlers()
|
||||
|
||||
def stop(self):
|
||||
self.flush_users()
|
||||
self.flush_selection()
|
||||
self.unregister_handlers()
|
||||
|
||||
refresh_3d_view()
|
||||
|
||||
def register_handlers(self):
|
||||
self.draw3d_handle = bpy.types.SpaceView3D.draw_handler_add(
|
||||
self.draw3d_callback, (), 'WINDOW', 'POST_VIEW')
|
||||
|
Loading…
Reference in New Issue
Block a user