diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorImportExportHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorImportExportHandler.hx index 0a26c973450..c0a597aa1ea 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorImportExportHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorImportExportHandler.hx @@ -131,10 +131,16 @@ class ChartEditorImportExportHandler state.songMetadata = newSongMetadata; state.songChartData = newSongChartData; - if (!state.songMetadata.exists(state.selectedVariation)) + var variationMetadata:Null = state.songMetadata.get(state.selectedVariation); + if (variationMetadata == null) { - state.selectedVariation = Constants.DEFAULT_VARIATION; + // Use the default variation, or the first available variation if that doesn't exist for some reason. + if (state.availableDifficulties.indexOf(Constants.DEFAULT_VARIATION) < 0) state.selectedVariation = state.availableVariations[0]; + else state.selectedVariation = Constants.DEFAULT_VARIATION; + + variationMetadata = state.songMetadata.get(state.selectedVariation); } + // Use the first available difficulty as a fallback if the currently selected one cannot be found. if (state.availableDifficulties.indexOf(state.selectedDifficulty) < 0) state.selectedDifficulty = state.availableDifficulties[0]; diff --git a/source/funkin/ui/debug/charting/toolboxes/ChartEditorDifficultyToolbox.hx b/source/funkin/ui/debug/charting/toolboxes/ChartEditorDifficultyToolbox.hx index 2fe108df527..d12de17b737 100644 --- a/source/funkin/ui/debug/charting/toolboxes/ChartEditorDifficultyToolbox.hx +++ b/source/funkin/ui/debug/charting/toolboxes/ChartEditorDifficultyToolbox.hx @@ -6,7 +6,6 @@ import funkin.data.song.SongRegistry; import haxe.ui.components.Button; import haxe.ui.containers.dialogs.Dialogs; import haxe.ui.containers.dialogs.Dialog.DialogButton; -import funkin.data.song.SongData.SongMetadata; import haxe.ui.components.DropDown; import haxe.ui.components.HorizontalSlider; import funkin.util.VersionUtil; @@ -215,6 +214,16 @@ class ChartEditorDifficultyToolbox extends ChartEditorBaseToolbox var difficultyList:Array = variationMetadata.playData.difficulties; + var variationChartdata:Null = chartEditorState.songChartData.get(curVariation); + if(variationChartdata != null) + { + var keys:Array = [for (x in variationChartdata.notes.keys()) x]; + for (key in keys) + { + difficultyList.pushUnique(key); + } + } + for (difficulty in difficultyList) { var _treeDifficulty:TreeViewNode = treeVariation.addNode(