Purge Default Color Values (on by default)

Saves leave out tint channels of 255 and color offsets of 0, which Isaac and
the editor read as those defaults, in both the game's copy and the editor's.
The option sits beside Extended Format in Configure's Serialization row; the
manager takes it with the other settings (chords_set is now settings_apply).
Also drops layer_child_transform_get's unused model parameter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-11 18:22:26 -04:00
1 parent 0857e62419
commit bec89bf48f
15 files changed
+65 -30

No files matched your search

+2 -2
View File
@@ -203,8 +203,8 @@ TEST_CASE("flattening animation layers bakes their children into plain layers th
TEST_CASE("an animation layer's child sits where the layer's frame puts it")
{
auto anm2 = model_load(file_load(TEST_DIR / "render" / "nested.anm2"));
auto placement = model::layer_child_transform_get(anm2, *anm2.animation_get(0), 0, 0.0f, true);
auto placement = model::layer_child_transform_get(*anm2.animation_get(0), 0, 0.0f, true);
REQUIRE(placement);
CHECK(glm::vec2(*placement * glm::vec4(16.0f, 0.0f, 0.0f, 1.0f)) == glm::vec2(48.0f, 0.0f));
CHECK_FALSE(model::layer_child_transform_get(anm2, *anm2.animation_get(0), 99, 0.0f, true));
CHECK_FALSE(model::layer_child_transform_get(*anm2.animation_get(0), 99, 0.0f, true));
}
+19
View File
@@ -43,3 +43,22 @@ TEST_CASE("a document's format is kept by what it saves")
CHECK(reloaded.isExtendedFormat);
CHECK(model::model_hash(reloaded) == model::model_hash(model));
}
TEST_CASE("purged default colors read back the same")
{
for (const auto& fixture : fixtures_get())
{
INFO("fixture: ", fixture.string());
auto model = model_load(file_load(fixture));
for (auto isExtended : {false, true})
{
auto text = model::model_to_string(model, {.isExtendedFormat = isExtended, .isPurgeDefaultColors = true});
CHECK(text.find("Tint=\"255\"") == std::string::npos);
CHECK(text.find("Offset=\"0\"") == std::string::npos);
CHECK(text.size() <= model::model_to_string(model, {.isExtendedFormat = isExtended}).size());
auto reloaded = model_load(text);
reloaded.isExtendedFormat = model.isExtendedFormat;
CHECK(model::model_hash(reloaded) == model::model_hash(model));
}
}
}