diff --git a/multi_user/__init__.py b/multi_user/__init__.py index 3a8181d..e9c7d2a 100644 --- a/multi_user/__init__.py +++ b/multi_user/__init__.py @@ -66,9 +66,11 @@ def register(): environment.setup(DEPENDENCIES, python_binary_path) - if LIBS in sys.path: - logging.debug('Third party module already added') - else: + for module_name in list(sys.modules.keys()): + if 'replication' in module_name: + del sys.modules[module_name] + + if LIBS not in sys.path: logging.info('Adding local modules dir to the path') sys.path.insert(0, LIBS) diff --git a/multi_user/bl_types/bl_curve.py b/multi_user/bl_types/bl_curve.py index 4c03849..c8039a2 100644 --- a/multi_user/bl_types/bl_curve.py +++ b/multi_user/bl_types/bl_curve.py @@ -243,6 +243,6 @@ class BlCurve(BlDatablock): def diff(self): if 'EDIT' in bpy.context.mode \ and not self.preferences.sync_flags.sync_during_editmode: - return False + return None else: return super().diff() \ No newline at end of file diff --git a/multi_user/bl_types/bl_file.py b/multi_user/bl_types/bl_file.py index 26400c3..8c110a2 100644 --- a/multi_user/bl_types/bl_file.py +++ b/multi_user/bl_types/bl_file.py @@ -135,7 +135,15 @@ class BlFile(ReplicatedDatablock): return False else: if not self.instance: - return False + return None + + if not self.data: + return super().diff() + memory_size = sys.getsizeof(self.data['file'])-33 disk_size = self.instance.stat().st_size - return memory_size != disk_size + + if memory_size != disk_size: + return super().diff() + else: + return None diff --git a/multi_user/bl_types/bl_gpencil.py b/multi_user/bl_types/bl_gpencil.py index 02b55d6..9c27692 100644 --- a/multi_user/bl_types/bl_gpencil.py +++ b/multi_user/bl_types/bl_gpencil.py @@ -305,10 +305,11 @@ class BlGpencil(BlDatablock): return bpy.context.scene.frame_current != self.data["eval_frame"] def diff(self): - if self.layer_changed() \ + if not self.data \ + or self.layer_changed() \ or self.frame_changed() \ or bpy.context.mode == 'OBJECT' \ or self.preferences.sync_flags.sync_during_editmode: return super().diff() else: - return False + return None diff --git a/multi_user/bl_types/bl_image.py b/multi_user/bl_types/bl_image.py index 901a201..c33b40a 100644 --- a/multi_user/bl_types/bl_image.py +++ b/multi_user/bl_types/bl_image.py @@ -99,11 +99,11 @@ class BlImage(BlDatablock): def diff(self): if self.instance.is_dirty: self.instance.save() - - if self.instance and (self.instance.name != self.data['name']): - return True + + if not self.data or (self.instance and (self.instance.name != self.data['name'])): + return super().diff() else: - return False + return None def _resolve_deps_implementation(self): deps = [] diff --git a/multi_user/bl_types/bl_scene.py b/multi_user/bl_types/bl_scene.py index 94225b8..9538606 100644 --- a/multi_user/bl_types/bl_scene.py +++ b/multi_user/bl_types/bl_scene.py @@ -555,4 +555,13 @@ class BlScene(BlDatablock): if not self.preferences.sync_flags.sync_active_camera: exclude_path.append("root['camera']") - return Delta(DeepDiff(self.data, self._dump(instance=self.instance), exclude_paths=exclude_path)) + diff_params = { + 'exclude_paths':exclude_path, + 'ignore_order':True, + 'report_repetition':True + } + delta_params = { + 'mutate':True + } + return super().diff(diff_params=diff_params) + # return Delta(DeepDiff(self.data, self._dump(instance=self.instance),)) diff --git a/multi_user/libs/replication b/multi_user/libs/replication index 553f3d4..4412cc2 160000 --- a/multi_user/libs/replication +++ b/multi_user/libs/replication @@ -1 +1 @@ -Subproject commit 553f3d43b59aad9e695266d95abba8e8307f2123 +Subproject commit 4412cc2aa01982be64c46b09f6fbf674bfec3c4c