Mega Region Update.

This commit is contained in:
2026-02-05 21:34:42 -05:00
parent 00bff4a91f
commit 64d6a1d95a
45 changed files with 1590 additions and 205 deletions
+12 -7
View File
@@ -78,34 +78,37 @@ namespace anm2ed::anm2
}
}
XMLElement* Animation::to_element(XMLDocument& document)
XMLElement* Animation::to_element(XMLDocument& document, Flags flags)
{
auto element = document.NewElement("Animation");
element->SetAttribute("Name", name.c_str());
element->SetAttribute("FrameNum", frameNum);
element->SetAttribute("Loop", isLoop);
rootAnimation.serialize(document, element, ROOT);
rootAnimation.serialize(document, element, ROOT, -1, flags);
auto layerAnimationsElement = document.NewElement("LayerAnimations");
for (auto& i : layerOrder)
{
Item& layerAnimation = layerAnimations.at(i);
layerAnimation.serialize(document, layerAnimationsElement, LAYER, i);
layerAnimation.serialize(document, layerAnimationsElement, LAYER, i, flags);
}
element->InsertEndChild(layerAnimationsElement);
auto nullAnimationsElement = document.NewElement("NullAnimations");
for (auto& [id, nullAnimation] : nullAnimations)
nullAnimation.serialize(document, nullAnimationsElement, NULL_, id);
nullAnimation.serialize(document, nullAnimationsElement, NULL_, id, flags);
element->InsertEndChild(nullAnimationsElement);
triggers.serialize(document, element, TRIGGER);
triggers.serialize(document, element, TRIGGER, -1, flags);
return element;
}
void Animation::serialize(XMLDocument& document, XMLElement* parent) { parent->InsertEndChild(to_element(document)); }
void Animation::serialize(XMLDocument& document, XMLElement* parent, Flags flags)
{
parent->InsertEndChild(to_element(document, flags));
}
std::string Animation::to_string()
{
@@ -158,6 +161,8 @@ namespace anm2ed::anm2
for (auto& [id, layerAnimation] : layerAnimations)
{
if (!layerAnimation.isVisible) continue;
auto frame = layerAnimation.frame_generate(t, LAYER);
if (frame.size == vec2() || !frame.isVisible) continue;
@@ -179,4 +184,4 @@ namespace anm2ed::anm2
if (!any) return vec4(-1.0f);
return {minX, minY, maxX - minX, maxY - minY};
}
}
}