Skip to content

Commit

Permalink
yeah nah this really needs a rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeMaru committed Jul 14, 2024
1 parent e5f7788 commit 67d3c37
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
28 changes: 20 additions & 8 deletions source/funkin/states/editors/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,10 @@ class ChartingState extends MusicBeatState
var note:Array<Dynamic> = [strumTime, noteData, 0, ChartTabs.curType];
curSectionData.sectionNotes.push(note);
selectedNote = note;
selectedNoteObject = mainGrid.drawObject(note);

var noteObject = mainGrid.drawObject(note);
selectedNoteObject = noteObject;
mainGrid.sectionMembers.push(noteObject);
}

public function selectNote(note:ChartNote) {
Expand All @@ -446,14 +449,23 @@ class ChartingState extends MusicBeatState
}
}

public function removeNote(note:ChartNote) {
if (note.chartData != null) {
if (note.chartData == selectedNote || note == selectedNoteObject) {
deselectNote();
}
curSectionData.sectionNotes.remove(note.chartData);
mainGrid.clearObject(note);
public function removeNote(note:ChartNote)
{
var chartData = note.chartData;
if (chartData == null)
return;

if (chartData == selectedNote || note == selectedNoteObject)
deselectNote();

// Make sure note gets removed
for (i in 0...3) {
var section = notes[sectionIndex - 1 + i];
if (section != null)
section.sectionNotes.remove(chartData);
}

mainGrid.clearObject(note);
}

public var selectedEvents:Array<EventJson> = [];
Expand Down
1 change: 1 addition & 0 deletions source/funkin/states/editors/chart/ChartGridBase.hx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class ChartGridBase<T:FlxObject> extends Group

public function clearObject(object:T) {
object.kill();
sectionMembers.remove(object);
}

public function clearMembers(onlySection:Bool = false) {
Expand Down
4 changes: 1 addition & 3 deletions source/funkin/states/editors/chart/grid/ChartNoteGrid.hx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ class ChartNoteGrid extends ChartGridBase<ChartNote>
if (data[0] + data[2] >= minTime)
{
var note = drawObject(data);
if (hasArray) {
pushArray.push(note);
}
if (hasArray) pushArray.push(note);
}
});
}
Expand Down

0 comments on commit 67d3c37

Please sign in to comment.