mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-11-25 21:55:55 +00:00
display custom note style in chart editor
This commit is contained in:
parent
9d7846a0d5
commit
ca2cbb44f5
|
|
@ -73,4 +73,14 @@ class NoteKindManager
|
||||||
|
|
||||||
return NoteStyleRegistry.instance.fetchEntry(noteStyleId);
|
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.TurboButtonHandler;
|
||||||
import funkin.input.TurboKeyHandler;
|
import funkin.input.TurboKeyHandler;
|
||||||
import funkin.modding.events.ScriptEvent;
|
import funkin.modding.events.ScriptEvent;
|
||||||
|
import funkin.play.notes.notekind.NoteKindManager;
|
||||||
import funkin.play.character.BaseCharacter.CharacterType;
|
import funkin.play.character.BaseCharacter.CharacterType;
|
||||||
import funkin.play.character.CharacterData;
|
import funkin.play.character.CharacterData;
|
||||||
import funkin.play.character.CharacterData.CharacterDataParser;
|
import funkin.play.character.CharacterData.CharacterDataParser;
|
||||||
|
|
@ -1663,8 +1664,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
return currentSongMetadata.playData.characters.instrumental = value;
|
return currentSongMetadata.playData.characters.instrumental = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentCustomNoteKindStyle:Null<String>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HAXEUI COMPONENTS
|
* HAXEUI COMPONENTS
|
||||||
*/
|
*/
|
||||||
|
|
@ -3586,6 +3585,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
|
|
||||||
// The note sprite handles animation playback and positioning.
|
// The note sprite handles animation playback and positioning.
|
||||||
noteSprite.noteData = noteData;
|
noteSprite.noteData = noteData;
|
||||||
|
noteSprite.noteStyle = NoteKindManager.getNoteStyleId(noteData.kind) ?? currentSongNoteStyle;
|
||||||
noteSprite.overrideStepTime = null;
|
noteSprite.overrideStepTime = null;
|
||||||
noteSprite.overrideData = null;
|
noteSprite.overrideData = null;
|
||||||
|
|
||||||
|
|
@ -3606,6 +3606,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
|
|
||||||
holdNoteSprite.noteData = noteSprite.noteData;
|
holdNoteSprite.noteData = noteSprite.noteData;
|
||||||
holdNoteSprite.noteDirection = noteSprite.noteData.getDirection();
|
holdNoteSprite.noteDirection = noteSprite.noteData.getDirection();
|
||||||
|
holdNoteSprite.noteStyle = NoteKindManager.getNoteStyleId(noteSprite.noteData.kind) ?? currentSongNoteStyle;
|
||||||
|
|
||||||
holdNoteSprite.setHeightDirectly(noteLengthPixels);
|
holdNoteSprite.setHeightDirectly(noteLengthPixels);
|
||||||
|
|
||||||
|
|
@ -3671,7 +3672,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
|
|
||||||
holdNoteSprite.noteData = noteData;
|
holdNoteSprite.noteData = noteData;
|
||||||
holdNoteSprite.noteDirection = noteData.getDirection();
|
holdNoteSprite.noteDirection = noteData.getDirection();
|
||||||
|
holdNoteSprite.noteStyle = NoteKindManager.getNoteStyleId(noteData.kind) ?? currentSongNoteStyle;
|
||||||
holdNoteSprite.setHeightDirectly(noteLengthPixels);
|
holdNoteSprite.setHeightDirectly(noteLengthPixels);
|
||||||
|
|
||||||
holdNoteSprite.updateHoldNotePosition(renderedHoldNotes);
|
holdNoteSprite.updateHoldNotePosition(renderedHoldNotes);
|
||||||
|
|
@ -4570,6 +4571,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
gridGhostHoldNote.visible = true;
|
gridGhostHoldNote.visible = true;
|
||||||
gridGhostHoldNote.noteData = currentPlaceNoteData;
|
gridGhostHoldNote.noteData = currentPlaceNoteData;
|
||||||
gridGhostHoldNote.noteDirection = currentPlaceNoteData.getDirection();
|
gridGhostHoldNote.noteDirection = currentPlaceNoteData.getDirection();
|
||||||
|
gridGhostHoldNote.noteStyle = NoteKindManager.getNoteStyleId(currentPlaceNoteData.kind) ?? currentSongNoteStyle;
|
||||||
gridGhostHoldNote.setHeightDirectly(dragLengthPixels, true);
|
gridGhostHoldNote.setHeightDirectly(dragLengthPixels, true);
|
||||||
|
|
||||||
gridGhostHoldNote.updateHoldNotePosition(renderedHoldNotes);
|
gridGhostHoldNote.updateHoldNotePosition(renderedHoldNotes);
|
||||||
|
|
@ -4893,6 +4895,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
{
|
{
|
||||||
noteData.kind = noteKindToPlace;
|
noteData.kind = noteKindToPlace;
|
||||||
noteData.data = cursorColumn;
|
noteData.data = cursorColumn;
|
||||||
|
gridGhostNote.noteStyle = NoteKindManager.getNoteStyleId(noteData.kind) ?? currentSongNoteStyle;
|
||||||
gridGhostNote.playNoteAnimation();
|
gridGhostNote.playNoteAnimation();
|
||||||
}
|
}
|
||||||
noteData.time = cursorSnappedMs;
|
noteData.time = cursorSnappedMs;
|
||||||
|
|
@ -5281,6 +5284,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
// Readd the new ghost hold note.
|
// Readd the new ghost hold note.
|
||||||
ghostHold.noteData = targetNoteData.clone();
|
ghostHold.noteData = targetNoteData.clone();
|
||||||
ghostHold.noteDirection = ghostHold.noteData.getDirection();
|
ghostHold.noteDirection = ghostHold.noteData.getDirection();
|
||||||
|
ghostHold.noteStyle = NoteKindManager.getNoteStyleId(ghostHold.noteData.kind) ?? currentSongNoteStyle;
|
||||||
ghostHold.visible = true;
|
ghostHold.visible = true;
|
||||||
ghostHold.alpha = 0.6;
|
ghostHold.alpha = 0.6;
|
||||||
ghostHold.setHeightDirectly(0);
|
ghostHold.setHeightDirectly(0);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package funkin.ui.debug.charting.components;
|
||||||
|
|
||||||
import funkin.play.notes.Strumline;
|
import funkin.play.notes.Strumline;
|
||||||
import funkin.data.notestyle.NoteStyleRegistry;
|
import funkin.data.notestyle.NoteStyleRegistry;
|
||||||
|
import funkin.play.notes.notestyle.NoteStyle;
|
||||||
import flixel.FlxObject;
|
import flixel.FlxObject;
|
||||||
import flixel.FlxSprite;
|
import flixel.FlxSprite;
|
||||||
import flixel.graphics.frames.FlxFramesCollection;
|
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.
|
* 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.
|
* Designed to be used and reused efficiently. Has no gameplay functionality.
|
||||||
*/
|
*/
|
||||||
|
@:access(funkin.ui.debug.charting.ChartEditorState)
|
||||||
@:nullSafety
|
@:nullSafety
|
||||||
class ChartEditorHoldNoteSprite extends SustainTrail
|
class ChartEditorHoldNoteSprite extends SustainTrail
|
||||||
{
|
{
|
||||||
|
|
@ -23,6 +25,22 @@ class ChartEditorHoldNoteSprite extends SustainTrail
|
||||||
*/
|
*/
|
||||||
public var parentState:ChartEditorState;
|
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)
|
public function new(parent:ChartEditorState)
|
||||||
{
|
{
|
||||||
var noteStyle = NoteStyleRegistry.instance.fetchDefault();
|
var noteStyle = NoteStyleRegistry.instance.fetchDefault();
|
||||||
|
|
@ -41,6 +59,22 @@ class ChartEditorHoldNoteSprite extends SustainTrail
|
||||||
setup();
|
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
|
public override function updateHitbox():Void
|
||||||
{
|
{
|
||||||
// Expand the clickable hitbox to the full column width, then nudge to the left to re-center it.
|
// 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.
|
* 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;
|
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.noteStyle ?? this.parentState.currentSongNoteStyle;
|
||||||
{
|
|
||||||
return this.parentState.currentCustomNoteKindStyle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NOTE_STYLES.contains(this.parentState.currentSongNoteStyle))
|
function set_noteStyle(value:Null<String>):Null<String>
|
||||||
{
|
{
|
||||||
return this.parentState.currentSongNoteStyle;
|
this.noteStyle = value;
|
||||||
}
|
this.playNoteAnimation();
|
||||||
|
return value;
|
||||||
return 'funkin';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@:nullSafety(Off)
|
@:nullSafety(Off)
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,6 @@ class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox
|
||||||
var customKind:Null<String> = event?.target?.text;
|
var customKind:Null<String> = event?.target?.text;
|
||||||
chartEditorState.noteKindToPlace = customKind;
|
chartEditorState.noteKindToPlace = customKind;
|
||||||
|
|
||||||
var noteStyle:Null<NoteStyle> = NoteKindManager.getNoteStyle(customKind);
|
|
||||||
chartEditorState.currentCustomNoteKindStyle = noteStyle?.id;
|
|
||||||
|
|
||||||
if (chartEditorState.currentEventSelection.length > 0)
|
if (chartEditorState.currentEventSelection.length > 0)
|
||||||
{
|
{
|
||||||
// Edit the note data of any selected notes.
|
// Edit the note data of any selected notes.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue