mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-11 00:39:59 +00:00
Store an MWWorld::Ptr with the Animation
This commit is contained in:
parent
2b1fe7dc44
commit
b96a979719
@ -10,8 +10,9 @@
|
||||
namespace MWRender
|
||||
{
|
||||
|
||||
Animation::Animation()
|
||||
: mInsert(NULL)
|
||||
Animation::Animation(const MWWorld::Ptr &ptr)
|
||||
: mPtr(ptr)
|
||||
, mInsert(NULL)
|
||||
, mTime(0.0f)
|
||||
, mSkipFrame(false)
|
||||
, mAnimState(NULL)
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include <components/nifogre/ogre_nif_loader.hpp>
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
|
||||
@ -23,6 +25,7 @@ class Animation
|
||||
};
|
||||
|
||||
protected:
|
||||
MWWorld::Ptr mPtr;
|
||||
Ogre::SceneNode* mInsert;
|
||||
|
||||
float mTime;
|
||||
@ -40,7 +43,7 @@ protected:
|
||||
void createEntityList(Ogre::SceneNode *node, const std::string &model);
|
||||
|
||||
public:
|
||||
Animation();
|
||||
Animation(const MWWorld::Ptr &ptr);
|
||||
virtual ~Animation();
|
||||
|
||||
void playGroup(std::string groupname, int mode, int loops);
|
||||
|
@ -16,16 +16,17 @@ CreatureAnimation::~CreatureAnimation()
|
||||
{
|
||||
}
|
||||
|
||||
CreatureAnimation::CreatureAnimation(const MWWorld::Ptr& ptr): Animation()
|
||||
CreatureAnimation::CreatureAnimation(const MWWorld::Ptr &ptr)
|
||||
: Animation(ptr)
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
||||
MWWorld::LiveCellRef<ESM::Creature> *ref = mPtr.get<ESM::Creature>();
|
||||
|
||||
assert (ref->mBase != NULL);
|
||||
if(!ref->mBase->mModel.empty())
|
||||
{
|
||||
std::string mesh = "meshes\\" + ref->mBase->mModel;
|
||||
|
||||
createEntityList(ptr.getRefData().getBaseNode(), mesh);
|
||||
createEntityList(mPtr.getRefData().getBaseNode(), mesh);
|
||||
for(size_t i = 0;i < mEntityList.mEntities.size();i++)
|
||||
{
|
||||
Ogre::Entity *ent = mEntityList.mEntities[i];
|
||||
|
@ -55,7 +55,7 @@ NpcAnimation::~NpcAnimation()
|
||||
|
||||
|
||||
NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWorld::InventoryStore& inv, int visibilityFlags)
|
||||
: Animation(),
|
||||
: Animation(ptr),
|
||||
mInv(inv),
|
||||
mStateID(-1),
|
||||
mTimeToChange(0),
|
||||
@ -73,7 +73,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
|
||||
mGloveR(mInv.end()),
|
||||
mSkirtIter(mInv.end())
|
||||
{
|
||||
mNpc = ptr.get<ESM::NPC>()->mBase;
|
||||
mNpc = mPtr.get<ESM::NPC>()->mBase;
|
||||
|
||||
for(size_t i = 0;i < sPartListSize;i++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user