mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-14 19:25:16 -05:00
display custom note style in chart editor
This commit is contained in:
parent
9d7846a0d5
commit
ca2cbb44f5
5 changed files with 61 additions and 18 deletions
|
@ -73,4 +73,14 @@ class NoteKindManager
|
|||
|
||||
return NoteStyleRegistry.instance.fetchEntry(noteStyleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the note style id from the given note kind
|
||||
* @param noteKind note kind name
|
||||
* @return Null<String>
|
||||
*/
|
||||
public static function getNoteStyleId(noteKind:String):Null<String>
|
||||
{
|
||||
return noteKinds.get(noteKind)?.noteStyleId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ import funkin.input.TurboActionHandler;
|
|||
import funkin.input.TurboButtonHandler;
|
||||
import funkin.input.TurboKeyHandler;
|
||||
import funkin.modding.events.ScriptEvent;
|
||||
import funkin.play.notes.notekind.NoteKindManager;
|
||||
import funkin.play.character.BaseCharacter.CharacterType;
|
||||
import funkin.play.character.CharacterData;
|
||||
import funkin.play.character.CharacterData.CharacterDataParser;
|
||||
|
@ -1663,8 +1664,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
return currentSongMetadata.playData.characters.instrumental = value;
|
||||
}
|
||||
|
||||
var currentCustomNoteKindStyle:Null<String>;
|
||||
|
||||
/**
|
||||
* HAXEUI COMPONENTS
|
||||
*/
|
||||
|
@ -3586,6 +3585,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
|
||||
// The note sprite handles animation playback and positioning.
|
||||
noteSprite.noteData = noteData;
|
||||
noteSprite.noteStyle = NoteKindManager.getNoteStyleId(noteData.kind) ?? currentSongNoteStyle;
|
||||
noteSprite.overrideStepTime = null;
|
||||
noteSprite.overrideData = null;
|
||||
|
||||
|
@ -3606,6 +3606,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
|
||||
holdNoteSprite.noteData = noteSprite.noteData;
|
||||
holdNoteSprite.noteDirection = noteSprite.noteData.getDirection();
|
||||
holdNoteSprite.noteStyle = NoteKindManager.getNoteStyleId(noteSprite.noteData.kind) ?? currentSongNoteStyle;
|
||||
|
||||
holdNoteSprite.setHeightDirectly(noteLengthPixels);
|
||||
|
||||
|
@ -3671,7 +3672,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
|
||||
holdNoteSprite.noteData = noteData;
|
||||
holdNoteSprite.noteDirection = noteData.getDirection();
|
||||
|
||||
holdNoteSprite.noteStyle = NoteKindManager.getNoteStyleId(noteData.kind) ?? currentSongNoteStyle;
|
||||
holdNoteSprite.setHeightDirectly(noteLengthPixels);
|
||||
|
||||
holdNoteSprite.updateHoldNotePosition(renderedHoldNotes);
|
||||
|
@ -4570,6 +4571,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
gridGhostHoldNote.visible = true;
|
||||
gridGhostHoldNote.noteData = currentPlaceNoteData;
|
||||
gridGhostHoldNote.noteDirection = currentPlaceNoteData.getDirection();
|
||||
gridGhostHoldNote.noteStyle = NoteKindManager.getNoteStyleId(currentPlaceNoteData.kind) ?? currentSongNoteStyle;
|
||||
gridGhostHoldNote.setHeightDirectly(dragLengthPixels, true);
|
||||
|
||||
gridGhostHoldNote.updateHoldNotePosition(renderedHoldNotes);
|
||||
|
@ -4893,6 +4895,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
{
|
||||
noteData.kind = noteKindToPlace;
|
||||
noteData.data = cursorColumn;
|
||||
gridGhostNote.noteStyle = NoteKindManager.getNoteStyleId(noteData.kind) ?? currentSongNoteStyle;
|
||||
gridGhostNote.playNoteAnimation();
|
||||
}
|
||||
noteData.time = cursorSnappedMs;
|
||||
|
@ -5281,6 +5284,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
// Readd the new ghost hold note.
|
||||
ghostHold.noteData = targetNoteData.clone();
|
||||
ghostHold.noteDirection = ghostHold.noteData.getDirection();
|
||||
ghostHold.noteStyle = NoteKindManager.getNoteStyleId(ghostHold.noteData.kind) ?? currentSongNoteStyle;
|
||||
ghostHold.visible = true;
|
||||
ghostHold.alpha = 0.6;
|
||||
ghostHold.setHeightDirectly(0);
|
||||
|
|
|
@ -2,6 +2,7 @@ package funkin.ui.debug.charting.components;
|
|||
|
||||
import funkin.play.notes.Strumline;
|
||||
import funkin.data.notestyle.NoteStyleRegistry;
|
||||
import funkin.play.notes.notestyle.NoteStyle;
|
||||
import flixel.FlxObject;
|
||||
import flixel.FlxSprite;
|
||||
import flixel.graphics.frames.FlxFramesCollection;
|
||||
|
@ -15,6 +16,7 @@ import flixel.math.FlxMath;
|
|||
* A sprite that can be used to display the trail of a hold note in a chart.
|
||||
* Designed to be used and reused efficiently. Has no gameplay functionality.
|
||||
*/
|
||||
@:access(funkin.ui.debug.charting.ChartEditorState)
|
||||
@:nullSafety
|
||||
class ChartEditorHoldNoteSprite extends SustainTrail
|
||||
{
|
||||
|
@ -23,6 +25,22 @@ class ChartEditorHoldNoteSprite extends SustainTrail
|
|||
*/
|
||||
public var parentState:ChartEditorState;
|
||||
|
||||
@:isVar
|
||||
public var noteStyle(get, set):Null<String>;
|
||||
|
||||
function get_noteStyle():Null<String>
|
||||
{
|
||||
return this.noteStyle ?? this.parentState.currentSongNoteStyle;
|
||||
}
|
||||
|
||||
@:nullSafety(Off)
|
||||
function set_noteStyle(value:Null<String>):Null<String>
|
||||
{
|
||||
this.noteStyle = value;
|
||||
this.updateHoldNoteGraphic();
|
||||
return value;
|
||||
}
|
||||
|
||||
public function new(parent:ChartEditorState)
|
||||
{
|
||||
var noteStyle = NoteStyleRegistry.instance.fetchDefault();
|
||||
|
@ -41,6 +59,22 @@ class ChartEditorHoldNoteSprite extends SustainTrail
|
|||
setup();
|
||||
}
|
||||
|
||||
@:nullSafety(Off)
|
||||
function updateHoldNoteGraphic():Void
|
||||
{
|
||||
var bruhStyle:NoteStyle = NoteStyleRegistry.instance.fetchEntry(noteStyle);
|
||||
this.setupHoldNoteGraphic(bruhStyle);
|
||||
|
||||
zoom = 1.0;
|
||||
zoom *= bruhStyle.fetchHoldNoteScale();
|
||||
zoom *= 0.7;
|
||||
zoom *= ChartEditorState.GRID_SIZE / Strumline.STRUMLINE_SIZE;
|
||||
|
||||
flipY = false;
|
||||
|
||||
setup();
|
||||
}
|
||||
|
||||
public override function updateHitbox():Void
|
||||
{
|
||||
// Expand the clickable hitbox to the full column width, then nudge to the left to re-center it.
|
||||
|
|
|
@ -40,7 +40,8 @@ class ChartEditorNoteSprite extends FlxSprite
|
|||
/**
|
||||
* The name of the note style currently in use.
|
||||
*/
|
||||
public var noteStyle(get, never):String;
|
||||
@:isVar
|
||||
public var noteStyle(get, set):Null<String>;
|
||||
|
||||
public var overrideStepTime(default, set):Null<Float> = null;
|
||||
|
||||
|
@ -189,19 +190,16 @@ class ChartEditorNoteSprite extends FlxSprite
|
|||
}
|
||||
}
|
||||
|
||||
function get_noteStyle():String
|
||||
function get_noteStyle():Null<String>
|
||||
{
|
||||
if (this.parentState.currentCustomNoteKindStyle != null)
|
||||
{
|
||||
return this.parentState.currentCustomNoteKindStyle;
|
||||
}
|
||||
return this.noteStyle ?? this.parentState.currentSongNoteStyle;
|
||||
}
|
||||
|
||||
if (NOTE_STYLES.contains(this.parentState.currentSongNoteStyle))
|
||||
{
|
||||
return this.parentState.currentSongNoteStyle;
|
||||
}
|
||||
|
||||
return 'funkin';
|
||||
function set_noteStyle(value:Null<String>):Null<String>
|
||||
{
|
||||
this.noteStyle = value;
|
||||
this.playNoteAnimation();
|
||||
return value;
|
||||
}
|
||||
|
||||
@:nullSafety(Off)
|
||||
|
|
|
@ -75,9 +75,6 @@ class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox
|
|||
var customKind:Null<String> = event?.target?.text;
|
||||
chartEditorState.noteKindToPlace = customKind;
|
||||
|
||||
var noteStyle:Null<NoteStyle> = NoteKindManager.getNoteStyle(customKind);
|
||||
chartEditorState.currentCustomNoteKindStyle = noteStyle?.id;
|
||||
|
||||
if (chartEditorState.currentEventSelection.length > 0)
|
||||
{
|
||||
// Edit the note data of any selected notes.
|
||||
|
|
Loading…
Reference in a new issue