diff --git a/source/funkin/editors/character/CharacterAnimsWindow.hx b/source/funkin/editors/character/CharacterAnimsWindow.hx index 1adec185..af731a18 100644 --- a/source/funkin/editors/character/CharacterAnimsWindow.hx +++ b/source/funkin/editors/character/CharacterAnimsWindow.hx @@ -81,8 +81,10 @@ class CharacterAnimsWindow extends UIButtonList { displayAnimsFramesList.set(name, {frame: anim.frames.getDefault([0])[0], scale: 104/Math.max(animBounds.width, animBounds.height), animBounds: animBounds}); } - public function removeAnimDisplay(name:String) + public function removeAnimDisplay(name:String) { + displayAnimsFramesList.remove(name); + } public function deleteAnimation(button:CharacterAnimButton, addToUndo:Bool = true) { FlxG.sound.play(Paths.sound(Flags.DEFAULT_EDITOR_DELETE_SOUND)); diff --git a/source/funkin/editors/character/CharacterGhost.hx b/source/funkin/editors/character/CharacterGhost.hx index 06f70792..94cad23a 100644 --- a/source/funkin/editors/character/CharacterGhost.hx +++ b/source/funkin/editors/character/CharacterGhost.hx @@ -5,6 +5,7 @@ import openfl.geom.ColorTransform; import flixel.animation.FlxAnimation; import funkin.game.Character; import haxe.xml.Access; +import animate.internal.RenderTexture; typedef AtlasState = { var oldAnim:String; @@ -71,6 +72,42 @@ class CharacterGhost extends Character { offset.set(globalOffset.x * (isPlayer != playerOffsets ? 1 : -1), -globalOffset.y); } + public function generateRenderTextureForAnim(anim:String):RenderTexture @:privateAccess { + if (!isAnimate) return null; + + var wasInvalidFrame:Bool = !colorTransform.__isDefault(false); + colorTransform.__identity(); + + var animName = animation.curAnim?.name ?? null; + var animFrame = animation.curAnim?.curFrame ?? 0; + var animFrameTimer = animation.curAnim?._frameTimer ?? 0; + + var oldRenderTexture:RenderTexture = this._renderTexture; + var oldRenderTextureDirty = _renderTextureDirty; + + this._renderTexture = null; + this._renderTextureDirty = true; + + animation.play(anim, true, false, 0); + + drawAnimate(FakeCallCamera.instance); + + var renderTex = this._renderTexture; + + this._renderTexture = oldRenderTexture; + this._renderTextureDirty = oldRenderTextureDirty; + + if (wasInvalidFrame) { + colorTransform.color = 0xFFEF0202; + } else { + animation.play(animName, true, false, animFrame); + if (animation.curAnim != null) + animation.curAnim._frameTimer = animFrameTimer; + } + + return renderTex; + } + // This gets annoying lmao -lunar // it's gone now <3 -yosh } \ No newline at end of file