Browse Source

use track instead of score as parent when joining blocks

master
Nils 3 years ago
parent
commit
cceb9c49bf
  1. 6
      engine/main.py

6
engine/main.py

@ -477,6 +477,7 @@ class Data(template.engine.sequencer.Score):
#assert parentBlock, item
#assert parentBlock.parentTrack, (parentBlock, parentBlock.parentTrack)
if parentBlock.parentTrack:
assert parentBlock.parentTrack in self.tracks, (parentBlock.parentTrack, id(parentBlock.parentTrack), hex(id(parentBlock.parentTrack)))
listOfChangedTrackIds.add(id(parentBlock.parentTrack)) #there are items without parent Tracks. They have None. We must filter them out otherwise our changedTrackIds get polluted with id(None)
else:
continue
@ -488,7 +489,6 @@ class Data(template.engine.sequencer.Score):
track.toPosition(originalPosition) #has head() in it
finalResult.append(result)
#hier weiter machen. Die ids gehen durcheinander. Es ist nicht nur der assert check. Wenn wir das weglassen kommt das Problem später
for changedTrId in listOfChangedTrackIds: #It is not the track ids that change but tracks changed and these are their IDs:
assert self.trackById(changedTrId) in self.tracks, changedTrId #selecting from hidden or deleted tracks is impossible
@ -641,7 +641,6 @@ class Data(template.engine.sequencer.Score):
Will only delete from visible tracks. No hidden, no deleted.
"""
validSelection, topLeftCursor, bottomRightCursor, listOfChangedTrackIds, *selectedTracksAndItems = self.listOfSelectedItems(removeContentLinkedData = True)
#selectedTracksAndItems format: [track1[(item, itsKeysig), (item, itsKeysig), (item, itsKeysig)], track2[(item, itsKeysig), (item, itsKeysig), (item, itsKeysig)]]
@ -921,11 +920,12 @@ class Data(template.engine.sequencer.Score):
#we now have made it clear that the requirements from the docstring are met.
dictOfTrackIdsWithListOfBlockIds = {}
protoBlock = startBlock.copy(newParentTrack = self)
protoBlock = startBlock.copy(newParentTrack = self.currentTrack())
protoBlock.data += startFollowUpBlock.data
for firstBlock, secondBlock in workingList:
parentTrackId = id(firstBlock.parentTrack)
assert firstBlock.parentTrack in self.tracks, (firstBlock.parentTrack, id(firstBlock.parentTrack), hex(id(firstBlock.parentTrack)))
if parentTrackId in dictOfTrackIdsWithListOfBlockIds:
blockOrder = dictOfTrackIdsWithListOfBlockIds[parentTrackId]

Loading…
Cancel
Save