diff --git a/assets/data/editors/layouts/stage/stageInfoScreen.xml b/assets/data/editors/layouts/stage/stageInfoScreen.xml
index d5e2bfaf..1a477da8 100644
--- a/assets/data/editors/layouts/stage/stageInfoScreen.xml
+++ b/assets/data/editors/layouts/stage/stageInfoScreen.xml
@@ -6,13 +6,26 @@
+ import haxe.ds.StringMap;
+ var oldInfo = {
+ name: stage.stageName,
+ folder: stage.spritesParentFolder,
+ startCamX: stage.startCam.x,
+ startCamY: stage.startCam.y,
+ zoom: stage.defaultZoom,
+ attrib: new StringMap()
+ };
+
function col(c:Int) {
return MARGIN + (170 + XOFFSET) * c;
}
- for(prop => val in stage.extra)
- if(!StringTools.startsWith(prop, "stageEditor."))
+ for(prop => val in stage.extra) {
+ if(!StringTools.startsWith(prop, "stageEditor.")) {
storedProps.push(prop);
+ oldInfo.attrib.set(prop, val);
+ }
+ }
@@ -78,8 +91,20 @@
for(prop in storedProps)
stage.extra.remove(prop);
- for(prop in attributesList.buttons.members)
+ var newInfo = {
+ name: stage.stageName,
+ folder: stage.spritesParentFolder,
+ startCamX: stage.startCam.x,
+ startCamY: stage.startCam.y,
+ zoom: stage.defaultZoom,
+ attrib: new StringMap()
+ };
+ for(prop in attributesList.buttons.members) {
stage.extra.set(prop.propertyText.label.text, prop.valueText.label.text);
+ newInfo.attrib.set(prop.propertyText.label.text, prop.valueText.label.text);
+ }
+
+ FlxG.state.undos.addToUndo(CEditInfo(oldInfo, newInfo));
}
\ No newline at end of file
diff --git a/source/funkin/editors/stage/StageEditor.hx b/source/funkin/editors/stage/StageEditor.hx
index 2416f6ed..54aa3f0e 100644
--- a/source/funkin/editors/stage/StageEditor.hx
+++ b/source/funkin/editors/stage/StageEditor.hx
@@ -123,7 +123,8 @@ class StageEditor extends UIState {
"hasCloseButton" => true,
"stage" => stage,
"Stage" => Stage,
- "exID" => exID
+ "exID" => exID,
+ "CEditInfo" => StageChange.CEditInfo
]
));
},
@@ -729,7 +730,16 @@ class StageEditor extends UIState {
case null:
// do nothing
case CEditInfo(oldInfo, newInfo):
- //editInfo(oldInfo, false);
+ stage.startCam.x = oldInfo.startCamX;
+ stage.startCam.y = oldInfo.startCamY;
+ stage.defaultZoom = oldInfo.zoom;
+ stage.stageName = oldInfo.name;
+ stage.spritesParentFolder = oldInfo.folder;
+
+ for (attrib in newInfo.attrib.keys())
+ stage.extra.remove(attrib);
+ for (attrib => val in oldInfo.attrib)
+ stage.extra.set(attrib, val);
case CTransform(sprite, oldInfo, newInfo):
sprite.setPosition(oldInfo.x, oldInfo.y);
sprite.scale.set(oldInfo.scaleX, oldInfo.scaleY);
@@ -745,7 +755,16 @@ class StageEditor extends UIState {
case null:
// do nothing
case CEditInfo(oldInfo, newInfo):
- editInfo(newInfo, false);
+ stage.startCam.x = newInfo.startCamX;
+ stage.startCam.y = newInfo.startCamY;
+ stage.defaultZoom = newInfo.zoom;
+ stage.stageName = newInfo.name;
+ stage.spritesParentFolder = newInfo.folder;
+
+ for (attrib in oldInfo.attrib.keys())
+ stage.extra.remove(attrib);
+ for (attrib => val in newInfo.attrib)
+ stage.extra.set(attrib, val);
case CTransform(sprite, oldInfo, newInfo):
sprite.setPosition(newInfo.x, newInfo.y);
sprite.scale.set(newInfo.scaleX, newInfo.scaleY);
@@ -755,20 +774,6 @@ class StageEditor extends UIState {
}
}
- /*public function editInfoWithUI() {
- FlxG.state.openSubState(new StageInfoScreen(stage, (_) -> {
- if (_ != null) editInfo(_);
- }));
- }*/
-
- public function editInfo(newInfo:Xml, addtoUndo:Bool = true) {
- /*var oldInfo = stage.buildXML();
- stage.applyXML(new Access(newInfo));
-
- if (addtoUndo)
- undos.addToUndo(CEditInfo(oldInfo, newInfo));*/
- }
-
public function selectSprite(_sprite:FunkinSprite) {
if(!UIUtil.getKeyState(CONTROL, PRESSED))
_select_deselect(null, false);
@@ -1237,6 +1242,15 @@ class StageEditor extends UIState {
var line:FlxSprite = null;
}
+typedef StageInfo = {
+ name:String,
+ folder:String,
+ startCamX:Float,
+ startCamY:Float,
+ zoom:Float,
+ attrib:Map
+};
+
typedef StageSprInfo = {
x:Float,
y:Float,
@@ -1248,7 +1262,7 @@ typedef StageSprInfo = {
}
enum StageChange {
- CEditInfo(oldInfo:Xml, newInfo:Xml);
+ CEditInfo(oldInfo:StageInfo, newInfo:StageInfo);
CTransform(sprite:FunkinSprite, oldInfo:StageSprInfo, newInfo:StageSprInfo);
}