mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
Fix some issues with events unintentionally sharing data after being edited via the toolbox.
This commit is contained in:
parent
494a3c9e86
commit
5e0de6d1ce
5 changed files with 28 additions and 7 deletions
|
@ -706,7 +706,7 @@ abstract SongEventData(SongEventDataRaw) from SongEventDataRaw to SongEventDataR
|
||||||
this = new SongEventDataRaw(time, eventKind, value);
|
this = new SongEventDataRaw(time, eventKind, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline function valueAsStruct(?defaultKey:String = "key"):Dynamic
|
public function valueAsStruct(?defaultKey:String = "key"):Dynamic
|
||||||
{
|
{
|
||||||
if (this.value == null) return {};
|
if (this.value == null) return {};
|
||||||
if (Std.isOfType(this.value, Array))
|
if (Std.isOfType(this.value, Array))
|
||||||
|
|
|
@ -878,6 +878,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
*/
|
*/
|
||||||
var noteDisplayDirty:Bool = true;
|
var noteDisplayDirty:Bool = true;
|
||||||
|
|
||||||
|
var noteTooltipsDirty:Bool = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the selected charactesr have been modified and the health icons need to be updated.
|
* Whether the selected charactesr have been modified and the health icons need to be updated.
|
||||||
*/
|
*/
|
||||||
|
@ -1541,6 +1543,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
// Make sure view is updated when the variation changes.
|
// Make sure view is updated when the variation changes.
|
||||||
noteDisplayDirty = true;
|
noteDisplayDirty = true;
|
||||||
notePreviewDirty = true;
|
notePreviewDirty = true;
|
||||||
|
noteTooltipsDirty = true;
|
||||||
notePreviewViewportBoundsDirty = true;
|
notePreviewViewportBoundsDirty = true;
|
||||||
|
|
||||||
switchToCurrentInstrumental();
|
switchToCurrentInstrumental();
|
||||||
|
@ -1562,6 +1565,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
// Make sure view is updated when the difficulty changes.
|
// Make sure view is updated when the difficulty changes.
|
||||||
noteDisplayDirty = true;
|
noteDisplayDirty = true;
|
||||||
notePreviewDirty = true;
|
notePreviewDirty = true;
|
||||||
|
noteTooltipsDirty = true;
|
||||||
notePreviewViewportBoundsDirty = true;
|
notePreviewViewportBoundsDirty = true;
|
||||||
|
|
||||||
// Make sure the difficulty we selected is in the list of difficulties.
|
// Make sure the difficulty we selected is in the list of difficulties.
|
||||||
|
@ -3663,8 +3667,13 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
selectionSquare.width = eventSprite.width;
|
selectionSquare.width = eventSprite.width;
|
||||||
selectionSquare.height = eventSprite.height;
|
selectionSquare.height = eventSprite.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Additional cleanup on notes.
|
||||||
|
if (noteTooltipsDirty) eventSprite.updateTooltipText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
noteTooltipsDirty = false;
|
||||||
|
|
||||||
// Sort the notes DESCENDING. This keeps the sustain behind the associated note.
|
// Sort the notes DESCENDING. This keeps the sustain behind the associated note.
|
||||||
renderedNotes.sort(FlxSort.byY, FlxSort.DESCENDING); // TODO: .group.insertionSort()
|
renderedNotes.sort(FlxSort.byY, FlxSort.DESCENDING); // TODO: .group.insertionSort()
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,12 @@ class SetItemSelectionCommand implements ChartEditorCommand
|
||||||
}
|
}
|
||||||
var eventData = eventSelected.valueAsStruct(defaultKey);
|
var eventData = eventSelected.valueAsStruct(defaultKey);
|
||||||
|
|
||||||
state.eventDataToPlace = eventData;
|
var eventDataClone = Reflect.copy(eventData);
|
||||||
|
|
||||||
|
if (eventDataClone != null)
|
||||||
|
{
|
||||||
|
state.eventDataToPlace = eventDataClone;
|
||||||
|
}
|
||||||
|
|
||||||
state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);
|
state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,8 +164,7 @@ class ChartEditorEventSprite extends FlxSprite
|
||||||
this.eventData = value;
|
this.eventData = value;
|
||||||
// Update the position to match the note data.
|
// Update the position to match the note data.
|
||||||
updateEventPosition();
|
updateEventPosition();
|
||||||
// Update the tooltip text.
|
updateTooltipText();
|
||||||
this.tooltip.tipData = {text: this.eventData.buildTooltip()};
|
|
||||||
return this.eventData;
|
return this.eventData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,6 +187,13 @@ class ChartEditorEventSprite extends FlxSprite
|
||||||
this.updateTooltipPosition();
|
this.updateTooltipPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateTooltipText():Void
|
||||||
|
{
|
||||||
|
if (this.eventData == null) return;
|
||||||
|
if (this.isGhost) return;
|
||||||
|
this.tooltip.tipData = {text: this.eventData.buildTooltip()};
|
||||||
|
}
|
||||||
|
|
||||||
public function updateTooltipPosition():Void
|
public function updateTooltipPosition():Void
|
||||||
{
|
{
|
||||||
// No tooltip for ghost sprites.
|
// No tooltip for ghost sprites.
|
||||||
|
|
|
@ -258,14 +258,15 @@ class ChartEditorEventDataToolbox extends ChartEditorBaseToolbox
|
||||||
// Edit the event data of any existing events.
|
// Edit the event data of any existing events.
|
||||||
if (!_initializing && chartEditorState.currentEventSelection.length > 0)
|
if (!_initializing && chartEditorState.currentEventSelection.length > 0)
|
||||||
{
|
{
|
||||||
for (event in chartEditorState.currentEventSelection)
|
for (songEvent in chartEditorState.currentEventSelection)
|
||||||
{
|
{
|
||||||
event.eventKind = chartEditorState.eventKindToPlace;
|
songEvent.eventKind = chartEditorState.eventKindToPlace;
|
||||||
event.value = chartEditorState.eventDataToPlace;
|
songEvent.value = Reflect.copy(chartEditorState.eventDataToPlace);
|
||||||
}
|
}
|
||||||
chartEditorState.saveDataDirty = true;
|
chartEditorState.saveDataDirty = true;
|
||||||
chartEditorState.noteDisplayDirty = true;
|
chartEditorState.noteDisplayDirty = true;
|
||||||
chartEditorState.notePreviewDirty = true;
|
chartEditorState.notePreviewDirty = true;
|
||||||
|
chartEditorState.noteTooltipsDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue