2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 03:47:43 +00:00

YAML RAII refactor

This commit is contained in:
Jack Andersen
2017-02-12 13:56:03 -10:00
parent 1b8baca988
commit 748e81ae6e
29 changed files with 1314 additions and 1842 deletions

View File

@@ -499,12 +499,13 @@ struct ANCS : BigYAML
{
out.clear();
for (const AnimationSet::Animation& ai : animationSet.animations)
ai.metaAnim.m_anim->gatherPrimitives(out);
if (AnimationSet::IMetaAnim* anim = ai.metaAnim.m_anim.get())
anim->gatherPrimitives(out);
for (const AnimationSet::Transition& ti : animationSet.transitions)
if (ti.metaTrans.m_trans)
ti.metaTrans.m_trans->gatherPrimitives(out);
if (animationSet.defaultTransition.m_trans)
animationSet.defaultTransition.m_trans->gatherPrimitives(out);
if (AnimationSet::IMetaTrans* trans = ti.metaTrans.m_trans.get())
trans->gatherPrimitives(out);
if (AnimationSet::IMetaTrans* trans = animationSet.defaultTransition.m_trans.get())
trans->gatherPrimitives(out);
for (auto& anim : out)
{
for (const AnimationSet::AnimationResources& res : animationSet.animResources)
@@ -521,10 +522,13 @@ struct ANCS : BigYAML
void enumeratePrimitives(const std::function<bool(AnimationSet::MetaAnimPrimitive& prim)>& func)
{
for (const AnimationSet::Animation& ai : animationSet.animations)
ai.metaAnim.m_anim->enumeratePrimitives(func);
if (AnimationSet::IMetaAnim* anim = ai.metaAnim.m_anim.get())
anim->enumeratePrimitives(func);
for (const AnimationSet::Transition& ti : animationSet.transitions)
ti.metaTrans.m_trans->enumeratePrimitives(func);
animationSet.defaultTransition.m_trans->enumeratePrimitives(func);
if (AnimationSet::IMetaTrans* trans = ti.metaTrans.m_trans.get())
trans->enumeratePrimitives(func);
if (AnimationSet::IMetaTrans* trans = animationSet.defaultTransition.m_trans.get())
trans->enumeratePrimitives(func);
}
static bool Extract(const SpecBase& dataSpec,