add item fixes

This commit is contained in:
2025-12-18 23:56:15 -05:00
parent 82c5dcc176
commit 4574ff0f84
8 changed files with 23 additions and 19 deletions
+8 -7
View File
@@ -31,7 +31,7 @@ namespace anm2ed::anm2
}
Reference Anm2::layer_animation_add(Reference reference, std::string name, int spritesheetID,
destination::Type locale)
destination::Type destination)
{
auto id = reference.itemID == -1 ? map::next_id_get(content.layers) : reference.itemID;
auto& layer = content.layers[id];
@@ -45,12 +45,12 @@ namespace anm2ed::anm2
animation->layerOrder.push_back(id);
};
if (locale == destination::ALL)
if (destination == destination::ALL)
{
for (auto& animation : animations.items)
if (!animation.layerAnimations.contains(id)) add(&animation, id);
}
else if (locale == destination::THIS)
else if (destination == destination::THIS)
{
if (auto animation = animation_get(reference.animationIndex))
if (!animation->layerAnimations.contains(id)) add(animation, id);
@@ -59,26 +59,27 @@ namespace anm2ed::anm2
return {reference.animationIndex, LAYER, id};
}
Reference Anm2::null_animation_add(Reference reference, std::string name, destination::Type locale)
Reference Anm2::null_animation_add(Reference reference, std::string name, bool isShowRect, destination::Type destination)
{
auto id = reference.itemID == -1 ? map::next_id_get(content.nulls) : reference.itemID;
auto& null = content.nulls[id];
null.name = !name.empty() ? name : null.name;
null.isShowRect = isShowRect;
auto add = [&](Animation* animation, int id) { animation->nullAnimations[id] = Item(); };
if (locale == destination::ALL)
if (destination == destination::ALL)
{
for (auto& animation : animations.items)
if (!animation.nullAnimations.contains(id)) add(&animation, id);
}
else if (locale == destination::THIS)
else if (destination == destination::THIS)
{
if (auto animation = animation_get(reference.animationIndex))
if (!animation->nullAnimations.contains(id)) add(animation, id);
}
return {reference.animationIndex, LAYER, id};
return {reference.animationIndex, NULL_, id};
}
}