Bundle long parameter lists into option structs

FrameRender carries a render's canvas, shader, document, animation, bounds,
background, scale and root transform. Dash and DashedShape replace three
dash floats and a GL mode and count. ViewCamera carries the view menu's
zoom, pan, center, fit and whether fitting is possible. ItemAdd and
ItemsMove carry what item_add and items_move took as seven or eight
positional arguments.
This commit is contained in:
shweet committed 2026-11-22 19:57:11 -05:00
1 parent 9e193a3d5c
commit ae7dafaef6
16 files changed
+185 -107

No files matched your search

+6 -3
View File
@@ -57,8 +57,11 @@ TEST_CASE("file_merge presets")
TEST_CASE("item_add")
{
auto model = fixture_load("02_items.anm2");
CHECK(item_add(model, ItemType::LAYER, 0, -1, {.name = "added", .spritesheetId = 1}, {}, 1, DESTINATION_ALL) == 2);
CHECK(item_add(model, ItemType::NULL_, 1, -1, {}, {.name = "thisOnly"}, -1, DESTINATION_THIS) == 2);
CHECK(item_add(model, {.insertBeforeId = 1, .layer = {.name = "added", .spritesheetId = 1}}) == 2);
CHECK(item_add(model, {.type = ItemType::NULL_,
.animationIndex = 1,
.destination = DESTINATION_THIS,
.null = {.name = "thisOnly"}}) == 2);
operation_check("item_add", model);
}
@@ -190,7 +193,7 @@ TEST_CASE("edit layer operations")
[&](Model& anm2) { return items_group(anm2, 0, LAYER, {2}, "New"); }, 1},
{"items_move", "03b_groups_legacy_flat.anm2",
[&](Model& anm2) {
items_move(anm2, 0, LAYER, {2}, {}, {true, LAYER, 0, -1}, DROP_INSIDE);
items_move(anm2, {.type = LAYER, .ids = {2}, .target = {true, LAYER, 0, -1}, .zone = DROP_INSIDE});
return Uids{};
},
0},