deleting anims (hold on i needa edit flixel)

This commit is contained in:
lunarcleint
2024-07-22 16:34:04 -07:00
parent 2b659d688f
commit d56748a405
2 changed files with 21 additions and 1 deletions
@@ -136,7 +136,7 @@ class CharacterAnimButton extends UIButton {
playIcon.antialiasing = false;
members.push(playIcon);
deleteButton = new UIButton(0, 0, "", null, 28*2,24);
deleteButton = new UIButton(0, 0, "", () -> {parent.deleteAnimation(this);}, 28*2,24);
deleteButton.frames = Paths.getFrames("editors/ui/grayscale-button");
deleteButton.color = 0xFFAC3D3D;
members.push(deleteButton);
@@ -1,5 +1,6 @@
package funkin.editors.character;
import funkin.backend.utils.XMLUtil.AnimData;
import flixel.animation.FlxAnimation;
import flixel.graphics.FlxGraphic;
import openfl.geom.Rectangle;
@@ -64,4 +65,23 @@ class CharacterAnimsWindow extends UIButtonList<CharacterAnimButton> {
displayAnimsFramesList.set(name, {frame: anim.frames.getDefault([0])[0], scale: 104/animBounds.height, animBounds: animBounds});
}
public function deleteAnimation(button:CharacterAnimButton) {
if (buttons.members.length <= 1) return;
if (character.getAnimName() == button.anim)
@:privateAccess CharacterEditor.instance._animation_down(null);
character.removeAnimation(button.anim);
if (character.animOffsets.exists(button.anim)) character.animOffsets.remove(button.anim);
if (character.animDatas.exists(button.anim)) character.animDatas.remove(button.anim);
remove(button); button.destroy();
}
// public function createAnimation() {
// var animData:AnimData = {
// name: "New Animation"
// x: 0, y: 0,
// }
// }
}