diff --git a/source/funkin/data/song/SongDataUtils.hx b/source/funkin/data/song/SongDataUtils.hx index b149a8855..9a9f758b1 100644 --- a/source/funkin/data/song/SongDataUtils.hx +++ b/source/funkin/data/song/SongDataUtils.hx @@ -70,10 +70,7 @@ class SongDataUtils { // The currently iterated note is in the subtrahend array. // SongNoteData's == operation has been overridden so that this will work. - if (x == note) - { - return false; - } + if (x == note) return false; } return true; @@ -94,8 +91,13 @@ class SongDataUtils if (events.length == 0 || subtrahend.length == 0) return events; return events.filter(function(event:SongEventData):Bool { - // SongEventData's == operation has been overridden so that this will work. - return !subtrahend.has(event); + for (x in subtrahend) + { + // The currently iterated event is in the subtrahend array. + // SongEventData's == operation has been overridden so that this will work. + if (x == event) return false; + } + return true; }); } diff --git a/source/funkin/ui/debug/charting/commands/MoveEventsCommand.hx b/source/funkin/ui/debug/charting/commands/MoveEventsCommand.hx index 09b81c4d3..efe9c25d5 100644 --- a/source/funkin/ui/debug/charting/commands/MoveEventsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/MoveEventsCommand.hx @@ -15,7 +15,7 @@ class MoveEventsCommand implements ChartEditorCommand var movedEvents:Array; var offset:Float; - public function new(notes:Array, offset:Float) + public function new(events:Array, offset:Float) { // Clone the notes to prevent editing from affecting the history. this.events = [for (event in events) event.clone()]; @@ -38,6 +38,7 @@ class MoveEventsCommand implements ChartEditorCommand movedEvents.push(resultEvent); } + state.currentSongChartEventData = SongDataUtils.subtractEvents(state.currentSongChartEventData, events); state.currentSongChartEventData = state.currentSongChartEventData.concat(movedEvents); state.currentEventSelection = movedEvents; diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorImportExportHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorImportExportHandler.hx index ce04084c6..624f5f228 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorImportExportHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorImportExportHandler.hx @@ -366,17 +366,24 @@ class ChartEditorImportExportHandler var targetMode:FileWriteMode = Force; if (targetPath == null) { + // Force writing to a generic path (autosave or crash recovery) targetMode = Skip; targetPath = Path.join([ './backups/', 'chart-editor-${DateUtil.generateTimestamp()}.${Constants.EXT_CHART}' ]); + // We have to force write because the program will die before the save dialog is closed. + trace('Force exporting to $targetPath...'); + FileUtil.saveFilesAsZIPToPath(zipEntries, targetPath, targetMode); + // state.saveDataDirty = false; // Don't edit the saveData flag because the app might be closing. + } + else + { + // Force writing to the specific path (user pressed CTRL-SHIFT-S) + trace('Force exporting to $targetPath...'); + FileUtil.saveFilesAsZIPToPath(zipEntries, targetPath, targetMode); + state.saveDataDirty = false; // Don't edit the saveData flag because the app might be closing. } - - // We have to force write because the program will die before the save dialog is closed. - trace('Force exporting to $targetPath...'); - FileUtil.saveFilesAsZIPToPath(zipEntries, targetPath, targetMode); - state.saveDataDirty = false; } else {