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
+1 -1
View File
@@ -72,7 +72,7 @@ namespace anm2ed::anm2
Item* item_get(int, Type, int = -1);
Reference layer_animation_add(Reference = {}, std::string = {}, int = 0,
types::destination::Type = types::destination::ALL);
Reference null_animation_add(Reference = {}, std::string = {}, types::destination::Type = types::destination::ALL);
Reference null_animation_add(Reference = {}, std::string = {}, bool = false, types::destination::Type = types::destination::ALL);
Frame* frame_get(int, Type, int, int = -1);
void merge(const Anm2&, const std::filesystem::path&, const std::filesystem::path&);
+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};
}
}
-1
View File
@@ -39,7 +39,6 @@ namespace anm2ed::anm2
std::vector<std::string> Anm2::spritesheet_labels_get()
{
std::vector<std::string> labels{};
labels.emplace_back(localize.get(BASIC_NONE));
for (auto& [id, spritesheet] : content.spritesheets)
{
auto pathString = path::to_utf8(spritesheet.path);