Added XML Editing of anything
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<window width="1056" height="520" title="Editing Sprite ${button.getName()}">
|
||||
<set name="MARGIN" value="20" />
|
||||
<set name="XOFFSET" value="50" />
|
||||
<set name="YOFFSET" value="40" />
|
||||
<set name="TO" value="64" />
|
||||
@@ -24,7 +25,7 @@
|
||||
<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 In (${stage.spritesParentFolder})" x="spriteTextBox.x" y="spriteTextBox.y - 14" size="15" />
|
||||
<label name="imageFile" text="Image File (WIP: needs reload) In (${stage.spritesParentFolder})" x="spriteTextBox.x" y="spriteTextBox.y - 14" size="15" />
|
||||
</section>
|
||||
|
||||
<section> <!-- ROW 2 -->
|
||||
@@ -67,6 +68,44 @@
|
||||
<!-- TODO: Animation list -->
|
||||
</section>
|
||||
|
||||
<section> <!-- RIGHT SIDE -->
|
||||
<set name="curY" value="title.y + TO" />
|
||||
<set name="listWidth" value="250" />
|
||||
|
||||
<buttonlist name="animations" label="Animations (TODO)" x="col(3)" y="curY" width="listWidth" height="330" buttonSizeX="listWidth-10" buttonSizeY="35" buttonSpacing="5">
|
||||
<texture path="editors/ui/inputbox" />
|
||||
<camSpacing value="0" />
|
||||
|
||||
<code>
|
||||
buttonlist.addButton.exists = false;
|
||||
</code>
|
||||
|
||||
<!-- <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, 150, 220, 25));
|
||||
}
|
||||
|
||||
//var defaultAttribs = Stage.DEFAULT_ATTRIBUTES;
|
||||
//for (i in stage.stageXML.attributes()) {
|
||||
// trace(i, defaultAttribs);
|
||||
// if (!defaultAttribs.contains(i))
|
||||
// buttonList.add(new PropertyButton(i, stage.stageXML.get(i), buttonList, width, height, 150, 220, 25));
|
||||
//}
|
||||
for(key => val in stage.extra)
|
||||
buttonList.add(new PropertyButton(key, val, buttonList, width, height, 150, 220, 25));
|
||||
</code> -->
|
||||
</buttonlist>
|
||||
|
||||
<text text="Tip: To access custom properties, hold shift when clicking edit" x="col(2) - 60" y="self.winHeight - 50" size="15" />
|
||||
</section>
|
||||
|
||||
|
||||
<!-- Preview Transform -->
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<window width="450" height="570" title="Editing XML ${type}">
|
||||
<!-- BASED ON unknownEditScreen.xml -->
|
||||
<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" />
|
||||
<set name="listWidth" value="self.winWidth - MARGIN * 2" />
|
||||
|
||||
<buttonlist name="attributesList" label="Attributes" x="col(0)" y="curY" width="listWidth" height="400" 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, 160, 195, 25));
|
||||
}
|
||||
|
||||
for (i in xml.attributes())
|
||||
buttonList.add(new PropertyButton(i, xml.get(i), buttonList, width, height, 160, 195, 25));
|
||||
</code>
|
||||
</buttonlist>
|
||||
</section>
|
||||
|
||||
<exec>
|
||||
function onSave() {
|
||||
for (i in xml.attributes())
|
||||
xml.remove(i);
|
||||
|
||||
for (val in attributesList.buttons.members)
|
||||
xml.set(val.propertyText.label.text, val.valueText.label.text);
|
||||
}
|
||||
</exec>
|
||||
</window>
|
||||
Reference in New Issue
Block a user