editors/ inside data/

This commit is contained in:
⍚~Nex
2024-04-16 23:24:53 +02:00
parent f61502c2d5
commit 88eb0d48e0
7 changed files with 4 additions and 4 deletions
@@ -0,0 +1,115 @@
<window width="550" height="570" title="Editing Character ${button.getName()}">
<set name="XOFFSET" value="30" />
<set name="YOFFSET" value="40" />
<set name="TO" value="64" />
<exec>
function col(c:Int) {
return 20 + (150 + XOFFSET) * c;
}
previewSprite = null;
if(char.animateAtlas == null) {
previewSprite = new FunkinSprite(0, 0);
previewSprite.frame = char.frame;
self.add(previewSprite);
}
</exec>
<title name="title" x="20" y="30 + 16" text="Character Data" />
<section>
<set name="curY" value="title.y + TO" />
<stepper name="xStepper" label="X" value="charPos.x" x="col(0)" y="curY" step="1" width="100" />
<stepper name="yStepper" label="Y" value="charPos.y" x="last.x + last.bWidth + XOFFSET - 20" y="curY" step="1" width="100" />
<stepper name="scrollXStepper" label="Scroll X" value="charPos.scrollFactor.x" x="col(1)" y="curY" precision="2" step="0.01" width="100" />
<stepper name="scrollYStepper" label="Scroll Y" value="charPos.scrollFactor.y" x="last.x + last.bWidth + XOFFSET - 20" y="curY" precision="2" step="0.01" width="100" />
<stepper name="scaleXStepper" label="Scale X" value="charPos.scale.x" x="col(2)" y="curY" precision="2" step="0.01" width="100" />
<stepper name="scaleYStepper" label="Scale Y" value="charPos.scale.y" x="last.x + last.bWidth + XOFFSET - 20" y="curY" precision="2" step="0.01" width="100" />
</section>
<section>
<set name="curY" value="xStepper.y + xStepper.bHeight + YOFFSET" />
<stepper name="camxStepper" label="Cam X" value="charPos.camxoffset" x="col(0)" y="curY" step="1" width="100" />
<stepper name="camyStepper" label="Cam Y" value="charPos.camyoffset" x="last.x + last.bWidth + XOFFSET - 20" y="curY" step="1" width="100" />
<label name="spacingLabel" text="Spacing (X, Y)" x="col(1)" y="curY" size="15" />
<stepper name="spacingXStepper" value="charPos.charSpacingX" x="col(1)" y="curY" precision="2" step="0.01" width="100" />
<stepper name="spacingYStepper" value="charPos.charSpacingY" x="last.x + last.bWidth + XOFFSET - 20" y="curY" precision="2" step="0.01" width="100" />
<stepper name="skewXStepper" label="Skew X" value="charPos.skewX" x="col(2)" y="curY" precision="2" step="0.01" width="100" />
<stepper name="skewYStepper" label="Skew Y" value="charPos.skewY" x="last.x + last.bWidth + XOFFSET - 20" y="curY" precision="2" step="0.01" width="100" />
</section>
<section>
<set name="curY" value="camxStepper.y + camxStepper.bHeight + YOFFSET" />
<stepper name="alphaStepper" label="Alpha" value="charPos.alpha" x="col(0)" y="curY" precision="2" step="0.01" width="100" />
<stepper name="angleStepper" label="Angle" value="charPos.angle" x="last.x + last.bWidth + XOFFSET - 20" y="curY" precision="2" step="0.01" width="100" />
<stepper name="zoomFactorStepper" label="Zoom Factor" value="charPos.zoomFactor" x="col(1)" y="curY" precision="2" step="0.01" width="100" />
</section>
<section>
<set name="curY" value="alphaStepper.y + alphaStepper.bHeight + YOFFSET - 20" />
<checkbox name="flipXCheckbox" text="Flip X" value="charPos.flipX" x="col(0)" y="curY" />
<radio for="memoryCheck" name="highMemoryRadio" text="High Memory Only" value="getEx('highMemory')" x="last.field.x + last.field.width + XOFFSET * 2" y="curY" />
<radio for="memoryCheck" name="lowMemoryRadio" text="Low Memory Only" value="getEx('lowMemory')" x="last.field.x + last.field.width + XOFFSET * 2" y="curY" />
</section>
<section if="previewSprite != null">
<title name="previewTitle" x="20" y="self.winHeight - 220" text="Preview Transform:" size="15" />
</section>
<section if="previewSprite == null">
<exec>
self.windowSpr.bHeight -= 170;
</exec>
</section>
<exec>
function onUpdate() {
if(previewSprite == null) return;
previewSprite.skew.x = skewXStepper.value;
previewSprite.skew.y = skewYStepper.value;
previewSprite.angle = angleStepper.value;
previewSprite.antialiasing = char.antialiasing;
var ratio = char.frameWidth / char.frameHeight;
previewSprite.setGraphicSize(145 * scaleXStepper.value * ratio, 145 * scaleYStepper.value);
previewSprite.updateHitbox();
if(flipXCheckbox.checked != (charPos.name == "boyfriend"))
previewSprite.scale.x *= -1;
previewSprite.x = 30;
previewSprite.y = self.winHeight - previewSprite.height - 30;
}
function onSave() {
setEx("highMemory", highMemoryRadio.checked);
setEx("lowMemory", lowMemoryRadio.checked);
charPos.x = xStepper.value;
charPos.y = yStepper.value;
charPos.scrollFactor.set(scrollXStepper.value, scrollYStepper.value);
charPos.scale.set(scaleXStepper.value, scaleYStepper.value);
charPos.camxoffset = camxStepper.value;
charPos.camyoffset = camyStepper.value;
charPos.skewX = skewXStepper.value;
charPos.skewY = skewYStepper.value;
charPos.alpha = alphaStepper.value;
charPos.charSpacingX = spacingXStepper.value;
charPos.charSpacingY = spacingYStepper.value;
charPos.flipX = flipXCheckbox.checked;
charPos.zoomFactor = zoomFactorStepper.value;
charPos.angle = angleStepper.value;
charPos.revertCharacter(char);
charPos.prepareCharacter(char, charPos._id);
}
</exec>
</window>
@@ -0,0 +1,139 @@
<window width="1056" height="520" title="Editing Sprite ${button.getName()}">
<set name="XOFFSET" value="50" />
<set name="YOFFSET" value="40" />
<set name="TO" value="64" />
<exec>
function col(c:Int) {
return 20 + (200 + XOFFSET) * c;
}
if(sprite.animateAtlas == null) {
previewSprite = new FunkinSprite(50, self.winHeight - 100);
previewSprite.frame = sprite.frame;
self.add(previewSprite);
}
</exec>
<title name="title" x="20" y="30 + 16" text="Sprite Data" />
<section> <!-- ROW 1 -->
<set name="curY" value="title.y + TO" />
<textbox name="nameTextBox" label="Name Identifier" value="button.getName()" x="col(0)" y="curY" width="200" height="32" />
<textbox name="spriteTextBox" value="getEx('imageFile')" x="last.x + last.bWidth + XOFFSET" y="curY" width="200" height="32" />
<stepper name="alphaStepper" label="Alpha" value="sprite.alpha" x="spriteTextBox.x + spriteTextBox.bWidth + XOFFSET" y="curY" precision="2" step="0.01" width="100" />
<label name="imageFile" text="Image File&#10;In (${stage.spritesParentFolder})" x="spriteTextBox.x" y="spriteTextBox.y - 14" size="15" />
</section>
<section> <!-- ROW 2 -->
<set name="curY" value="nameTextBox.y + nameTextBox.bHeight + YOFFSET" />
<stepper name="xStepper" label="X" value="sprite.x" x="col(0)" y="curY" step="1" width="100" />
<stepper name="yStepper" label="Y" value="sprite.y" x="last.x + last.bWidth + XOFFSET - 20" y="curY" step="1" width="100" />
<stepper name="scrollXStepper" label="Scroll X" value="sprite.scrollFactor.x" x="spriteTextBox.x" y="curY" precision="2" step="0.01" width="100" />
<stepper name="scrollYStepper" label="Scroll Y" value="sprite.scrollFactor.y" x="last.x + last.bWidth + XOFFSET - 20" y="curY" precision="2" step="0.01" width="100" />
<stepper name="scaleXStepper" label="Scale X" value="sprite.scale.x" x="col(2)" y="curY" precision="2" step="0.01" width="100" />
<stepper name="scaleYStepper" label="Scale Y" value="sprite.scale.y" x="last.x + last.bWidth + XOFFSET - 20" y="curY" precision="2" step="0.01" width="100" />
</section>
<section> <!-- ROW 3 -->
<set name="curY" value="xStepper.y + xStepper.bHeight + YOFFSET" />
<stepper name="angleStepper" label="Angle" value="sprite.angle" x="col(0)" y="curY" precision="2" step="0.01" width="100" />
<stepper name="zoomFactorStepper" label="Zoom Factor" value="sprite.zoomFactor" x="last.x + last.bWidth + XOFFSET - 20" y="curY" precision="2" step="0.01" width="100" />
<!-- TODO: Simplify this -->
<dropdown name="animType" label="Animation Type" value="sprite.spriteAnimType" x="col(1)" y="curY" width="150" height="32">
<item label="NONE" value="0" />
<item label="BEAT" value="1" />
<item label="LOOP" value="2" />
</dropdown>
<stepper name="skewXStepper" label="Skew X" value="sprite.skew.x" x="col(2)" y="curY" precision="2" step="0.01" width="100" />
<stepper name="skewYStepper" label="Skew Y" value="sprite.skew.y" x="last.x + last.bWidth + XOFFSET - 20" y="curY" precision="2" step="0.01" width="100" />
</section>
<section> <!-- ROW 4 -->
<set name="curY" value="angleStepper.y + angleStepper.bHeight + YOFFSET" />
<checkbox name="antialiasingCheckbox" text="Antialiasing" value="sprite.antialiasing" x="col(0)" y="curY" />
<radio for="memoryCheck" name="highMemoryRadio" text="High Memory Only" value="getEx('highMemory')" x="col(1)" y="curY" />
<radio for="memoryCheck" name="lowMemoryRadio" text="Low Memory Only" value="getEx('lowMemory')" x="col(2)" y="curY" />
<!-- TODO: Animation list -->
</section>
<!-- Preview Transform -->
<section if="previewSprite != null">
<title name="previewTitle" x="20" y="self.winHeight - 150" text="Preview Transform:" size="15" />
</section>
<exec>
function onUpdate() {
if(previewSprite == null) return;
previewSprite.color = 0xFFFFFFFF; // TODO: Color Wheel
previewSprite.skew.x = skewXStepper.value;
previewSprite.skew.y = skewYStepper.value;
previewSprite.angle = angleStepper.value;
previewSprite.alpha = alphaStepper.value;
previewSprite.antialiasing = antialiasingCheckbox.checked;
var ratio = sprite.width / sprite.height;
previewSprite.setGraphicSize(50 * scaleXStepper.value * ratio, 50 * scaleYStepper.value);
previewSprite.updateHitbox();
}
function onSave() {
sprite.name = nameTextBox.label.text;
setEx("imageFile", spriteTextBox.label.text);
setEx("highMemory", highMemoryRadio.checked);
setEx("lowMemory", lowMemoryRadio.checked);
//sprite.x = xStepper.value;
//sprite.y = yStepper.value;
//sprite.zoomFactor = zoomFactorStepper.value;
//sprite.antialiasing = antialiasingCheckbox.checked;
//sprite.color = colorWheel.color;
//sprite.spriteAnimType = animType.value;
sprite.angle = angleStepper.value;
sprite.alpha = alphaStepper.value;
function saveXY(obj:Dynamic, name:String, x:UINumericStepper, y:UINumericStepper) {
button.xml.remove(name + "");
button.xml.remove(name + "x");
button.xml.remove(name + "y");
obj.x = x.value;
obj.y = y.value;
if(x.value == y.value)
button.xml.set(name, x.value);
else {
button.xml.set(name + "x", x.value);
button.xml.set(name + "y", y.value);
}
}
button.xml.set("name", nameTextBox.label.text);
button.xml.set("sprite", spriteTextBox.label.text);
button.xml.set("x", xStepper.value);
button.xml.set("y", yStepper.value);
button.xml.set("zoom", zoomFactorStepper.value);
button.xml.set("type", animType.key);
button.xml.set("antialiasing", antialiasingCheckbox.checked);
button.xml.set("angle", angleStepper.value);
button.xml.set("alpha", alphaStepper.value);
saveXY(sprite.scrollFactor, "scroll", scrollXStepper, scrollYStepper);
saveXY(sprite.scale, "scale", scaleXStepper, scaleYStepper);
saveXY(sprite.skew, "skew", skewXStepper, skewYStepper);
XMLUtil.loadSpriteFromXML(sprite, button.xml, stage.spritesParentFolder);
}
</exec>
</window>
@@ -0,0 +1,63 @@
<window width="350" height="570" title="Editing XML <${button.getName()} />">
<set name="MARGIN" value="20" />
<set name="XOFFSET" value="30" />
<set name="YOFFSET" value="40" />
<set name="TO" value="64" />
<exec>
function col(c:Int) {
return MARGIN + (150 + XOFFSET) * c;
}
</exec>
<title name="title" x="MARGIN" y="30 + 16" text="Xml Data" />
<section>
<set name="curY" value="title.y + TO" />
<textbox name="nodeNameTextBox" label="Element Name" value="button.getName()" x="col(0)" y="curY" width="280" height="32" />
</section>
<section>
<set name="curY" value="nodeNameTextBox.y + nodeNameTextBox.bHeight + YOFFSET - 30" />
<radio for="memoryCheck" name="highMemoryRadio" text="High Memory Only" value="button.highMemory" x="col(0)" y="curY" />
<radio for="memoryCheck" name="lowMemoryRadio" text="Low Memory Only" value="button.lowMemory" x="col(0)" y="last.y + last.check.height + YOFFSET - 30" />
</section>
<section>
<set name="curY" value="lowMemoryRadio.y + lowMemoryRadio.check.height + YOFFSET" />
<set name="listWidth" value="self.winWidth - MARGIN * 2" />
<buttonlist name="attributesList" label="Attributes" x="col(0)" y="curY" width="listWidth" height="260" buttonSizeX="listWidth-10" buttonSizeY="35" buttonSpacing="5">
<texture path="editors/ui/inputbox" />
<camSpacing value="0" />
<code>
import funkin.editors.extra.PropertyButton;
var buttonList = buttonlist; // important for now, since it gets reset after the code is run
var width = buttonList.buttonSize.x;
var height = buttonList.buttonSize.y;
buttonList.addButton.callback = function() {
buttonList.add(new PropertyButton("newProperty", "valueHere", buttonList, width, height, 110, 145, 25));
}
for (i in xml.attributes())
buttonList.add(new PropertyButton(i, xml.get(i), buttonList, width, height, 110, 145, 25));
</code>
</buttonlist>
</section>
<exec>
function onSave() {
button.xml.nodeName = nodeNameTextBox.label.text;
button.highMemory = highMemoryRadio.checked;
button.lowMemory = lowMemoryRadio.checked;
for (val in attributesList.buttons.members)
xml.set(val.propertyText.label.text, val.valueText.label.text);
}
</exec>
</window>