mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-07-02 00:27:11 +00:00
editing them works now
still need to implement String and do some testing
This commit is contained in:
parent
c41d846df5
commit
44d9785317
|
@ -1057,9 +1057,19 @@ class SongNoteDataRaw implements ICloneable<SongNoteDataRaw>
|
||||||
_stepLength = null;
|
_stepLength = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function cloneParams():Array<NoteParamData>
|
||||||
|
{
|
||||||
|
var params:Array<NoteParamData> = [];
|
||||||
|
for (param in this.params)
|
||||||
|
{
|
||||||
|
params.push(param.clone());
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
public function clone():SongNoteDataRaw
|
public function clone():SongNoteDataRaw
|
||||||
{
|
{
|
||||||
return new SongNoteDataRaw(this.time, this.data, this.length, this.kind, this.params);
|
return new SongNoteDataRaw(this.time, this.data, this.length, this.kind, cloneParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toString():String
|
public function toString():String
|
||||||
|
@ -1121,7 +1131,7 @@ abstract SongNoteData(SongNoteDataRaw) from SongNoteDataRaw to SongNoteDataRaw
|
||||||
if (other.kind == '' || this.kind == null) return false;
|
if (other.kind == '' || this.kind == null) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.time == other.time && this.data == other.data && this.length == other.length;
|
return this.time == other.time && this.data == other.data && this.length == other.length && this.params == other.params;
|
||||||
}
|
}
|
||||||
|
|
||||||
@:op(A != B)
|
@:op(A != B)
|
||||||
|
@ -1140,7 +1150,7 @@ abstract SongNoteData(SongNoteDataRaw) from SongNoteDataRaw to SongNoteDataRaw
|
||||||
if (other.kind == '') return true;
|
if (other.kind == '') return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.time != other.time || this.data != other.data || this.length != other.length;
|
return this.time != other.time || this.data != other.data || this.length != other.length || this.params != other.params;
|
||||||
}
|
}
|
||||||
|
|
||||||
@:op(A > B)
|
@:op(A > B)
|
||||||
|
@ -1177,7 +1187,7 @@ abstract SongNoteData(SongNoteDataRaw) from SongNoteDataRaw to SongNoteDataRaw
|
||||||
|
|
||||||
public function clone():SongNoteData
|
public function clone():SongNoteData
|
||||||
{
|
{
|
||||||
return new SongNoteData(this.time, this.data, this.length, this.kind);
|
return new SongNoteData(this.time, this.data, this.length, this.kind, this.params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -103,8 +103,13 @@ class NoteKindManager
|
||||||
* @param noteKind Name of the note kind
|
* @param noteKind Name of the note kind
|
||||||
* @return Array<NoteKindParam>
|
* @return Array<NoteKindParam>
|
||||||
*/
|
*/
|
||||||
public static function getParams(noteKind:String):Array<NoteKindParam>
|
public static function getParams(noteKind:Null<String>):Array<NoteKindParam>
|
||||||
{
|
{
|
||||||
|
if (noteKind == null)
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
return noteKinds.get(noteKind)?.params ?? [];
|
return noteKinds.get(noteKind)?.params ?? [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4737,7 +4737,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Create a note and place it in the chart.
|
// Create a note and place it in the chart.
|
||||||
var newNoteData:SongNoteData = new SongNoteData(cursorSnappedMs, cursorColumn, 0, noteKindToPlace, noteParamsToPlace.clone());
|
var newNoteData:SongNoteData = new SongNoteData(cursorSnappedMs, cursorColumn, 0, noteKindToPlace,
|
||||||
|
ChartEditorState.cloneNoteParams(noteParamsToPlace));
|
||||||
|
|
||||||
performCommand(new AddNotesCommand([newNoteData], FlxG.keys.pressed.CONTROL));
|
performCommand(new AddNotesCommand([newNoteData], FlxG.keys.pressed.CONTROL));
|
||||||
|
|
||||||
|
@ -4897,7 +4898,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
if (gridGhostNote == null) throw "ERROR: Tried to handle cursor, but gridGhostNote is null! Check ChartEditorState.buildGrid()";
|
if (gridGhostNote == null) throw "ERROR: Tried to handle cursor, but gridGhostNote is null! Check ChartEditorState.buildGrid()";
|
||||||
|
|
||||||
var noteData:SongNoteData = gridGhostNote.noteData != null ? gridGhostNote.noteData : new SongNoteData(cursorMs, cursorColumn, 0, noteKindToPlace,
|
var noteData:SongNoteData = gridGhostNote.noteData != null ? gridGhostNote.noteData : new SongNoteData(cursorMs, cursorColumn, 0, noteKindToPlace,
|
||||||
noteParamsToPlace.clone());
|
ChartEditorState.cloneNoteParams(noteParamsToPlace));
|
||||||
|
|
||||||
if (cursorColumn != noteData.data || noteKindToPlace != noteData.kind || noteParamsToPlace != noteData.params)
|
if (cursorColumn != noteData.data || noteKindToPlace != noteData.kind || noteParamsToPlace != noteData.params)
|
||||||
{
|
{
|
||||||
|
@ -5210,7 +5211,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
if (notesAtPos.length == 0 && !removeNoteInstead)
|
if (notesAtPos.length == 0 && !removeNoteInstead)
|
||||||
{
|
{
|
||||||
trace('Placing note. ${column}');
|
trace('Placing note. ${column}');
|
||||||
var newNoteData:SongNoteData = new SongNoteData(playheadPosSnappedMs, column, 0, noteKindToPlace, noteParamsToPlace.clone());
|
var newNoteData:SongNoteData = new SongNoteData(playheadPosSnappedMs, column, 0, noteKindToPlace, ChartEditorState.cloneNoteParams(noteParamsToPlace));
|
||||||
performCommand(new AddNotesCommand([newNoteData], FlxG.keys.pressed.CONTROL));
|
performCommand(new AddNotesCommand([newNoteData], FlxG.keys.pressed.CONTROL));
|
||||||
currentLiveInputPlaceNoteData[column] = newNoteData;
|
currentLiveInputPlaceNoteData[column] = newNoteData;
|
||||||
}
|
}
|
||||||
|
@ -6532,6 +6533,16 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
||||||
}
|
}
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function cloneNoteParams(paramsToClone:Array<NoteParamData>):Array<NoteParamData>
|
||||||
|
{
|
||||||
|
var params:Array<NoteParamData> = [];
|
||||||
|
for (param in paramsToClone)
|
||||||
|
{
|
||||||
|
params.push(param.clone());
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -62,77 +62,30 @@ class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox
|
||||||
|
|
||||||
trace('ChartEditorToolboxHandler.buildToolboxNoteDataLayout() - Note kind changed: $noteKind');
|
trace('ChartEditorToolboxHandler.buildToolboxNoteDataLayout() - Note kind changed: $noteKind');
|
||||||
|
|
||||||
var noteKindParams:Array<NoteKindParam> = NoteKindManager.getParams(noteKind);
|
|
||||||
var noteParamData:Array<NoteParamData> = [];
|
|
||||||
for (noteKindParam in noteKindParams)
|
|
||||||
{
|
|
||||||
noteParamData.push(new NoteParamData(noteKindParam.name, noteKindParam.data.defaultValue));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Edit the note data to place.
|
// Edit the note data to place.
|
||||||
if (noteKind == '~CUSTOM~')
|
if (noteKind == '~CUSTOM~')
|
||||||
{
|
{
|
||||||
showCustom();
|
showCustom();
|
||||||
clearNoteKindParams();
|
|
||||||
toolboxNotesCustomKind.value = chartEditorState.noteKindToPlace;
|
toolboxNotesCustomKind.value = chartEditorState.noteKindToPlace;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hideCustom();
|
hideCustom();
|
||||||
chartEditorState.noteKindToPlace = noteKind;
|
chartEditorState.noteKindToPlace = noteKind;
|
||||||
chartEditorState.noteParamsToPlace = noteParamData;
|
|
||||||
toolboxNotesCustomKind.value = chartEditorState.noteKindToPlace;
|
toolboxNotesCustomKind.value = chartEditorState.noteKindToPlace;
|
||||||
|
|
||||||
clearNoteKindParams();
|
|
||||||
for (param in noteKindParams)
|
|
||||||
{
|
|
||||||
var paramLabel:Label = new Label();
|
|
||||||
paramLabel.value = param.description;
|
|
||||||
paramLabel.verticalAlign = "center";
|
|
||||||
paramLabel.horizontalAlign = "right";
|
|
||||||
|
|
||||||
var paramStepper:NumberStepper = new NumberStepper();
|
|
||||||
paramStepper.value = param.data.defaultValue;
|
|
||||||
paramStepper.percentWidth = 100;
|
|
||||||
paramStepper.step = param.data.step ?? 1;
|
|
||||||
|
|
||||||
// this check should be unnecessary but for some reason
|
|
||||||
// even when these are null it will set it to 0
|
|
||||||
if (param.data.min != null)
|
|
||||||
{
|
|
||||||
paramStepper.min = param.data.min;
|
|
||||||
}
|
|
||||||
if (param.data.max != null)
|
|
||||||
{
|
|
||||||
paramStepper.max = param.data.max;
|
|
||||||
}
|
|
||||||
if (param.data.precision != null)
|
|
||||||
{
|
|
||||||
paramStepper.precision = param.data.precision;
|
|
||||||
}
|
|
||||||
|
|
||||||
addNoteKindParam(paramLabel, paramStepper);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createNoteKindParams(noteKind);
|
||||||
|
|
||||||
if (!_initializing && chartEditorState.currentNoteSelection.length > 0)
|
if (!_initializing && chartEditorState.currentNoteSelection.length > 0)
|
||||||
{
|
{
|
||||||
for (i in 0...toolboxNotesParams.length)
|
|
||||||
{
|
|
||||||
var toolboxComponent:Component = toolboxNotesParams[i].component;
|
|
||||||
toolboxComponent.onChange = function(event:UIEvent) {
|
|
||||||
for (note in chartEditorState.currentNoteSelection)
|
|
||||||
{
|
|
||||||
note.params[i].value = toolboxComponent.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (note in chartEditorState.currentNoteSelection)
|
for (note in chartEditorState.currentNoteSelection)
|
||||||
{
|
{
|
||||||
// Edit the note data of any selected notes.
|
// Edit the note data of any selected notes.
|
||||||
note.kind = chartEditorState.noteKindToPlace;
|
note.kind = chartEditorState.noteKindToPlace;
|
||||||
note.params = noteParamData.clone();
|
trace(note.params);
|
||||||
|
note.params = ChartEditorState.cloneNoteParams(chartEditorState.noteParamsToPlace);
|
||||||
|
trace(note.params);
|
||||||
|
|
||||||
// update note sprites
|
// update note sprites
|
||||||
for (noteSprite in chartEditorState.renderedNotes.members)
|
for (noteSprite in chartEditorState.renderedNotes.members)
|
||||||
|
@ -187,6 +140,8 @@ class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox
|
||||||
|
|
||||||
toolboxNotesNoteKind.value = ChartEditorDropdowns.lookupNoteKind(chartEditorState.noteKindToPlace);
|
toolboxNotesNoteKind.value = ChartEditorDropdowns.lookupNoteKind(chartEditorState.noteKindToPlace);
|
||||||
toolboxNotesCustomKind.value = chartEditorState.noteKindToPlace;
|
toolboxNotesCustomKind.value = chartEditorState.noteKindToPlace;
|
||||||
|
|
||||||
|
createNoteKindParams(chartEditorState.noteKindToPlace);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showCustom():Void
|
function showCustom():Void
|
||||||
|
@ -201,6 +156,82 @@ class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox
|
||||||
toolboxNotesCustomKind.hidden = true;
|
toolboxNotesCustomKind.hidden = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createNoteKindParams(noteKind:Null<String>):Void
|
||||||
|
{
|
||||||
|
clearNoteKindParams();
|
||||||
|
|
||||||
|
var setParamsToPlace:Bool = false;
|
||||||
|
if (!_initializing)
|
||||||
|
{
|
||||||
|
for (note in chartEditorState.currentNoteSelection)
|
||||||
|
{
|
||||||
|
if (note.kind == chartEditorState.noteKindToPlace)
|
||||||
|
{
|
||||||
|
chartEditorState.noteParamsToPlace = ChartEditorState.cloneNoteParams(note.params);
|
||||||
|
setParamsToPlace = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var noteKindParams:Array<NoteKindParam> = NoteKindManager.getParams(noteKind);
|
||||||
|
|
||||||
|
for (i in 0...noteKindParams.length)
|
||||||
|
{
|
||||||
|
var param:NoteKindParam = noteKindParams[i];
|
||||||
|
|
||||||
|
var paramLabel:Label = new Label();
|
||||||
|
paramLabel.value = param.description;
|
||||||
|
paramLabel.verticalAlign = "center";
|
||||||
|
paramLabel.horizontalAlign = "right";
|
||||||
|
|
||||||
|
var paramStepper:NumberStepper = new NumberStepper();
|
||||||
|
paramStepper.value = (setParamsToPlace ? chartEditorState.noteParamsToPlace[i].value : param.data.defaultValue);
|
||||||
|
paramStepper.percentWidth = 100;
|
||||||
|
paramStepper.step = param.data.step ?? 1;
|
||||||
|
|
||||||
|
// this check should be unnecessary but for some reason
|
||||||
|
// even when these are null it will set it to 0
|
||||||
|
if (param.data.min != null)
|
||||||
|
{
|
||||||
|
paramStepper.min = param.data.min;
|
||||||
|
}
|
||||||
|
if (param.data.max != null)
|
||||||
|
{
|
||||||
|
paramStepper.max = param.data.max;
|
||||||
|
}
|
||||||
|
if (param.data.precision != null)
|
||||||
|
{
|
||||||
|
paramStepper.precision = param.data.precision;
|
||||||
|
}
|
||||||
|
|
||||||
|
paramStepper.onChange = function(event:UIEvent) {
|
||||||
|
chartEditorState.noteParamsToPlace[i].value = paramStepper.value;
|
||||||
|
|
||||||
|
for (note in chartEditorState.currentNoteSelection)
|
||||||
|
{
|
||||||
|
if (note.params[i].name == param.name)
|
||||||
|
{
|
||||||
|
note.params[i].value = paramStepper.value;
|
||||||
|
trace(note.params[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addNoteKindParam(paramLabel, paramStepper);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!setParamsToPlace)
|
||||||
|
{
|
||||||
|
var noteParamData:Array<NoteParamData> = [];
|
||||||
|
for (param in noteKindParams)
|
||||||
|
{
|
||||||
|
noteParamData.push(new NoteParamData(param.name, param.data.defaultValue));
|
||||||
|
}
|
||||||
|
chartEditorState.noteParamsToPlace = noteParamData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function addNoteKindParam(label:Label, component:Component):Void
|
function addNoteKindParam(label:Label, component:Component):Void
|
||||||
{
|
{
|
||||||
toolboxNotesParams.push({label: label, component: component});
|
toolboxNotesParams.push({label: label, component: component});
|
||||||
|
@ -210,6 +241,17 @@ class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox
|
||||||
this.height = Math.max(DIALOG_HEIGHT, DIALOG_HEIGHT - 30 + toolboxNotesParams.length * 30);
|
this.height = Math.max(DIALOG_HEIGHT, DIALOG_HEIGHT - 30 + toolboxNotesParams.length * 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearNoteKindParams():Void
|
||||||
|
{
|
||||||
|
for (param in toolboxNotesParams)
|
||||||
|
{
|
||||||
|
toolboxNotesGrid.removeComponent(param.component);
|
||||||
|
toolboxNotesGrid.removeComponent(param.label);
|
||||||
|
}
|
||||||
|
toolboxNotesParams = [];
|
||||||
|
this.height = DIALOG_HEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
override function update(elapsed:Float):Void
|
override function update(elapsed:Float):Void
|
||||||
{
|
{
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
|
@ -227,17 +269,6 @@ class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearNoteKindParams():Void
|
|
||||||
{
|
|
||||||
for (param in toolboxNotesParams)
|
|
||||||
{
|
|
||||||
toolboxNotesGrid.removeComponent(param.component);
|
|
||||||
toolboxNotesGrid.removeComponent(param.label);
|
|
||||||
}
|
|
||||||
toolboxNotesParams = [];
|
|
||||||
this.height = DIALOG_HEIGHT;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function build(chartEditorState:ChartEditorState):ChartEditorNoteDataToolbox
|
public static function build(chartEditorState:ChartEditorState):ChartEditorNoteDataToolbox
|
||||||
{
|
{
|
||||||
return new ChartEditorNoteDataToolbox(chartEditorState);
|
return new ChartEditorNoteDataToolbox(chartEditorState);
|
||||||
|
|
Loading…
Reference in a new issue