diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx index 17234afd4..58b8c1334 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx @@ -114,10 +114,7 @@ class ChartEditorToolboxHandler { var toolbox:Null = cast state.activeToolboxes.get(id); - if (toolbox == null) - { - toolbox = cast initToolbox(state, id); - } + if (toolbox == null) return; if (toolbox != null) { diff --git a/source/funkin/ui/debug/charting/toolboxes/ChartEditorNoteDataToolbox.hx b/source/funkin/ui/debug/charting/toolboxes/ChartEditorNoteDataToolbox.hx index 7a0818f7e..ba25b8665 100644 --- a/source/funkin/ui/debug/charting/toolboxes/ChartEditorNoteDataToolbox.hx +++ b/source/funkin/ui/debug/charting/toolboxes/ChartEditorNoteDataToolbox.hx @@ -68,13 +68,12 @@ class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox if (noteKind == '~CUSTOM~') { showCustom(); - toolboxNotesCustomKind.value = chartEditorState.noteKindToPlace; + chartEditorState.noteKindToPlace = toolboxNotesCustomKind.value; } else { hideCustom(); chartEditorState.noteKindToPlace = noteKind; - toolboxNotesCustomKind.value = chartEditorState.noteKindToPlace; } createNoteKindParams(noteKind); @@ -112,14 +111,20 @@ class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox chartEditorState.notePreviewDirty = true; } }; - var startingValueNoteKind = ChartEditorDropdowns.populateDropdownWithNoteKinds(toolboxNotesNoteKind, ''); + toolboxNotesNoteKind.pauseEvent(UIEvent.CHANGE, true); + + var startingValueNoteKind = ChartEditorDropdowns.populateDropdownWithNoteKinds(toolboxNotesNoteKind, chartEditorState.noteKindToPlace); toolboxNotesNoteKind.value = startingValueNoteKind; + toolboxNotesNoteKind.resumeEvent(UIEvent.CHANGE, true, true); + toolboxNotesCustomKind.onChange = function(event:UIEvent) { var customKind:Null = event?.target?.text; chartEditorState.noteKindToPlace = customKind; - if (chartEditorState.currentEventSelection.length > 0) + if (toolboxNotesNoteKind.value.id != '~CUSTOM~') return; + + if (!_initializing && chartEditorState.currentNoteSelection.length > 0) { // Edit the note data of any selected notes. for (note in chartEditorState.currentNoteSelection) @@ -131,13 +136,21 @@ class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox chartEditorState.notePreviewDirty = true; } }; + toolboxNotesCustomKind.pauseEvent(UIEvent.CHANGE, true); + toolboxNotesCustomKind.value = chartEditorState.noteKindToPlace; + + toolboxNotesCustomKind.resumeEvent(UIEvent.CHANGE, true, true); } public override function refresh():Void { super.refresh(); + toolboxNotesNoteKind.pauseEvent(UIEvent.CHANGE, true); + toolboxNotesCustomKind.pauseEvent(UIEvent.CHANGE, true); + + toolboxNotesCustomKind.value = chartEditorState.noteKindToPlace; toolboxNotesNoteKind.value = ChartEditorDropdowns.lookupNoteKind(chartEditorState.noteKindToPlace); if (toolboxNotesNoteKind.value.id == '~CUSTOM~' && chartEditorState.noteKindToPlace != null) { @@ -147,9 +160,10 @@ class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox { hideCustom(); } - toolboxNotesCustomKind.value = chartEditorState.noteKindToPlace; createNoteKindParams(chartEditorState.noteKindToPlace); + toolboxNotesNoteKind.resumeEvent(UIEvent.CHANGE, true, true); + toolboxNotesCustomKind.resumeEvent(UIEvent.CHANGE, true, true); } function showCustom():Void diff --git a/source/funkin/ui/debug/charting/util/ChartEditorDropdowns.hx b/source/funkin/ui/debug/charting/util/ChartEditorDropdowns.hx index 68c0c726b..7f9ab274e 100644 --- a/source/funkin/ui/debug/charting/util/ChartEditorDropdowns.hx +++ b/source/funkin/ui/debug/charting/util/ChartEditorDropdowns.hx @@ -236,7 +236,7 @@ class ChartEditorDropdowns { dropDown.dataSource.clear(); - var returnValue:DropDownEntry = lookupNoteKind(''); + var returnValue:DropDownEntry = lookupNoteKind(startingKindId); for (noteKindId in NOTE_KINDS.keys()) {