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:
1 parent
5d274e547a
commit
280adaa189
14 files changed
+154
-10
No files matched your search
@@ -125,3 +125,11 @@ TEST_CASE("an alpha offset is kept by the editor's copy only")
|
||||
CHECK(model_load(text).frame_get({0, LAYER, 0, 0})->colorOffset.a == doctest::Approx(-127.0f / 255.0f));
|
||||
CHECK(model::isaac_issues_get(anm2).alphaOffsetFrames == 1);
|
||||
}
|
||||
|
||||
TEST_CASE("only SVG spritesheets that layers show count against Rebirth")
|
||||
{
|
||||
auto anm2 = model_load(file_load(TEST_DIR / "render" / "vector.anm2"));
|
||||
CHECK(model::spritesheets_vector_used_get(anm2) == std::set{0});
|
||||
anm2.content.layers.clear();
|
||||
CHECK(model::spritesheets_vector_used_get(anm2).empty());
|
||||
}
|
||||
@@ -450,5 +450,11 @@ TEST_CASE("a trigger fires several events; built-in events join a file when firs
|
||||
auto text = model::model_to_string(model);
|
||||
CHECK(model_load(text).frame_get({0, TRIGGER, -1, 0})->eventIds == std::vector{0, stopId, 1});
|
||||
CHECK(model_load(game_document_get(text)).frame_get({0, TRIGGER, -1, 0})->eventIds == std::vector{0});
|
||||
CHECK(model::isaac_issues_get(model).extraEvents == 2);
|
||||
CHECK(model::isaac_issues_get(model).extraEvents == 1);
|
||||
|
||||
// The game's copy skips built-in events for the first custom one.
|
||||
model.frame_edit({0, TRIGGER, -1, 0})->eventIds = {stopId, 1};
|
||||
CHECK(model_load(game_document_get(model::model_to_string(model))).frame_get({0, TRIGGER, -1, 0})->eventIds ==
|
||||
std::vector{1});
|
||||
CHECK(model::isaac_issues_get(model).extraEvents == 0);
|
||||
}
|
||||
@@ -204,3 +204,26 @@ TEST_CASE("SVG spritesheets draw sharp at any scale")
|
||||
pixels.data()));
|
||||
golden_image_check("vector_frame_0.png");
|
||||
}
|
||||
|
||||
TEST_CASE("converting SVG spritesheets writes PNGs beside them")
|
||||
{
|
||||
auto directory = std::filesystem::temp_directory_path() / "anm2ed_vector_convert";
|
||||
std::filesystem::remove_all(directory);
|
||||
std::filesystem::create_directories(directory);
|
||||
for (auto name : {"vector.anm2", "vector.svg"})
|
||||
std::filesystem::copy_file(RENDER_TEST_DIR / name, directory / name);
|
||||
|
||||
Document document(directory / "vector.anm2", false);
|
||||
REQUIRE(document.is_valid());
|
||||
document.spritesheets_vector_convert();
|
||||
CHECK(document.model.content.spritesheets.front().path == "vector.png");
|
||||
CHECK(std::filesystem::exists(directory / "vector.png"));
|
||||
REQUIRE(document.texture_get(0));
|
||||
CHECK_FALSE(document.texture_get(0)->is_vector());
|
||||
CHECK(model::spritesheets_vector_used_get(document.model).empty());
|
||||
|
||||
document.undo();
|
||||
CHECK(document.model.content.spritesheets.front().path == "vector.svg");
|
||||
CHECK(document.texture_get(0)->is_vector());
|
||||
std::filesystem::remove_all(directory);
|
||||
}
|
||||
Reference in new issue
Block a user