SVG sheets: draw tool hint, convert to PNG for Rebirth; game copy skips built-in events

Drawing or erasing on an SVG spritesheet shows why it can't be edited (and
no longer leaves an empty undo step). Saving a Rebirth document whose layers
show SVG spritesheets first offers to convert them into PNGs beside them
(one undoable edit); keeping them counts them in the Isaac warning. The
game's copy of a trigger keeps its first event that isn't stop or done, and
only further custom events count as dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-08 17:56:06 -04:00
1 parent 5d274e547a
commit 280adaa189
14 files changed
+154 -10

No files matched your search

+30
View File
@@ -710,6 +710,36 @@ namespace anm2ed
}
}
// Writes each SVG spritesheet a layer shows as a PNG beside it, and points the spritesheet at the PNG.
void Document::spritesheets_vector_convert()
{
auto ids = model::spritesheets_vector_used_get(model);
std::set<int> converted{};
edit_apply(EDIT_CONVERT_SVG_SPRITESHEETS,
[&](model::Model& model)
{
for (auto id : ids)
{
auto spritesheet = model::item_get(model.content.spritesheets, id);
auto texture = texture_get(id);
auto pngPath =
std::filesystem::path(spritesheet->path).replace_extension(resource::image::PNG_EXTENSION);
auto pathString = path::to_utf8(pngPath);
if (!texture || !texture->write_png(std::filesystem::absolute(directory_get()) / pngPath))
{
toast_log(Level::ERROR, TOAST_SAVE_SPRITESHEET_FAILED, id, pathString);
continue;
}
spritesheet->path = pngPath;
texture_reload(id);
converted.insert(id);
toast_log(Level::INFO, TOAST_CONVERT_SVG_SPRITESHEET, id, pathString);
}
});
for (auto id : converted)
spritesheet_hash_set_saved(id);
}
bool Document::spritesheet_is_dirty(int id)
{
if (!model::item_get(model.content.spritesheets, id)) return false;