Added label checkbox in Character Editor
This commit is contained in:
@@ -433,6 +433,8 @@
|
||||
<str id="position">Position (X, Y)</str>
|
||||
<str id="fps">FPS</str>
|
||||
<str id="indices">Indices (Frames)</str>
|
||||
<str id="looping">Looping?</str>
|
||||
<str id="label">Label</str>
|
||||
</group>
|
||||
|
||||
<group name="CharacterSpriteScreen" prefix="characterSpriteScreen.">
|
||||
|
||||
@@ -21,6 +21,7 @@ class CharacterAnimButton extends UIButton {
|
||||
public var animationDisplayBG:UISliceSprite;
|
||||
public var nameTextBox:UITextBox;
|
||||
public var animTextBox:UIAutoCompleteTextBox;
|
||||
public var animLabelCheckbox:UICheckbox;
|
||||
public var positionXStepper:UINumericStepper;
|
||||
public var positionYStepper:UINumericStepper;
|
||||
public var fpsStepper:UINumericStepper;
|
||||
@@ -111,13 +112,20 @@ class CharacterAnimButton extends UIButton {
|
||||
foldableButtons.push(fpsStepper);
|
||||
addLabelOn(fpsStepper, translate("fps"), 12);
|
||||
|
||||
loopedCheckbox = new UICheckbox(fpsStepper.x + 82 - 32 + 26, fpsStepper.y, "Looping?", animData.loop, 0, true);
|
||||
loopedCheckbox = new UICheckbox(fpsStepper.x + 82 - 32 + 26, fpsStepper.y, translate("looping"), animData.loop, 0, true);
|
||||
loopedCheckbox.onChecked = (newLooping:Bool) -> {this.changeLooping(newLooping);};
|
||||
members.push(loopedCheckbox);
|
||||
foldableButtons.push(loopedCheckbox);
|
||||
|
||||
loopedCheckbox.x += 8; loopedCheckbox.y += 6;
|
||||
|
||||
if (parent.character.isAnimate) {
|
||||
animLabelCheckbox = new UICheckbox(loopedCheckbox.x, animTextBox.y + 26, translate("label"), animData.label, 0, true);
|
||||
animLabelCheckbox.onChecked = (newLabel:Bool) -> {this.changeLabel(newLabel);};
|
||||
members.push(animLabelCheckbox);
|
||||
foldableButtons.push(animLabelCheckbox);
|
||||
}
|
||||
|
||||
indicesTextBox = new UITextBox(nameTextBox.x, nameTextBox.y, CoolUtil.formatNumberRange(animData.indices.getDefault([]), ", "), 278, 22, false, true);
|
||||
indicesTextBox.onChange = (text:String) -> {
|
||||
this.changeIndicies(CoolUtil.parseNumberRange(text));
|
||||
@@ -199,6 +207,7 @@ class CharacterAnimButton extends UIButton {
|
||||
|
||||
fpsStepper.follow(this, 282, 118);
|
||||
loopedCheckbox.follow(this, 336, 122);
|
||||
animLabelCheckbox?.follow(this, 336, 98);
|
||||
|
||||
indicesTextBox.follow(this, 158, 164);
|
||||
|
||||
@@ -343,6 +352,19 @@ class CharacterAnimButton extends UIButton {
|
||||
if (addToUndo) CharacterEditor.undos.addToUndo(CAnimEditLooping(ID, newLooping));
|
||||
}
|
||||
|
||||
public function changeLabel(newLabel:Bool, addToUndo:Bool = true) @:privateAccess {
|
||||
var animData:AnimData = parent.character.animDatas[anim];
|
||||
|
||||
animData.label = newLabel;
|
||||
|
||||
if (animLabelCheckbox != null)
|
||||
animLabelCheckbox.checked = newLabel;
|
||||
|
||||
__refreshAnimation();
|
||||
|
||||
if (addToUndo) CharacterEditor.undos.addToUndo(CAnimEditLabel(ID, newLabel));
|
||||
}
|
||||
|
||||
public function changeIndicies(indicies:Array<Int>, addToUndo:Bool = true) @:privateAccess {
|
||||
var animData:AnimData = parent.character.animDatas[anim];
|
||||
var oldIndices:Array<Int> = animData.indices.copy();
|
||||
|
||||
@@ -554,6 +554,9 @@ class CharacterEditor extends UIState {
|
||||
case CAnimEditLooping(animID, newLooping):
|
||||
var button:CharacterAnimButton = characterAnimsWindow.buttons.members[animID];
|
||||
button.changeLooping(!newLooping, false);
|
||||
case CAnimEditLabel(animID, newLabel):
|
||||
var button:CharacterAnimButton = characterAnimsWindow.buttons.members[animID];
|
||||
button.changeLabel(!newLabel, false);
|
||||
case CAnimEditIndices(animID, oldIndicies, newIndicies):
|
||||
var button:CharacterAnimButton = characterAnimsWindow.buttons.members[animID];
|
||||
button.changeIndicies(oldIndicies, false);
|
||||
@@ -625,6 +628,9 @@ class CharacterEditor extends UIState {
|
||||
case CAnimEditLooping(animID, newLooping):
|
||||
var button:CharacterAnimButton = characterAnimsWindow.buttons.members[animID];
|
||||
button.changeLooping(newLooping, false);
|
||||
case CAnimEditLabel(animID, newLabel):
|
||||
var button:CharacterAnimButton = characterAnimsWindow.buttons.members[animID];
|
||||
button.changeLabel(newLabel, false);
|
||||
case CAnimEditIndices(animID, oldIndicies, newIndicies):
|
||||
var button:CharacterAnimButton = characterAnimsWindow.buttons.members[animID];
|
||||
button.changeIndicies(newIndicies, false);
|
||||
@@ -936,6 +942,7 @@ enum CharacterEditorChange {
|
||||
CAnimEditFPS(animID:Int, oldFPS:Float, newFPS:Float);
|
||||
CAnimEditLooping(animID:Int, newLooping:Bool);
|
||||
CAnimEditIndices(animID:Int, oldIndicies:Array<Int>, newIndicies:Array<Int>);
|
||||
CAnimEditLabel(animID:Int, newLabel:Bool);
|
||||
|
||||
CCharClearOffsets(oldOffsets:Map<String, FlxPoint>);
|
||||
}
|
||||
@@ -439,7 +439,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
"color", "gameOverChar", "holdTime"
|
||||
];
|
||||
public static var characterAnimProperties:Array<String> = [
|
||||
"name", "anim", "x", "y", "fps", "loop", "indices"
|
||||
"name", "anim", "label", "x", "y", "fps", "loop", "indices"
|
||||
];
|
||||
|
||||
public inline function buildXML(?animsOrder:Array<String>):Xml {
|
||||
@@ -491,6 +491,9 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
if (anim.indices.length > 0)
|
||||
animXml.set("indices", CoolUtil.formatNumberRange(anim.indices));
|
||||
|
||||
if (anim.label)
|
||||
animXml.set("label", "true");
|
||||
|
||||
xml.addChild(animXml);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user