edit sprite alot better!!!
This commit is contained in:
@@ -264,9 +264,7 @@ class CharacterAnimButton extends UIButton {
|
||||
if (parent.character.animateAtlas != null)
|
||||
__refreshAnimation();
|
||||
else {
|
||||
trace(parent.character.animation._animations);
|
||||
var flxAnimation:FlxAnimation = __getFlxAnimation();
|
||||
trace(parent.character.animation._animations);
|
||||
flxAnimation.prefix = newAnim;
|
||||
|
||||
refreshFlxAnimationFrames(flxAnimation, animData);
|
||||
@@ -343,12 +341,9 @@ class CharacterAnimButton extends UIButton {
|
||||
|
||||
flxAnimation.frames = frameIndices;
|
||||
} else {
|
||||
trace(flxAnimation.prefix);
|
||||
final animFrames:Array<FlxFrame> = new Array<FlxFrame>();
|
||||
parent.character.animation.findByPrefix(animFrames, flxAnimation.prefix);
|
||||
|
||||
trace(animFrames);
|
||||
|
||||
final frameIndices:Array<Int> = [];
|
||||
parent.character.animation.byPrefixHelper(frameIndices, animFrames, flxAnimation.prefix);
|
||||
|
||||
@@ -358,7 +353,7 @@ class CharacterAnimButton extends UIButton {
|
||||
if (flxAnimation.frames.length <= 0) invalidate();
|
||||
else validate();
|
||||
} catch (e) {
|
||||
trace('$e ${e.details}');
|
||||
trace('ERROR REFRESHING FLXANIMATION FRAMES: $e');
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@@ -375,19 +370,15 @@ class CharacterAnimButton extends UIButton {
|
||||
var wasRefreshed:Bool = false;
|
||||
|
||||
try {
|
||||
if (animData.indices.length > 0) {
|
||||
parent.character.animateAtlas.anim.animsMap.remove(animData.name);
|
||||
if (animData.indices.length > 0)
|
||||
parent.character.animateAtlas.anim.addBySymbolIndices(animData.name, animData.anim, animData.indices, animData.fps, animData.loop);
|
||||
wasRefreshed = true;
|
||||
} else {
|
||||
for (name in parent.character.animateAtlas.anim.symbolDictionary.keys())
|
||||
if (parent.character.animateAtlas.anim.startsWith(name, animData.anim)) {
|
||||
symbol.instance.symbol.name = name;
|
||||
wasRefreshed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
parent.character.animateAtlas.anim.addBySymbol(animData.name, animData.anim, animData.fps, animData.loop);
|
||||
wasRefreshed = parent.character.animateAtlas.anim.animsMap.exists(animData.name);
|
||||
if (!wasRefreshed) __getAnimationSymbol();
|
||||
} catch (e) {
|
||||
trace('$e');
|
||||
trace('ERROR REFRESHING SYMBOL FRAMES: $e');
|
||||
}
|
||||
|
||||
validate(wasRefreshed);
|
||||
|
||||
@@ -513,7 +513,6 @@ class CharacterEditor extends UIState {
|
||||
}
|
||||
|
||||
function _set_offset(x:Float, y:Float) {
|
||||
trace(character.getAnimName(), characterAnimsWindow.animButtons);
|
||||
if (character.getAnimName() == null) return;
|
||||
characterAnimsWindow.animButtons.get(character.getAnimName()).changeOffset(
|
||||
FlxMath.roundDecimal(x, 2), FlxMath.roundDecimal(y, 2)
|
||||
@@ -627,16 +626,19 @@ class CharacterEditor extends UIState {
|
||||
stage.characterPoses[stagePosition].revertCharacter(character);
|
||||
|
||||
changeCharacterIsPlayer(player);
|
||||
remove(character);
|
||||
|
||||
if (stage.characterPoses.exists(stagePosition))
|
||||
stage.applyCharStuff(character, stagePosition, 0);
|
||||
updateCharacterStagePosition();
|
||||
_animation_play(null);
|
||||
|
||||
characterPropertiesWindow.designedAsDropDown.index = characterPropertiesWindow.designedAsDropDown.options.indexOf(player ? "BOYFRIEND" : "DAD");
|
||||
characterPropertiesWindow.designedAsDropDown.label.text = player ? "BOYFRIEND" : "DAD";
|
||||
}
|
||||
|
||||
public inline function updateCharacterStagePosition() {
|
||||
remove(character);
|
||||
if (stage.characterPoses.exists(stagePosition))
|
||||
stage.applyCharStuff(character, stagePosition, 0);
|
||||
}
|
||||
|
||||
public function changeCharacterIsPlayer(player:Bool) @:privateAccess {
|
||||
if (character.__swappedLeftRightAnims)
|
||||
character.swapLeftRightAnimations();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package funkin.editors.character;
|
||||
|
||||
import funkin.backend.FlxAnimate;
|
||||
import haxe.io.Path;
|
||||
import funkin.editors.character.CharacterInfoScreen.CharacterExtraInfo;
|
||||
import funkin.game.Character;
|
||||
@@ -156,21 +157,27 @@ class CharacterPropertiesWindow extends UISliceSprite {
|
||||
|
||||
character.sprite = sprite;
|
||||
|
||||
animsWindow.displayWindowSprite.animation.reset();
|
||||
animsWindow.displayAnimsFramesList.clear();
|
||||
if (animsWindow.displayWindowGraphic != null)
|
||||
animsWindow.displayWindowGraphic.destroy();
|
||||
|
||||
if (Assets.exists('$noExt/Animation.json')) {
|
||||
if (character.animateAtlas == null) {
|
||||
character.animation.reset();
|
||||
character.animateAtlas = new FlxAnimate(character.x, character.y);
|
||||
} else
|
||||
character.animateAtlas.anim.stop();
|
||||
|
||||
character.atlasPath = noExt;
|
||||
character.animateAtlas.loadAtlas(noExt);
|
||||
|
||||
character.animateAtlas.anim.animsMap.clear();
|
||||
character.animateAtlas.anim.symbolDictionary.clear();
|
||||
|
||||
character.animateAtlas.anim.stop();
|
||||
} else {
|
||||
if (character.animateAtlas != null) {
|
||||
character.animateAtlas.destroy();
|
||||
character.animateAtlas = null;
|
||||
character.atlasPlayingAnim = character.atlasPath = null;
|
||||
}
|
||||
character.frames = Paths.getFrames(path, true);
|
||||
character.animation.reset();
|
||||
|
||||
animsWindow.displayWindowSprite.animation.reset();
|
||||
if (animsWindow.displayWindowGraphic != null)
|
||||
animsWindow.displayWindowGraphic.destroy();
|
||||
|
||||
animsWindow.displayWindowSprite.loadGraphicFromSprite(character);
|
||||
if (Assets.exists(Paths.image('characters/${character.sprite}')))
|
||||
@@ -178,8 +185,9 @@ class CharacterPropertiesWindow extends UISliceSprite {
|
||||
}
|
||||
|
||||
character.animDatas.clear();
|
||||
for (anim in animsWindow.buttons)
|
||||
anim.checkValid(); // Re-add all animations
|
||||
for (anim in animsWindow.buttons) anim.checkValid(); // Re-add all animations
|
||||
|
||||
CharacterEditor.instance.playAnimation(animsWindow.findValid().getDefault(animsWindow.buttons.members[0].anim));
|
||||
}
|
||||
|
||||
public function changeFlipX(newFlipX:Bool) @:privateAccess {
|
||||
|
||||
Reference in New Issue
Block a user