Browse Source

Don't discard user data when setting or deleting steps in a multiplicator-measure.

master
Nils 2 years ago
parent
commit
62823b4072
  1. 6
      engine/api.py

6
engine/api.py

@ -1340,10 +1340,12 @@ def setStep(trackId, stepExportDict):
This function checks if the new step is within the limits of the current sounding pattern
and will prevent changes or additions outside the current limits.
"""
track = session.data.trackById(trackId)
if not track: return
inRange = stepExportDict["index"] < session.data.howManyUnits and stepExportDict["pitch"] < track.pattern.numberOfSteps
#index is from 0 and howManyUnits*Multp is from 1 (because it is length), so we just need <, and not <=.
inRange = stepExportDict["index"] < session.data.howManyUnits*track.patternLengthMultiplicator and stepExportDict["pitch"] < track.pattern.numberOfSteps
if not inRange: return
session.history.register(lambda trId=trackId, v=track.pattern.copyData(): setPattern(trId, v, "Change Step"), descriptionString="Change Step")
@ -1365,7 +1367,7 @@ def removeStep(trackId, index, pitch):
track = session.data.trackById(trackId)
if not track: return
inRange = index < session.data.howManyUnits and pitch < track.pattern.numberOfSteps
inRange = index < session.data.howManyUnits*track.patternLengthMultiplicator and pitch < track.pattern.numberOfSteps
if not inRange: return
session.history.register(lambda trId=trackId, v=track.pattern.copyData(): setPattern(trId, v, "Remove Step"), descriptionString="Remove Step")

Loading…
Cancel
Save