From 25a12ef3f1085be92de17f23718cbcfb7f3b2cd9 Mon Sep 17 00:00:00 2001 From: Nils Date: Tue, 26 Jul 2022 23:30:01 +0200 Subject: [PATCH] fix spltiting of already split notes. They didn't remember their parent block --- engine/items.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/items.py b/engine/items.py index 50a464e..8390970 100644 --- a/engine/items.py +++ b/engine/items.py @@ -1384,6 +1384,9 @@ class Chord(Item): #newTicks = complDur / newparts note.duration = Duration.createByGuessing(Fraction(complDur, newparts)) + #Cache it now, so it is correct for all copies created below + self.durationGroup.cacheMinimumNote() + #Now we have one note with the duration the user wants to have. Make n-1 copies- spawnedNotes = [] for block in self.parentBlocks: #weakrefs are not iterators and not iterable. So next() does not work and [x] does not work. for loop has to do. @@ -1395,7 +1398,9 @@ class Chord(Item): c = self.copy() spawnedNotes.append(c) + block.data.insert(currentIndexInBlock+1, c) #add each new item after the original one. + c.parentBlocks.add(block) break #we only need one block since the data is the same in all blocks. def _undoSplit(): @@ -1408,7 +1413,6 @@ class Chord(Item): return lambda: self.split(newparts, _existingCopies = spawnedNotes) - self.durationGroup.cacheMinimumNote() return _undoSplit def augment(self):