fix: owning parent when a child is already owned (ex: duplicate linked)

This commit is contained in:
Swann 2020-10-21 14:15:42 +02:00
parent 7ee705332f
commit 804747c73b
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
4 changed files with 14 additions and 10 deletions

View File

@ -44,7 +44,7 @@ from . import environment
DEPENDENCIES = {
("replication", '0.1.4'),
("replication", '0.1.5'),
}

View File

@ -92,7 +92,6 @@ def load_driver(target_datablock, src_driver):
def get_datablock_from_uuid(uuid, default, ignore=[]):
if not uuid:
return default
for category in dir(bpy.data):
root = getattr(bpy.data, category)
if isinstance(root, Iterable) and category not in ignore:
@ -123,7 +122,7 @@ class BlDatablock(ReplicatedDatablock):
# TODO: use is_library_indirect
self.is_library = (instance and hasattr(instance, 'library') and
instance.library) or \
(self.data and 'library' in self.data)
(hasattr(self,'data') and self.data and 'library' in self.data)
if instance and hasattr(instance, 'uuid'):
instance.uuid = self.uuid

View File

@ -171,7 +171,8 @@ class DynamicRightSelectTimer(Timer):
session.change_owner(
node.uuid,
RP_COMMON,
recursive=recursive)
ignore_warnings=True,
affect_dependencies=recursive)
except NonAuthorizedOperationError:
logging.warning(f"Not authorized to change {node} owner")
@ -188,7 +189,8 @@ class DynamicRightSelectTimer(Timer):
session.change_owner(
node.uuid,
settings.username,
recursive=recursive)
ignore_warnings=True,
affect_dependencies=recursive)
except NonAuthorizedOperationError:
logging.warning(f"Not authorized to change {node} owner")
else:
@ -213,7 +215,8 @@ class DynamicRightSelectTimer(Timer):
session.change_owner(
key,
RP_COMMON,
recursive=recursive)
ignore_warnings=True,
affect_dependencies=recursive)
except NonAuthorizedOperationError:
logging.warning(f"Not authorized to change {key} owner")

View File

@ -226,7 +226,8 @@ class SessionStartOperator(bpy.types.Operator):
except Exception as e:
self.report({'ERROR'}, repr(e))
logging.error(f"Error: {e}")
import traceback
traceback.print_exc()
# Join a session
else:
if not runtime_settings.admin:
@ -424,9 +425,10 @@ class SessionPropertyRightOperator(bpy.types.Operator):
runtime_settings = context.window_manager.session
if session:
session.change_owner(self.key,
runtime_settings.clients,
recursive=self.recursive)
session.affect_dependencies(self.key,
runtime_settings.clients,
ignore_warnings=True,
affect_dependencies=self.recursive)
return {"FINISHED"}