From cb20c6cb7041048536413d9c6aa6bee72876d296 Mon Sep 17 00:00:00 2001 From: Askill Date: Wed, 5 Jan 2022 13:25:49 +0100 Subject: [PATCH] fixed layer overlay check and increasing layer backoff over time --- Application/Layer.py | 2 +- Application/LayerManager.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Application/Layer.py b/Application/Layer.py index b703628..655d835 100644 --- a/Application/Layer.py +++ b/Application/Layer.py @@ -100,7 +100,7 @@ class Layer: '''Checks for overlap in time between current and given layer''' s1 = self.exportOffset e1 = self.lastFrame - self.startFrame + self.exportOffset - s2 = self.exportOffset + s2 = layer2.exportOffset e2 = layer2.lastFrame - layer2.startFrame + self.exportOffset if s2 >= s1 and s2 <= e1: diff --git a/Application/LayerManager.py b/Application/LayerManager.py index 272cb37..c133c0a 100644 --- a/Application/LayerManager.py +++ b/Application/LayerManager.py @@ -107,10 +107,12 @@ class LayerManager: def calcTimeOffset(self): lenL = len(self.layers) - for i, layer in enumerate(self.layers): + for i in range(1, len(self.layers)): + layer = self.layers[i] print( f"\r {i}/{lenL}", end='\r') overlap = True + tries = 1 while overlap: overlap = False for l in self.layers[:i:-1]: @@ -118,7 +120,8 @@ class LayerManager: overlap = True break if overlap: - self.layers[i].exportOffset += 20 + self.layers[i].exportOffset += 20 * tries + tries += 1 - if self.layers[i].exportOffset >= 30000: + if self.layers[i].exportOffset >= 300000: break