1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 06:53:53 +00:00

Detach objects from the active grid when attempting to get their animation

This commit is contained in:
Evil Eye 2021-06-23 18:08:49 +02:00
parent df3a47187b
commit 692615fd3c
2 changed files with 15 additions and 6 deletions

View file

@ -132,13 +132,15 @@ namespace MWClass
MWBase::Environment::get().getWorld()->getMaxActivationDistance()) MWBase::Environment::get().getWorld()->getMaxActivationDistance())
{ {
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(ptr); MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(ptr);
if(animation)
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
int index = ESM::MagicEffect::effectStringToId("sEffectTelekinesis"); int index = ESM::MagicEffect::effectStringToId("sEffectTelekinesis");
const ESM::MagicEffect *effect = store.get<ESM::MagicEffect>().find(index); const ESM::MagicEffect *effect = store.get<ESM::MagicEffect>().find(index);
animation->addSpellCastGlow(effect, 1); // 1 second glow to match the time taken for a door opening or closing animation->addSpellCastGlow(effect, 1); // 1 second glow to match the time taken for a door opening or closing
} }
}
const std::string keyId = ptr.getCellRef().getKey(); const std::string keyId = ptr.getCellRef().getKey();
if (!keyId.empty()) if (!keyId.empty())

View file

@ -2552,7 +2552,14 @@ namespace MWWorld
MWRender::Animation* World::getAnimation(const MWWorld::Ptr &ptr) MWRender::Animation* World::getAnimation(const MWWorld::Ptr &ptr)
{ {
return mRendering->getAnimation(ptr); auto* animation = mRendering->getAnimation(ptr);
if(!animation) {
mWorldScene->removeFromPagedRefs(ptr);
animation = mRendering->getAnimation(ptr);
if(animation)
mRendering->pagingBlacklistObject(mStore.find(ptr.getCellRef().getRefId()), ptr);
}
return animation;
} }
const MWRender::Animation* World::getAnimation(const MWWorld::ConstPtr &ptr) const const MWRender::Animation* World::getAnimation(const MWWorld::ConstPtr &ptr) const