Seperate pretty print options for the Chart, Character, and Stage editors.
The editors that save as xmls have pretty print enabled by default btw
This commit is contained in:
@@ -157,8 +157,14 @@
|
||||
<str id="editorSFX-name">Editor SFXs</str>
|
||||
<str id="editorSFX-desc">If checked, will play sound effects when working on editors (ex: will play sfxs when checking checkboxes...)</str>
|
||||
|
||||
<str id="editorPrettyPrint-name">Pretty Print</str>
|
||||
<str id="editorPrettyPrint-desc">If checked, the saved files from the editor will be formatted to be easily viewable (does not apply to xmls...)</str>
|
||||
<str id="editorCharterPrettyPrint-name">Chart Pretty Print</str>
|
||||
<str id="editorCharterPrettyPrint-desc">If checked, the saved files from the chart editor will be formatted to be easily viewable</str>
|
||||
|
||||
<str id="editorCharacterPrettyPrint-name">Character Pretty Print</str>
|
||||
<str id="editorCharacterPrettyPrint-desc">If checked, the saved files from the character editor will be formatted to be easily viewable</str>
|
||||
|
||||
<str id="editorStagePrettyPrint-name">Stage Pretty Print</str>
|
||||
<str id="editorStagePrettyPrint-desc">If checked, the saved files from the stage editor will be formatted to be easily viewable</str>
|
||||
|
||||
<str id="intensiveBlur-name">Intensive Blur</str>
|
||||
<str id="intensiveBlur-desc">If checked, will use more intensive blur that may be laggier but look better.</str>
|
||||
|
||||
@@ -157,9 +157,6 @@ If checked, only musics will have streamed audio, ALSO freeing a LOT of memory w
|
||||
<str id="editorSFX-name">Dźwięki Edytorów</str>
|
||||
<str id="editorSFX-desc">Jeśli włączone, niektóre elementy edytorów będą grać dźwięki. (Na przykład: dźwięki pól wyboru...)</str>
|
||||
|
||||
<str id="editorPrettyPrint-name">Ładny Druk</str>
|
||||
<str id="editorPrettyPrint-desc">Jeśli włączone, zapisane pliki z edytorów będą używać formatowania łatwiejszego do odczytania. (opcja nie dotyczy plików xml, tylko po angielsku...)</str>
|
||||
|
||||
<str id="intensiveBlur-name">Mocniejszy Rozmaz</str>
|
||||
<str id="intensiveBlur-desc">Jeśli włączone, gra użyje mocniejszego rozmazu, który kosztuje wydajność, ale wygląda lepiej.</str>
|
||||
|
||||
|
||||
@@ -49,9 +49,17 @@ class DebugOptionsScreen extends OptionsScreen {
|
||||
getDesc("editorSFX"),
|
||||
"editorSFX"));
|
||||
add(new Checkbox(
|
||||
getName("editorPrettyPrint"),
|
||||
getDesc("editorPrettyPrint"),
|
||||
"editorPrettyPrint"));
|
||||
getName("editorCharterPrettyPrint"),
|
||||
getDesc("editorCharterPrettyPrint"),
|
||||
"editorCharterPrettyPrint"));
|
||||
add(new Checkbox(
|
||||
getName("editorCharacterPrettyPrint"),
|
||||
getDesc("editorCharacterPrettyPrint"),
|
||||
"editorCharacterPrettyPrint"));
|
||||
add(new Checkbox(
|
||||
getName("editorStagePrettyPrint"),
|
||||
getDesc("editorStagePrettyPrint"),
|
||||
"editorStagePrettyPrint"));
|
||||
add(new Checkbox(
|
||||
getName("intensiveBlur"),
|
||||
getDesc("intensiveBlur"),
|
||||
|
||||
@@ -484,7 +484,8 @@ class CharacterEditor extends UIState {
|
||||
button.anim
|
||||
]);
|
||||
|
||||
return "<!DOCTYPE codename-engine-character>\n" + Printer.print(charXML, true);
|
||||
var xmlThingYea:String = "<!DOCTYPE codename-engine-character>\n" + Printer.print(charXML, Options.editorCharacterPrettyPrint);
|
||||
return Options.editorCharacterPrettyPrint ? xmlThingYea : xmlThingYea.replace("\n", "");
|
||||
}
|
||||
|
||||
var clipboard:FlxPoint = FlxPoint.get();
|
||||
|
||||
@@ -788,9 +788,9 @@ class Charter extends UIState {
|
||||
var songPath:String = '${Paths.getAssetsRoot()}/songs/${__song.toLowerCase()}';
|
||||
|
||||
if (Options.charterAutoSavesSeparateFolder)
|
||||
Chart.save(songPath, PlayState.SONG, __autoSaveLocation, {saveMetaInChart: true, saveLocalEvents: true, saveGlobalEvents: true, folder: "autosaves", prettyPrint: Options.editorPrettyPrint});
|
||||
Chart.save(songPath, PlayState.SONG, __autoSaveLocation, {saveMetaInChart: true, saveLocalEvents: true, saveGlobalEvents: true, folder: "autosaves", prettyPrint: Options.editorCharterPrettyPrint});
|
||||
else // These two chart saves are particular, to avoid any kind of loss, stuff like meta, global and local events will be save all together - Nex
|
||||
Chart.save(songPath, PlayState.SONG, __diff.toLowerCase(), {saveMetaInChart: true, saveLocalEvents: true, saveGlobalEvents: true, prettyPrint: Options.editorPrettyPrint});
|
||||
Chart.save(songPath, PlayState.SONG, __diff.toLowerCase(), {saveMetaInChart: true, saveLocalEvents: true, saveGlobalEvents: true, prettyPrint: Options.editorCharterPrettyPrint});
|
||||
undos.save();
|
||||
}
|
||||
autoSaveNotif.cancelled = false;
|
||||
@@ -1480,7 +1480,7 @@ class Charter extends UIState {
|
||||
}
|
||||
|
||||
public static function saveChartAs(shouldBuild:Bool = true, withEvents:Bool = true) {
|
||||
saveAs(Chart.filterChartForSaving(PlayState.SONG, false, withEvents, false), null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null, {
|
||||
saveAs(Chart.filterChartForSaving(PlayState.SONG, false, withEvents, false), null, Options.editorCharterPrettyPrint ? Flags.JSON_PRETTY_PRINT : null, {
|
||||
defaultSaveFile: '${__diff.toLowerCase()}.json'
|
||||
}, null, shouldBuild);
|
||||
if (undos != null) undos.save();
|
||||
@@ -1492,7 +1492,7 @@ class Charter extends UIState {
|
||||
var data = {events: Chart.filterChartForSaving(PlayState.SONG, false, false, true).events};
|
||||
|
||||
var path = '${Paths.getAssetsRoot()}/songs/${__song.toLowerCase()}/events.json';
|
||||
if (data.events != null && data.events.length > 0) CoolUtil.safeSaveFile(path, Json.stringify(data, null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null));
|
||||
if (data.events != null && data.events.length > 0) CoolUtil.safeSaveFile(path, Json.stringify(data, null, Options.editorCharterPrettyPrint ? Flags.JSON_PRETTY_PRINT : null));
|
||||
else if (FileSystem.exists(path)) FileSystem.deleteFile(path); // Instead of replacing with a useless empty file, deletes the file directly - Nex
|
||||
#else
|
||||
saveEventsAs(shouldBuild);
|
||||
@@ -1503,7 +1503,7 @@ class Charter extends UIState {
|
||||
if (shouldBuild && instance != null) instance.buildChart();
|
||||
var data = {events: Chart.filterChartForSaving(PlayState.SONG, false, false, true).events};
|
||||
|
||||
saveAs(data, null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null, {
|
||||
saveAs(data, null, Options.editorCharterPrettyPrint ? Flags.JSON_PRETTY_PRINT : null, {
|
||||
defaultSaveFile: 'events.json'
|
||||
}, null, false);
|
||||
}
|
||||
@@ -1527,13 +1527,13 @@ class Charter extends UIState {
|
||||
}
|
||||
|
||||
public static function saveLegacyChartAs(shouldBuild:Bool = true) {
|
||||
saveAs(FNFLegacyParser.encode(PlayState.SONG), null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null, {
|
||||
saveAs(FNFLegacyParser.encode(PlayState.SONG), null, Options.editorCharterPrettyPrint ? Flags.JSON_PRETTY_PRINT : null, {
|
||||
defaultSaveFile: '${__song.toLowerCase().replace(" ", "-")}${__diff.toLowerCase() == Flags.DEFAULT_DIFFICULTY ? "" : '-${__diff.toLowerCase()}'}.json',
|
||||
}, null, shouldBuild);
|
||||
}
|
||||
|
||||
public static function savePsychChartAs(shouldBuild:Bool = true) {
|
||||
saveAs(PsychParser.encode(PlayState.SONG), null, Options.editorPrettyPrint ? Flags.JSON_PRETTY_PRINT : null, {
|
||||
saveAs(PsychParser.encode(PlayState.SONG), null, Options.editorCharterPrettyPrint ? Flags.JSON_PRETTY_PRINT : null, {
|
||||
defaultSaveFile: '${__song.toLowerCase().replace(" ", "-")}${__diff.toLowerCase() == Flags.DEFAULT_DIFFICULTY ? "" : '-${__diff.toLowerCase()}'}.json',
|
||||
}, null, shouldBuild);
|
||||
}
|
||||
@@ -1551,7 +1551,7 @@ class Charter extends UIState {
|
||||
#if sys
|
||||
public static function saveTo(path:String, separateEvents:Bool = false, shouldBuild:Bool = true) {
|
||||
if (shouldBuild && instance != null) instance.buildChart();
|
||||
Chart.save(path, PlayState.SONG, __diff.toLowerCase(), {saveMetaInChart: false, saveLocalEvents: !separateEvents, prettyPrint: Options.editorPrettyPrint});
|
||||
Chart.save(path, PlayState.SONG, __diff.toLowerCase(), {saveMetaInChart: false, saveLocalEvents: !separateEvents, prettyPrint: Options.editorCharterPrettyPrint});
|
||||
}
|
||||
#end
|
||||
#end
|
||||
|
||||
@@ -724,8 +724,8 @@ class StageEditor extends UIState {
|
||||
}
|
||||
}
|
||||
|
||||
var xmlThingYea:String = "<!DOCTYPE codename-engine-stage>\n" + Printer.print(xml, Options.editorPrettyPrint);
|
||||
return Options.editorPrettyPrint ? xmlThingYea : xmlThingYea.replace("\n", "");
|
||||
var xmlThingYea:String = "<!DOCTYPE codename-engine-stage>\n" + Printer.print(xml, Options.editorStagePrettyPrint);
|
||||
return Options.editorStagePrettyPrint ? xmlThingYea : xmlThingYea.replace("\n", "");
|
||||
}
|
||||
|
||||
function _edit_undo(_) {
|
||||
|
||||
@@ -429,12 +429,12 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
|
||||
var realFlipped:Bool = isPlayer ? !__baseFlipped : __baseFlipped;
|
||||
if (realFlipped) xml.set("flipX", "true");
|
||||
xml.set("icon", getIcon());
|
||||
if (icon != curCharacter) xml.set("icon", getIcon());
|
||||
|
||||
if (gameOverCharacter != Character.FALLBACK_DEAD_CHARACTER) xml.set("gameOverChar", gameOverCharacter);
|
||||
if (iconColor != null) xml.set("color", iconColor.toWebString());
|
||||
|
||||
xml.set("sprite", sprite);
|
||||
if (sprite != curCharacter) xml.set("sprite", sprite);
|
||||
if (scale.x != 1) xml.set("scale", Std.string(FlxMath.roundDecimal(scale.x, 4)));
|
||||
if (!antialiasing) xml.set("antialiasing", antialiasing == true ? "true" : "false");
|
||||
|
||||
@@ -453,12 +453,12 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
|
||||
animXml.set("name", anim.name);
|
||||
animXml.set("anim", anim.anim);
|
||||
animXml.set("loop", Std.string(anim.loop));
|
||||
animXml.set("fps", Std.string(FlxMath.roundDecimal(anim.fps, 2)));
|
||||
if (anim.loop) animXml.set("loop", Std.string(anim.loop));
|
||||
if (FlxMath.roundDecimal(anim.fps, 2) != 24) animXml.set("fps", Std.string(FlxMath.roundDecimal(anim.fps, 2)));
|
||||
|
||||
var offset:FlxPoint = getAnimOffset(anim.name);
|
||||
animXml.set("x", Std.string(FlxMath.roundDecimal(offset.x, 2)));
|
||||
animXml.set("y", Std.string(FlxMath.roundDecimal(offset.y, 2)));
|
||||
if (FlxMath.roundDecimal(offset.x, 2) != 0) animXml.set("x", Std.string(FlxMath.roundDecimal(offset.x, 2)));
|
||||
if (FlxMath.roundDecimal(offset.y, 2) != 0) animXml.set("y", Std.string(FlxMath.roundDecimal(offset.y, 2)));
|
||||
offset.putWeak();
|
||||
|
||||
if (anim.indices.length > 0)
|
||||
@@ -474,6 +474,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
|
||||
}
|
||||
|
||||
this.xml = new Access(xml);
|
||||
|
||||
return xml;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,11 @@ class Options
|
||||
*/
|
||||
public static var intensiveBlur:Bool = true;
|
||||
public static var editorSFX:Bool = true;
|
||||
public static var editorPrettyPrint:Bool = false;
|
||||
|
||||
public static var editorCharterPrettyPrint:Bool = false;
|
||||
public static var editorCharacterPrettyPrint:Bool = true;
|
||||
public static var editorStagePrettyPrint:Bool = true;
|
||||
|
||||
public static var editorsResizable:Bool = true;
|
||||
public static var bypassEditorsResize:Bool = false;
|
||||
public static var maxUndos:Int = 120;
|
||||
|
||||
Reference in New Issue
Block a user