2020-01-15 12:07:48 +00:00
|
|
|
#include "Runtime/Character/CMetaAnimSequence.hpp"
|
|
|
|
|
|
|
|
#include "Runtime/Character/CAnimTreeSequence.hpp"
|
|
|
|
#include "Runtime/Character/CMetaAnimFactory.hpp"
|
2016-04-10 21:22:59 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2016-04-10 21:22:59 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
std::vector<std::shared_ptr<IMetaAnim>> CMetaAnimSequence::CreateSequence(CInputStream& in) {
|
|
|
|
std::vector<std::shared_ptr<IMetaAnim>> ret;
|
2022-02-18 07:37:54 +00:00
|
|
|
u32 seqCount = in.ReadLong();
|
2018-12-08 05:30:43 +00:00
|
|
|
ret.reserve(seqCount);
|
2016-04-11 03:59:54 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
for (u32 i = 0; i < seqCount; ++i)
|
|
|
|
ret.push_back(CMetaAnimFactory::CreateMetaAnim(in));
|
2016-04-11 03:59:54 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
return ret;
|
2016-04-10 21:22:59 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
CMetaAnimSequence::CMetaAnimSequence(CInputStream& in) : x4_sequence(CreateSequence(in)) {}
|
2016-04-11 03:59:54 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CMetaAnimSequence::GetUniquePrimitives(std::set<CPrimitive>& primsOut) const {
|
|
|
|
for (const std::shared_ptr<IMetaAnim>& anim : x4_sequence)
|
|
|
|
anim->GetUniquePrimitives(primsOut);
|
2016-04-10 21:22:59 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
std::shared_ptr<CAnimTreeNode> CMetaAnimSequence::VGetAnimationTree(const CAnimSysContext& animSys,
|
|
|
|
const CMetaAnimTreeBuildOrders& orders) const {
|
2019-03-09 08:58:27 +00:00
|
|
|
if (orders.x0_recursiveAdvance)
|
|
|
|
return GetAnimationTree(animSys, CMetaAnimTreeBuildOrders::PreAdvanceForAll(*orders.x0_recursiveAdvance));
|
2016-08-27 21:16:44 +00:00
|
|
|
|
2018-01-30 01:04:01 +00:00
|
|
|
#if 0
|
2019-03-09 08:58:27 +00:00
|
|
|
/* Originally used to generate name string */
|
|
|
|
std::vector<std::string> anims;
|
|
|
|
anims.reserve(anims.size());
|
|
|
|
for (const std::shared_ptr<IMetaAnim>& anim : x4_sequence) {
|
|
|
|
std::shared_ptr<CAnimTreeNode> chNode = anim->GetAnimationTree(animSys, orders);
|
|
|
|
anims.emplace_back(chNode->GetName());
|
|
|
|
}
|
2018-01-30 01:04:01 +00:00
|
|
|
#endif
|
2016-08-27 21:16:44 +00:00
|
|
|
|
2019-03-09 08:58:27 +00:00
|
|
|
return std::make_shared<CAnimTreeSequence>(x4_sequence, animSys, "");
|
2016-04-10 21:22:59 +00:00
|
|
|
}
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|