mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-06-17 20:13:41 +00:00
CAnimSet: Collapse loops into ranged for where applicable
This commit is contained in:
parent
2a5ab1ed32
commit
4eb1027362
@ -96,36 +96,35 @@ class CAnimSet : public CResource
|
|||||||
std::vector<CAnimPrimitive> mAnimPrimitives;
|
std::vector<CAnimPrimitive> mAnimPrimitives;
|
||||||
std::vector<SAnimation> mAnimations;
|
std::vector<SAnimation> mAnimations;
|
||||||
std::vector<STransition> mTransitions;
|
std::vector<STransition> mTransitions;
|
||||||
IMetaTransition *mpDefaultTransition;
|
IMetaTransition *mpDefaultTransition = nullptr;
|
||||||
std::vector<SAdditiveAnim> mAdditiveAnims;
|
std::vector<SAdditiveAnim> mAdditiveAnims;
|
||||||
float mDefaultAdditiveFadeIn;
|
float mDefaultAdditiveFadeIn = 0.0f;
|
||||||
float mDefaultAdditiveFadeOut;
|
float mDefaultAdditiveFadeOut = 0.0f;
|
||||||
std::vector<SHalfTransition> mHalfTransitions;
|
std::vector<SHalfTransition> mHalfTransitions;
|
||||||
std::vector<std::unique_ptr<CAnimEventData>> mAnimEvents; // note: these are for MP2, where event data isn't a standalone resource; these are owned by the animset
|
std::vector<std::unique_ptr<CAnimEventData>> mAnimEvents; // note: these are for MP2, where event data isn't a standalone resource; these are owned by the animset
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAnimSet(CResourceEntry *pEntry = 0)
|
explicit CAnimSet(CResourceEntry *pEntry = nullptr)
|
||||||
: CResource(pEntry)
|
: CResource(pEntry)
|
||||||
, mpDefaultTransition(nullptr)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
~CAnimSet()
|
~CAnimSet()
|
||||||
{
|
{
|
||||||
for (uint32 iAnim = 0; iAnim < mAnimations.size(); iAnim++)
|
for (auto& anim : mAnimations)
|
||||||
delete mAnimations[iAnim].pMetaAnim;
|
delete anim.pMetaAnim;
|
||||||
|
|
||||||
for (uint32 iTrans = 0; iTrans < mTransitions.size(); iTrans++)
|
for (auto& trans : mTransitions)
|
||||||
delete mTransitions[iTrans].pMetaTrans;
|
delete trans.pMetaTrans;
|
||||||
|
|
||||||
for (uint32 iHalf = 0; iHalf < mHalfTransitions.size(); iHalf++)
|
for (auto& half : mHalfTransitions)
|
||||||
delete mHalfTransitions[iHalf].pMetaTrans;
|
delete half.pMetaTrans;
|
||||||
|
|
||||||
delete mpDefaultTransition;
|
delete mpDefaultTransition;
|
||||||
|
|
||||||
// For MP2, anim events need to be cleaned up manually
|
// For MP2, anim events need to be cleaned up manually
|
||||||
for (uint32 iEvent = 0; iEvent < mAnimEvents.size(); iEvent++)
|
for ([[maybe_unused]] const auto& event : mAnimEvents)
|
||||||
{
|
{
|
||||||
ASSERT(mAnimEvents[iEvent] && !mAnimEvents[iEvent]->Entry());
|
ASSERT(event != nullptr && !event->Entry());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,16 +205,16 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
inline uint32 NumCharacters() const { return mCharacters.size(); }
|
uint32 NumCharacters() const { return mCharacters.size(); }
|
||||||
inline uint32 NumAnimations() const { return mAnimations.size(); }
|
uint32 NumAnimations() const { return mAnimations.size(); }
|
||||||
|
|
||||||
inline const SSetCharacter* Character(uint32 Index) const
|
const SSetCharacter* Character(uint32 Index) const
|
||||||
{
|
{
|
||||||
ASSERT(Index >= 0 && Index < NumCharacters());
|
ASSERT(Index >= 0 && Index < NumCharacters());
|
||||||
return &mCharacters[Index];
|
return &mCharacters[Index];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const SAnimation* Animation(uint32 Index) const
|
const SAnimation* Animation(uint32 Index) const
|
||||||
{
|
{
|
||||||
ASSERT(Index >= 0 && Index < NumAnimations());
|
ASSERT(Index >= 0 && Index < NumAnimations());
|
||||||
return &mAnimations[Index];
|
return &mAnimations[Index];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user