Browse Source

fix spltiting of already split notes. They didn't remember their parent block

master
Nils 2 months ago
parent
commit
25a12ef3f1
  1. 6
      engine/items.py

6
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):

Loading…
Cancel
Save