refactor: move unlock/lock/kick to porcelain
This commit is contained in:
parent
431fe0d840
commit
c9665c4719
@ -1 +1 @@
|
||||
Subproject commit 15d80abe6ddd28fefb896127a01c12777a22a4e1
|
||||
Subproject commit baa55ea8c410af037724c99184d54b45724df69b
|
@ -221,7 +221,12 @@ class SessionStartOperator(bpy.types.Operator):
|
||||
for scene in bpy.data.scenes:
|
||||
porcelain.add(repo, scene)
|
||||
|
||||
porcelain.remote_add(repo, 'origin','127.0.0.1', settings.port)
|
||||
porcelain.remote_add(
|
||||
repo,
|
||||
'origin',
|
||||
'127.0.0.1',
|
||||
settings.port,
|
||||
admin_password=admin_pass)
|
||||
session.host(
|
||||
repository= repo,
|
||||
remote='origin',
|
||||
@ -243,7 +248,12 @@ class SessionStartOperator(bpy.types.Operator):
|
||||
admin_pass = None
|
||||
|
||||
try:
|
||||
porcelain.remote_add(repo, 'origin', settings.ip, settings.port)
|
||||
porcelain.remote_add(
|
||||
repo,
|
||||
'origin',
|
||||
settings.ip,
|
||||
settings.port,
|
||||
admin_password=admin_pass)
|
||||
session.connect(
|
||||
repository= repo,
|
||||
timeout=settings.connection_timeout,
|
||||
@ -257,10 +267,7 @@ class SessionStartOperator(bpy.types.Operator):
|
||||
deleyables.append(timers.ClientUpdate())
|
||||
deleyables.append(timers.DynamicRightSelectTimer())
|
||||
deleyables.append(timers.ApplyTimer(timeout=settings.depsgraph_update_rate))
|
||||
# deleyables.append(timers.PushTimer(
|
||||
# queue=stagging,
|
||||
# timeout=settings.depsgraph_update_rate
|
||||
# ))
|
||||
|
||||
session_update = timers.SessionStatusUpdate()
|
||||
session_user_sync = timers.SessionUserSync()
|
||||
session_background_executor = timers.MainThreadExecutor(
|
||||
@ -365,7 +372,7 @@ class SessionKickOperator(bpy.types.Operator):
|
||||
assert(session)
|
||||
|
||||
try:
|
||||
session.kick(self.user)
|
||||
porcelain.kick(session.repository, self.user)
|
||||
except Exception as e:
|
||||
self.report({'ERROR'}, repr(e))
|
||||
|
||||
|
@ -161,11 +161,10 @@ class DynamicRightSelectTimer(Timer):
|
||||
self._annotating = True
|
||||
logging.debug(
|
||||
"Getting the right on the annotation GP")
|
||||
session.change_owner(
|
||||
registered_gp.uuid,
|
||||
settings.username,
|
||||
ignore_warnings=True,
|
||||
affect_dependencies=False)
|
||||
porcelain.lock(session.repository,
|
||||
registered_gp.uuid,
|
||||
ignore_warnings=True,
|
||||
affect_dependencies=False)
|
||||
|
||||
if registered_gp.owner == settings.username:
|
||||
gp_node = session.repository.get_node(annotation_gp.uuid)
|
||||
@ -173,11 +172,10 @@ class DynamicRightSelectTimer(Timer):
|
||||
porcelain.push(session.repository, 'origin', gp_node.uuid)
|
||||
|
||||
elif self._annotating:
|
||||
session.change_owner(
|
||||
registered_gp.uuid,
|
||||
RP_COMMON,
|
||||
ignore_warnings=True,
|
||||
affect_dependencies=False)
|
||||
porcelain.unlock(session.repository,
|
||||
registered_gp.uuid,
|
||||
ignore_warnings=True,
|
||||
affect_dependencies=False)
|
||||
|
||||
current_selection = utils.get_selected_objects(
|
||||
bpy.context.scene,
|
||||
@ -198,11 +196,10 @@ class DynamicRightSelectTimer(Timer):
|
||||
if node.data and 'instance_type' in node.data.keys():
|
||||
recursive = node.data['instance_type'] != 'COLLECTION'
|
||||
try:
|
||||
session.change_owner(
|
||||
node.uuid,
|
||||
RP_COMMON,
|
||||
ignore_warnings=True,
|
||||
affect_dependencies=recursive)
|
||||
porcelain.unlock(session.repository,
|
||||
node.uuid,
|
||||
ignore_warnings=True,
|
||||
affect_dependencies=recursive)
|
||||
except NonAuthorizedOperationError:
|
||||
logging.warning(
|
||||
f"Not authorized to change {node} owner")
|
||||
@ -217,11 +214,10 @@ class DynamicRightSelectTimer(Timer):
|
||||
recursive = node.data['instance_type'] != 'COLLECTION'
|
||||
|
||||
try:
|
||||
session.change_owner(
|
||||
node.uuid,
|
||||
settings.username,
|
||||
ignore_warnings=True,
|
||||
affect_dependencies=recursive)
|
||||
porcelain.lock(session.repository,
|
||||
node.uuid,
|
||||
ignore_warnings=True,
|
||||
affect_dependencies=recursive)
|
||||
except NonAuthorizedOperationError:
|
||||
logging.warning(
|
||||
f"Not authorized to change {node} owner")
|
||||
@ -244,11 +240,10 @@ class DynamicRightSelectTimer(Timer):
|
||||
for key in owned_keys:
|
||||
node = session.repository.get_node(key)
|
||||
try:
|
||||
session.change_owner(
|
||||
key,
|
||||
RP_COMMON,
|
||||
ignore_warnings=True,
|
||||
affect_dependencies=recursive)
|
||||
porcelain.unlock(session.repository,
|
||||
key,
|
||||
ignore_warnings=True,
|
||||
affect_dependencies=recursive)
|
||||
except NonAuthorizedOperationError:
|
||||
logging.warning(
|
||||
f"Not authorized to change {key} owner")
|
||||
|
Loading…
Reference in New Issue
Block a user