refactor: get diff back for testing

This commit is contained in:
Swann 2021-05-10 12:04:45 +02:00
parent a67be76422
commit b045911a59
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
7 changed files with 34 additions and 14 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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 = []

View File

@ -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),))

@ -1 +1 @@
Subproject commit 553f3d43b59aad9e695266d95abba8e8307f2123
Subproject commit 4412cc2aa01982be64c46b09f6fbf674bfec3c4c