parent
bd27da7aa6
commit
8f97091118
@ -20,6 +20,10 @@ from . import bl_types, delayable, environment, presence, ui, utils
|
||||
from .libs.replication.replication.data import ReplicatedDataFactory
|
||||
from .libs.replication.replication.exception import NonAuthorizedOperationError
|
||||
from .libs.replication.replication.interface import Session
|
||||
from .libs.replication.replication.constants import (
|
||||
STATE_ACTIVE,
|
||||
STATE_INITIAL,
|
||||
STATE_SYNCING)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.setLevel(logging.ERROR)
|
||||
@ -335,6 +339,12 @@ classes = (
|
||||
SessionApply,
|
||||
SessionCommit,
|
||||
)
|
||||
@persistent
|
||||
def load_pre_handler(dummy):
|
||||
global client
|
||||
|
||||
if client and client.state in [STATE_ACTIVE, STATE_SYNCING]:
|
||||
bpy.ops.session.stop()
|
||||
|
||||
|
||||
def register():
|
||||
@ -342,6 +352,8 @@ def register():
|
||||
for cls in classes:
|
||||
register_class(cls)
|
||||
|
||||
bpy.app.handlers.load_pre.append(load_pre_handler)
|
||||
|
||||
def unregister():
|
||||
global client
|
||||
|
||||
@ -353,5 +365,7 @@ def unregister():
|
||||
for cls in reversed(classes):
|
||||
unregister_class(cls)
|
||||
|
||||
bpy.app.handlers.load_pre.remove(load_pre_handler)
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
Loading…
x
Reference in New Issue
Block a user