refactor: cleanup connction operator
This commit is contained in:
Submodule multi_user/libs/replication updated: 9592cf90ab...88c4f065fc
@ -78,6 +78,7 @@ class SessionStartOperator(bpy.types.Operator):
|
|||||||
settings = utils.get_preferences()
|
settings = utils.get_preferences()
|
||||||
runtime_settings = context.window_manager.session
|
runtime_settings = context.window_manager.session
|
||||||
users = bpy.data.window_managers['WinMan'].online_users
|
users = bpy.data.window_managers['WinMan'].online_users
|
||||||
|
admin_pass = runtime_settings.password
|
||||||
|
|
||||||
# TODO: Sync server clients
|
# TODO: Sync server clients
|
||||||
users.clear()
|
users.clear()
|
||||||
@ -124,7 +125,6 @@ class SessionStartOperator(bpy.types.Operator):
|
|||||||
scene_uuid = client.add(scene)
|
scene_uuid = client.add(scene)
|
||||||
client.commit(scene_uuid)
|
client.commit(scene_uuid)
|
||||||
|
|
||||||
pwd = runtime_settings.password if runtime_settings.password else None
|
|
||||||
if self.host:
|
if self.host:
|
||||||
try:
|
try:
|
||||||
client.host(
|
client.host(
|
||||||
@ -133,7 +133,7 @@ class SessionStartOperator(bpy.types.Operator):
|
|||||||
port=settings.port,
|
port=settings.port,
|
||||||
ipc_port=settings.ipc_port,
|
ipc_port=settings.ipc_port,
|
||||||
timeout=settings.connection_timeout,
|
timeout=settings.connection_timeout,
|
||||||
password=pwd
|
password=admin_pass
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.report({'ERROR'}, repr(e))
|
self.report({'ERROR'}, repr(e))
|
||||||
@ -141,9 +141,10 @@ class SessionStartOperator(bpy.types.Operator):
|
|||||||
|
|
||||||
# Join a session
|
# Join a session
|
||||||
else:
|
else:
|
||||||
if pwd is None:
|
if not runtime_settings.admin:
|
||||||
utils.clean_scene()
|
utils.clean_scene()
|
||||||
|
# regular client, no password needed
|
||||||
|
admin_pass = None
|
||||||
try:
|
try:
|
||||||
client.connect(
|
client.connect(
|
||||||
id=settings.username,
|
id=settings.username,
|
||||||
@ -151,7 +152,7 @@ class SessionStartOperator(bpy.types.Operator):
|
|||||||
port=settings.port,
|
port=settings.port,
|
||||||
ipc_port=settings.ipc_port,
|
ipc_port=settings.ipc_port,
|
||||||
timeout=settings.connection_timeout,
|
timeout=settings.connection_timeout,
|
||||||
password=pwd
|
password=admin_pass
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.report({'ERROR'}, repr(e))
|
self.report({'ERROR'}, repr(e))
|
||||||
|
Reference in New Issue
Block a user