diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index c9f1e4137..27a899aef 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -1395,6 +1395,46 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState return currentSongMetadata.artist = value; } + /** + * Convenience property to get the player charId for the current variation. + */ + var currentPlayerChar(get, set):String; + + function get_currentPlayerChar():String + { + if (currentSongMetadata.playData.characters.player == null) + { + // Initialize to the default value if not set. + currentSongMetadata.playData.characters.player = Constants.DEFAULT_CHARACTER; + } + return currentSongMetadata.playData.characters.player; + } + + function set_currentPlayerChar(value:String):String + { + return currentSongMetadata.playData.characters.player = value; + } + + /** + * Convenience property to get the opponent charId for the current variation. + */ + var currentOpponentChar(get, set):String; + + function get_currentOpponentChar():String + { + if (currentSongMetadata.playData.characters.opponent == null) + { + // Initialize to the default value if not set. + currentSongMetadata.playData.characters.opponent = Constants.DEFAULT_CHARACTER; + } + return currentSongMetadata.playData.characters.opponent; + } + + function set_currentOpponentChar(value:String):String + { + return currentSongMetadata.playData.characters.opponent = value; + } + /** * Convenience property to get the song offset data for the current variation. */ @@ -1430,6 +1470,23 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState return value; } + var currentVocalOffset(get, set):Float; + + function get_currentVocalOffset():Float + { + // Currently there's only one vocal offset, so we just grab the player's offset since both should be the same. + // Should probably make it so we can set offsets for player + opponent individually, though. + return currentSongOffsets.getVocalOffset(currentPlayerChar); + } + + function set_currentVocalOffset(value:Float):Float + { + // Currently there's only one vocal offset, so we just apply it to both characters. + currentSongOffsets.setVocalOffset(currentPlayerChar, value); + currentSongOffsets.setVocalOffset(currentOpponentChar, value); + return value; + } + /** * The variation ID for the difficulty which is currently being edited. */ diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx index d7fbd42c2..0764d7af3 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx @@ -190,7 +190,7 @@ class ChartEditorAudioHandler state.audioVisGroup.playerVis.detail = 1; state.audioVisGroup.playerVis.y = Math.max(state.gridTiledSprite?.y ?? 0.0, ChartEditorState.GRID_INITIAL_Y_POS - ChartEditorState.GRID_TOP_PAD); - state.audioVocalTrackGroup.playerVoicesOffset = state.currentSongOffsets.getVocalOffset(charId); + state.audioVocalTrackGroup.playerVoicesOffset = state.currentVocalOffset; return true; case DAD: state.audioVocalTrackGroup.addOpponentVoice(vocalTrack); @@ -202,7 +202,7 @@ class ChartEditorAudioHandler state.audioVisGroup.opponentVis.detail = 1; state.audioVisGroup.opponentVis.y = Math.max(state.gridTiledSprite?.y ?? 0.0, ChartEditorState.GRID_INITIAL_Y_POS - ChartEditorState.GRID_TOP_PAD); - state.audioVocalTrackGroup.opponentVoicesOffset = state.currentSongOffsets.getVocalOffset(charId); + state.audioVocalTrackGroup.opponentVoicesOffset = state.currentVocalOffset; return true; case OTHER: diff --git a/source/funkin/ui/debug/charting/toolboxes/ChartEditorMetadataToolbox.hx b/source/funkin/ui/debug/charting/toolboxes/ChartEditorMetadataToolbox.hx index 06b20ed7c..c69ed9ddf 100644 --- a/source/funkin/ui/debug/charting/toolboxes/ChartEditorMetadataToolbox.hx +++ b/source/funkin/ui/debug/charting/toolboxes/ChartEditorMetadataToolbox.hx @@ -150,7 +150,12 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox inputOffsetVocal.onChange = function(event:UIEvent) { if (event.value == null) return; - chartEditorState.currentSongMetadata.offsets.setVocalOffset(chartEditorState.currentSongMetadata.playData.characters.player, event.value); + chartEditorState.currentVocalOffset = event.value; + if (chartEditorState.audioVocalTrackGroup != null) + { + chartEditorState.audioVocalTrackGroup.playerVoicesOffset = event.value; + chartEditorState.audioVocalTrackGroup.opponentVoicesOffset = event.value; + } }; inputScrollSpeed.onChange = function(event:UIEvent) { var valid:Bool = event.target.value != null && event.target.value > 0;