Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions source/funkin/data/event/SongEventSchema.hx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ abstract SongEventSchema(SongEventSchemaRaw)
return this[k] = v;
}

@:arrayAccess
public inline function push(v:SongEventSchemaField)
{
this.push(v);
}

public function stringifyFieldValue(name:String, value:Dynamic, addUnits:Bool = true):String
{
var field:SongEventSchemaField = getByName(name);
Expand Down
22 changes: 20 additions & 2 deletions source/funkin/data/song/SongData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -843,9 +843,27 @@ class SongEventDataRaw implements ICloneable<SongEventDataRaw>
var eventHandler = getHandler();
var eventSchema = getSchema();

if (eventSchema == null) return 'Unknown Event: ${this.eventKind}';
var result = 'Unknown Event: ${this.eventKind}';

var result = '${eventHandler.getTitle()}';
if (eventSchema == null)
{
// Build a tooltip out of the value map instead.
var valueStruct:haxe.DynamicAccess<Dynamic> = valueAsStruct('value');

for (pair in valueStruct.keyValueIterator())
{
var key = pair.key;
var value = pair.value;

var title = pair.key ?? 'UnknownField';

result += '\n- ${title}: ${value}';
}

return result;
}

result = '${eventHandler.getTitle()}';

var defaultKey = eventSchema.getFirstField()?.name;
var valueStruct:haxe.DynamicAccess<Dynamic> = valueAsStruct(defaultKey);
Expand Down
4 changes: 4 additions & 0 deletions source/funkin/ui/debug/charting/commands/AddEventsCommand.hx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class AddEventsCommand implements ChartEditorCommand

state.playSound(Paths.sound('chartingSounds/noteLay'));

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.saveDataDirty = true;
state.noteDisplayDirty = true;
state.notePreviewDirty = true;
Expand All @@ -52,6 +54,8 @@ class AddEventsCommand implements ChartEditorCommand
state.currentNoteSelection = [];
state.currentEventSelection = [];

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.saveDataDirty = true;
state.noteDisplayDirty = true;
state.notePreviewDirty = true;
Expand Down
4 changes: 4 additions & 0 deletions source/funkin/ui/debug/charting/commands/CutItemsCommand.hx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class CutItemsCommand implements ChartEditorCommand
state.currentNoteSelection = [];
state.currentEventSelection = [];

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.saveDataDirty = true;
state.noteDisplayDirty = true;
state.notePreviewDirty = true;
Expand All @@ -50,6 +52,8 @@ class CutItemsCommand implements ChartEditorCommand
state.currentNoteSelection = notes;
state.currentEventSelection = events;

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.saveDataDirty = true;
state.noteDisplayDirty = true;
state.notePreviewDirty = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class DeselectAllItemsCommand implements ChartEditorCommand
state.currentNoteSelection = [];
state.currentEventSelection = [];

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.noteDisplayDirty = true;
}

Expand All @@ -31,6 +33,8 @@ class DeselectAllItemsCommand implements ChartEditorCommand
state.currentNoteSelection = previousNoteSelection;
state.currentEventSelection = previousEventSelection;

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.noteDisplayDirty = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class DeselectItemsCommand implements ChartEditorCommand
state.currentNoteSelection = SongDataUtils.subtractNotes(state.currentNoteSelection, this.notes);
state.currentEventSelection = SongDataUtils.subtractEvents(state.currentEventSelection, this.events);

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.noteDisplayDirty = true;
state.notePreviewDirty = true;
}
Expand All @@ -41,6 +43,8 @@ class DeselectItemsCommand implements ChartEditorCommand
state.currentEventSelection.push(event);
}

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.noteDisplayDirty = true;
state.notePreviewDirty = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class InvertSelectedItemsCommand implements ChartEditorCommand
state.currentNoteSelection = SongDataUtils.subtractNotes(state.currentSongChartNoteData, previousNoteSelection);
state.currentEventSelection = SongDataUtils.subtractEvents(state.currentSongChartEventData, previousEventSelection);

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.noteDisplayDirty = true;
}

Expand All @@ -33,6 +35,8 @@ class InvertSelectedItemsCommand implements ChartEditorCommand
state.currentNoteSelection = previousNoteSelection;
state.currentEventSelection = previousEventSelection;

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.noteDisplayDirty = true;
}

Expand Down
4 changes: 4 additions & 0 deletions source/funkin/ui/debug/charting/commands/PasteItemsCommand.hx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class PasteItemsCommand implements ChartEditorCommand
state.currentNoteSelection = addedNotes.copy();
state.currentEventSelection = addedEvents.copy();

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.saveDataDirty = true;
state.noteDisplayDirty = true;
state.notePreviewDirty = true;
Expand All @@ -64,6 +66,8 @@ class PasteItemsCommand implements ChartEditorCommand
state.currentNoteSelection = [];
state.currentEventSelection = [];

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.saveDataDirty = true;
state.noteDisplayDirty = true;
state.notePreviewDirty = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class RemoveEventsCommand implements ChartEditorCommand

state.playSound(Paths.sound('chartingSounds/noteErase'));

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.saveDataDirty = true;
state.noteDisplayDirty = true;
state.notePreviewDirty = true;
Expand All @@ -45,6 +47,8 @@ class RemoveEventsCommand implements ChartEditorCommand
state.currentEventSelection = events;
state.playSound(Paths.sound('chartingSounds/undo'));

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.saveDataDirty = true;
state.noteDisplayDirty = true;
state.notePreviewDirty = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class RemoveItemsCommand implements ChartEditorCommand

state.playSound(Paths.sound('chartingSounds/noteErase'));

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.saveDataDirty = true;
state.noteDisplayDirty = true;
state.notePreviewDirty = true;
Expand All @@ -57,6 +59,8 @@ class RemoveItemsCommand implements ChartEditorCommand
state.currentNoteSelection = notes;
state.currentEventSelection = events;

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.playSound(Paths.sound('chartingSounds/undo'));

state.saveDataDirty = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class SelectAllItemsCommand implements ChartEditorCommand
state.currentNoteSelection = shouldSelectNotes ? state.currentSongChartNoteData : [];
state.currentEventSelection = shouldSelectEvents ? state.currentSongChartEventData : [];

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.noteDisplayDirty = true;
}

Expand All @@ -38,6 +40,8 @@ class SelectAllItemsCommand implements ChartEditorCommand
state.currentNoteSelection = previousNoteSelection;
state.currentEventSelection = previousEventSelection;

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.noteDisplayDirty = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SelectItemsCommand implements ChartEditorCommand
}

// If we just selected one or more events (and no notes), then we should make the event data toolbox display the event data for the selected event.
if (this.notes.length == 0 && this.events.length == 1)
if (this.notes.length == 0 && state.currentEventSelection.length == 1)
{
var eventSelected = this.events[0];

Expand All @@ -55,8 +55,6 @@ class SelectItemsCommand implements ChartEditorCommand
var eventData = eventSelected.valueAsStruct(defaultKey);

state.eventDataToPlace = eventData;

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);
}

// If we just selected one or more notes (and no events), then we should make the note data toolbox display the note data for the selected note.
Expand All @@ -70,6 +68,8 @@ class SelectItemsCommand implements ChartEditorCommand
state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_NOTE_DATA_LAYOUT);
}

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.noteDisplayDirty = true;
state.notePreviewDirty = true;
}
Expand All @@ -79,6 +79,8 @@ class SelectItemsCommand implements ChartEditorCommand
state.currentNoteSelection = SongDataUtils.subtractNotes(state.currentNoteSelection, this.notes);
state.currentEventSelection = SongDataUtils.subtractEvents(state.currentEventSelection, this.events);

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.noteDisplayDirty = true;
state.notePreviewDirty = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SetItemSelectionCommand implements ChartEditorCommand
state.currentEventSelection = events;

// If we just selected one or more events (and no notes), then we should make the event data toolbox display the event data for the selected event.
if (this.notes.length == 0 && this.events.length == 1)
if (this.notes.length == 0 && this.events.length > 1)
{
var eventSelected = this.events[0];

Expand Down Expand Up @@ -65,8 +65,6 @@ class SetItemSelectionCommand implements ChartEditorCommand
{
state.eventDataToPlace = eventDataClone;
}

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);
}

// IF we just selected one or more notes (and no events), then we should make the note data toolbox display the note data for the selected note.
Expand All @@ -79,6 +77,8 @@ class SetItemSelectionCommand implements ChartEditorCommand
state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_NOTE_DATA_LAYOUT);
}

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.noteDisplayDirty = true;
}

Expand All @@ -87,6 +87,8 @@ class SetItemSelectionCommand implements ChartEditorCommand
state.currentNoteSelection = previousNoteSelection;
state.currentEventSelection = previousEventSelection;

state.refreshToolbox(ChartEditorState.CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT);

state.noteDisplayDirty = true;
}

Expand Down
Loading