Merge pull request #196 from FunkinCrew/rewrite/bugfix/chart-editor-bpm-fixes

Chart Editor: Fix issues with changing BPMs of songs.
This commit is contained in:
Cameron Taylor 2023-10-17 19:11:57 -04:00 committed by GitHub
commit 4b255174fb
5 changed files with 47 additions and 11 deletions

2
assets

@ -1 +1 @@
Subproject commit 8104d43e584a1f25e574438d7b21a7e671358969
Subproject commit c86e6ba78e80a0fb7514ba2d662b6fd00d327a74

View file

@ -580,8 +580,7 @@ class BaseCharacter extends Bopper
public override function playAnimation(name:String, restart:Bool = false, ignoreOther:Bool = false, reversed:Bool = false):Void
{
FlxG.watch.addQuick('playAnim(${characterName})', name);
// trace('playAnim(${characterName}): ${name}');
// FlxG.watch.addQuick('playAnim(${characterName})', name);
super.playAnimation(name, restart, ignoreOther, reversed);
}
}

View file

@ -667,8 +667,6 @@ class ChartEditorDialogHandler
timeChanges[0].bpm = event.value;
}
Conductor.forceBPM(event.value);
newSongMetadata.timeChanges = timeChanges;
};
@ -677,6 +675,8 @@ class ChartEditorDialogHandler
dialogContinue.onClick = (_event) -> {
state.songMetadata.set(targetVariation, newSongMetadata);
Conductor.mapTimeChanges(state.currentSongMetadata.timeChanges);
dialog.hideDialog(DialogButton.APPLY);
}
@ -696,6 +696,8 @@ class ChartEditorDialogHandler
var charData:SongCharacterData = state.currentSongMetadata.playData.characters;
var hasClearedVocals:Bool = false;
charIdsForVocals.push(charData.player);
charIdsForVocals.push(charData.opponent);
@ -715,6 +717,7 @@ class ChartEditorDialogHandler
if (dialogNoVocals == null) throw 'Could not locate dialogNoVocals button in Upload Vocals dialog';
dialogNoVocals.onClick = function(_event) {
// Dismiss
ChartEditorAudioHandler.stopExistingVocals(state);
dialog.hideDialog(DialogButton.APPLY);
};
@ -738,6 +741,12 @@ class ChartEditorDialogHandler
trace('Selected file: $pathStr');
var path:Path = new Path(pathStr);
if (!hasClearedVocals)
{
hasClearedVocals = true;
ChartEditorAudioHandler.stopExistingVocals(state);
}
if (ChartEditorAudioHandler.loadVocalsFromPath(state, path, charKey, instId))
{
// Tell the user the load was successful.
@ -788,6 +797,11 @@ class ChartEditorDialogHandler
if (selectedFile != null && selectedFile.bytes != null)
{
trace('Selected file: ' + selectedFile.name);
if (!hasClearedVocals)
{
hasClearedVocals = true;
ChartEditorAudioHandler.stopExistingVocals(state);
}
if (ChartEditorAudioHandler.loadVocalsFromBytes(state, selectedFile.bytes, charKey, instId))
{
// Tell the user the load was successful.

View file

@ -1897,6 +1897,16 @@ class ChartEditorState extends HaxeUIState
handleViewKeybinds();
handleTestKeybinds();
handleHelpKeybinds();
#if debug
handleQuickWatch();
#end
}
function handleQuickWatch():Void
{
FlxG.watch.addQuick('scrollPosInPixels', scrollPositionInPixels);
FlxG.watch.addQuick('playheadPosInPixels', playheadPositionInPixels);
}
/**
@ -3119,6 +3129,7 @@ class ChartEditorState extends HaxeUIState
function quitChartEditor():Void
{
autoSave();
stopWelcomeMusic();
FlxG.switchState(new MainMenuState());
}
@ -3342,6 +3353,7 @@ class ChartEditorState extends HaxeUIState
if (!isHaxeUIDialogOpen && !isCursorOverHaxeUI && FlxG.keys.justPressed.ENTER)
{
var minimal = FlxG.keys.pressed.SHIFT;
ChartEditorToolboxHandler.hideAllToolboxes(this);
testSongInPlayState(minimal);
}
}
@ -4153,14 +4165,13 @@ class ChartEditorState extends HaxeUIState
*/
function moveSongToScrollPosition():Void
{
// Update the songPosition in the Conductor.
var targetPos = scrollPositionInMs;
Conductor.update(targetPos);
// Update the songPosition in the audio tracks.
if (audioInstTrack != null) audioInstTrack.time = scrollPositionInMs + playheadPositionInMs;
if (audioVocalTrackGroup != null) audioVocalTrackGroup.time = scrollPositionInMs + playheadPositionInMs;
// Update the songPosition in the Conductor.
Conductor.update(audioInstTrack.time);
// We need to update the note sprites because we changed the scroll position.
noteDisplayDirty = true;
}

View file

@ -136,6 +136,18 @@ class ChartEditorToolboxHandler
}
}
public static function rememberOpenToolboxes(state:ChartEditorState):Void {}
public static function openRememberedToolboxes(state:ChartEditorState):Void {}
public static function hideAllToolboxes(state:ChartEditorState):Void
{
for (toolbox in state.activeToolboxes.values())
{
toolbox.hideDialog(DialogButton.CANCEL);
}
}
public static function minimizeToolbox(state:ChartEditorState, id:String):Void
{
var toolbox:Null<CollapsibleDialog> = state.activeToolboxes.get(id);
@ -634,9 +646,9 @@ class ChartEditorToolboxHandler
timeChanges[0].bpm = event.value;
}
Conductor.forceBPM(event.value);
state.currentSongMetadata.timeChanges = timeChanges;
Conductor.mapTimeChanges(state.currentSongMetadata.timeChanges);
};
inputBPM.value = state.currentSongMetadata.timeChanges[0].bpm;