Isaac compatibility: Convert and Save bridges what the game can't show
The Isaac prompt offers Convert and Save, Ignore and Save, or Cancel; the
document remembers the choice (IsaacIgnored / "isaacIgnored", editor-only)
for saves that don't ask (the warning off, or `convert`). Converting:
- depth: a copy of the layer per depth ("body (depth +1)"), standing where
the editor draws it and showing only that depth's frames
- alpha offsets join the alpha tint (the same on opaque pixels)
- skew, blur and shaders: each layer frame using one is drawn alone at 1x
into <name>.baked.png beside the save (each image once), on a copy of its
layer ("body (baked)") right after it, one frame per step; a skewed root
or group root goes into its layers' images. `convert` makes a headless
OpenGL context for it; without one (or if the sheet can't be written)
these are dropped with a warning. Autosaves don't bake.
Tests check the bridged copy draws as the editor does, frame by frame.
Purge Default Color Values is gone: XML saves always leave out tints of 255
and color offsets of 0, in both copies.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
065dd522f3
commit
8ef089d306
36 files changed
+772
-220
No files matched your search
+16
-2
@@ -23,6 +23,7 @@
|
||||
#include "model/xml.hpp"
|
||||
#include "pack.hpp"
|
||||
#include "path.hpp"
|
||||
#include "render.hpp"
|
||||
#include "strings.hpp"
|
||||
#include "toast.hpp"
|
||||
#include "working_directory.hpp"
|
||||
@@ -34,6 +35,7 @@ using namespace glm;
|
||||
|
||||
namespace anm2ed::document
|
||||
{
|
||||
constexpr std::string_view BAKED_EXTENSION = ".baked.png";
|
||||
constexpr std::string_view AUTOSAVE_EXTENSION = ".autosave";
|
||||
constexpr int VECTOR_LEVEL_MAX = 3;
|
||||
constexpr int VECTOR_SIZE_MAX = 8192;
|
||||
@@ -243,12 +245,22 @@ namespace anm2ed
|
||||
};
|
||||
}
|
||||
|
||||
// Writes the document; a Rebirth document's game copy has its animation layers flattened into plain layers.
|
||||
// Writes the document; the game's copy has its animation layers flattened into plain layers, and what else the game
|
||||
// can't show worked around.
|
||||
bool Document::file_write(const std::filesystem::path& path, std::string* errorString, Options options)
|
||||
{
|
||||
std::optional<model::Model> game{};
|
||||
if (!options.isJson && std::ranges::any_of(model.content.layers, &model::Layer::is_animation))
|
||||
if (!options.isJson)
|
||||
{
|
||||
game = edit::animation_layers_flatten(model, library_resolver_get(), spritesheet_path_resolver_get());
|
||||
if (!model.info.isIsaacIgnored)
|
||||
{
|
||||
auto bakedPath = path;
|
||||
if (options.isPixelBaked)
|
||||
render::frames_bake(*this, *game, bakedPath.replace_extension(document::BAKED_EXTENSION));
|
||||
game = edit::isaac_bridge(std::move(*game));
|
||||
}
|
||||
}
|
||||
options.gameModel = game ? &*game : nullptr;
|
||||
return model::model_save(model, path, errorString, options);
|
||||
}
|
||||
@@ -272,6 +284,8 @@ namespace anm2ed
|
||||
{
|
||||
auto autosavePath = autosave_path_get();
|
||||
auto autosavePathUtf8 = path::to_utf8(autosavePath);
|
||||
// An autosave is read back from the editor's copy, so the game's needs no baked spritesheet.
|
||||
options.isPixelBaked = false;
|
||||
if (file_write(autosavePath, errorString, options))
|
||||
{
|
||||
for (auto id : spritesheets_autosave_dirty_get())
|
||||
|
||||
Reference in new issue
Block a user