Find a removed library's layers before the model moves into the flatten

Argument order is unspecified: built with clang, the model moved first, no
layers were found, and every animation layer was flattened.
This commit is contained in:
shweet committed 2026-11-22 19:37:39 -05:00
1 parent f35f9cb4b8
commit becd6430ed
1 file changed
+5 -3
+5 -3
View File
@@ -118,11 +118,13 @@ void content_remove(Model& model, ElementType type, const std::set<int>& ids, in
switch (type) switch (type)
{ {
case ElementType::LIBRARY: case ElementType::LIBRARY:
model = animation_layers_flatten( {
std::move(model), library_get, path_get, // Found before the model moves into the call.
layer_ids_get([&](const Layer& layer) { return ids.contains(layer.libraryId); })); auto layerIds = layer_ids_get([&](const Layer& layer) { return ids.contains(layer.libraryId); });
model = animation_layers_flatten(std::move(model), library_get, path_get, layerIds);
items_erase(content.libraries); items_erase(content.libraries);
break; break;
}
case ElementType::SPRITESHEET: case ElementType::SPRITESHEET:
content_remove(model, ElementType::LAYER_ELEMENT, layer_ids_get([&](const Layer& layer) { content_remove(model, ElementType::LAYER_ELEMENT, layer_ids_get([&](const Layer& layer) {
return !layer.is_animation() && ids.contains(layer.spritesheetId); return !layer.is_animation() && ids.contains(layer.spritesheetId);