1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-30 09:36:43 +00:00

Use the non-accumulation root's parent as the accumulation root

This relies on the non-accumulation root not being the skeleton root. I haven't
found an instance where this isn't the case.
This commit is contained in:
Chris Robinson 2013-08-24 17:42:40 -07:00
parent 7aee1da5c6
commit bd6dd071aa

View file

@ -64,7 +64,7 @@ void Animation::destroyObjectList(Ogre::SceneManager *sceneMgr, NifOgre::ObjectL
Animation::Animation(const MWWorld::Ptr &ptr, Ogre::SceneNode *node) Animation::Animation(const MWWorld::Ptr &ptr, Ogre::SceneNode *node)
: mPtr(ptr) : mPtr(ptr)
, mCamera(NULL) , mCamera(NULL)
, mInsert(NULL) , mInsert(node)
, mSkelBase(NULL) , mSkelBase(NULL)
, mAccumRoot(NULL) , mAccumRoot(NULL)
, mNonAccumRoot(NULL) , mNonAccumRoot(NULL)
@ -74,20 +74,14 @@ Animation::Animation(const MWWorld::Ptr &ptr, Ogre::SceneNode *node)
{ {
for(size_t i = 0;i < sNumGroups;i++) for(size_t i = 0;i < sNumGroups;i++)
mAnimationValuePtr[i].bind(OGRE_NEW AnimationValue(this)); mAnimationValuePtr[i].bind(OGRE_NEW AnimationValue(this));
mInsert = node->createChildSceneNode();
} }
Animation::~Animation() Animation::~Animation()
{ {
if(mInsert) mAnimSources.clear();
{
mAnimSources.clear();
Ogre::SceneManager *sceneMgr = mInsert->getCreator(); Ogre::SceneManager *sceneMgr = mInsert->getCreator();
destroyObjectList(sceneMgr, mObjectRoot); destroyObjectList(sceneMgr, mObjectRoot);
sceneMgr->destroySceneNode(mInsert);
}
} }
@ -268,8 +262,13 @@ void Animation::addAnimSource(const std::string &model)
if(!mAccumRoot && grp == 0) if(!mAccumRoot && grp == 0)
{ {
mAccumRoot = mInsert;
mNonAccumRoot = dstval->getNode(); mNonAccumRoot = dstval->getNode();
mAccumRoot = mNonAccumRoot->getParent();
if(!mAccumRoot)
{
std::cerr<< "Non-Accum root for "<<mPtr.getCellRef().mRefID<<" is skeleton root??" <<std::endl;
mNonAccumRoot = NULL;
}
} }
ctrls[i].setSource(mAnimationValuePtr[grp]); ctrls[i].setSource(mAnimationValuePtr[grp]);
@ -984,10 +983,7 @@ ObjectAnimation::ObjectAnimation(const MWWorld::Ptr& ptr, const std::string &mod
{ {
setObjectRoot(model, false); setObjectRoot(model, false);
Ogre::AxisAlignedBox bounds = getWorldBounds(); Ogre::Vector3 extents = getWorldBounds().getSize();
Ogre::Vector3 extents = bounds.getSize();
extents *= mInsert->getParentSceneNode()->getScale();
float size = std::max(std::max(extents.x, extents.y), extents.z); float size = std::max(std::max(extents.x, extents.y), extents.z);
bool small = (size < Settings::Manager::getInt("small object size", "Viewing distance")) && bool small = (size < Settings::Manager::getInt("small object size", "Viewing distance")) &&