mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-07 01:11:32 +00:00
Crash fix for creatures with no skeleton base (Fixes #2419)
This commit is contained in:
parent
0ad514b29b
commit
191c0104f6
3 changed files with 37 additions and 20 deletions
|
@ -1271,7 +1271,11 @@ void Animation::addEffect(const std::string &model, int effectId, bool loop, con
|
||||||
if (bonename.empty())
|
if (bonename.empty())
|
||||||
params.mObjects = NifOgre::Loader::createObjects(mInsert, model);
|
params.mObjects = NifOgre::Loader::createObjects(mInsert, model);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (!mSkelBase)
|
||||||
|
return;
|
||||||
params.mObjects = NifOgre::Loader::createObjects(mSkelBase, bonename, "", mInsert, model);
|
params.mObjects = NifOgre::Loader::createObjects(mSkelBase, bonename, "", mInsert, model);
|
||||||
|
}
|
||||||
|
|
||||||
setRenderProperties(params.mObjects, RV_Effects,
|
setRenderProperties(params.mObjects, RV_Effects,
|
||||||
RQG_Main, RQG_Alpha, 0.f, false, NULL);
|
RQG_Main, RQG_Alpha, 0.f, false, NULL);
|
||||||
|
|
|
@ -88,6 +88,9 @@ void CreatureWeaponAnimation::updateParts()
|
||||||
|
|
||||||
void CreatureWeaponAnimation::updatePart(NifOgre::ObjectScenePtr& scene, int slot)
|
void CreatureWeaponAnimation::updatePart(NifOgre::ObjectScenePtr& scene, int slot)
|
||||||
{
|
{
|
||||||
|
if (!mSkelBase)
|
||||||
|
return;
|
||||||
|
|
||||||
MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr);
|
MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr);
|
||||||
MWWorld::ContainerStoreIterator it = inv.getSlot(slot);
|
MWWorld::ContainerStoreIterator it = inv.getSlot(slot);
|
||||||
|
|
||||||
|
@ -181,6 +184,8 @@ void CreatureWeaponAnimation::releaseArrow()
|
||||||
Ogre::Vector3 CreatureWeaponAnimation::runAnimation(float duration)
|
Ogre::Vector3 CreatureWeaponAnimation::runAnimation(float duration)
|
||||||
{
|
{
|
||||||
Ogre::Vector3 ret = Animation::runAnimation(duration);
|
Ogre::Vector3 ret = Animation::runAnimation(duration);
|
||||||
|
|
||||||
|
if (mSkelBase)
|
||||||
pitchSkeleton(mPtr.getRefData().getPosition().rot[0], mSkelBase->getSkeleton());
|
pitchSkeleton(mPtr.getRefData().getPosition().rot[0], mSkelBase->getSkeleton());
|
||||||
|
|
||||||
if (!mWeapon.isNull())
|
if (!mWeapon.isNull())
|
||||||
|
|
|
@ -336,6 +336,9 @@ void NpcAnimation::updateNpcBase()
|
||||||
|
|
||||||
void NpcAnimation::updateParts()
|
void NpcAnimation::updateParts()
|
||||||
{
|
{
|
||||||
|
if (!mSkelBase)
|
||||||
|
return;
|
||||||
|
|
||||||
mAlpha = 1.f;
|
mAlpha = 1.f;
|
||||||
const MWWorld::Class &cls = mPtr.getClass();
|
const MWWorld::Class &cls = mPtr.getClass();
|
||||||
|
|
||||||
|
@ -626,6 +629,8 @@ Ogre::Vector3 NpcAnimation::runAnimation(float timepassed)
|
||||||
|
|
||||||
mHeadAnimationTime->update(timepassed);
|
mHeadAnimationTime->update(timepassed);
|
||||||
|
|
||||||
|
if (mSkelBase)
|
||||||
|
{
|
||||||
Ogre::SkeletonInstance *baseinst = mSkelBase->getSkeleton();
|
Ogre::SkeletonInstance *baseinst = mSkelBase->getSkeleton();
|
||||||
if(mViewMode == VM_FirstPerson)
|
if(mViewMode == VM_FirstPerson)
|
||||||
{
|
{
|
||||||
|
@ -646,6 +651,7 @@ Ogre::Vector3 NpcAnimation::runAnimation(float timepassed)
|
||||||
if (node)
|
if (node)
|
||||||
node->rotate(Ogre::Quaternion(mHeadYaw, Ogre::Vector3::UNIT_Z) * Ogre::Quaternion(mHeadPitch, Ogre::Vector3::UNIT_X), Ogre::Node::TS_WORLD);
|
node->rotate(Ogre::Quaternion(mHeadYaw, Ogre::Vector3::UNIT_Z) * Ogre::Quaternion(mHeadPitch, Ogre::Vector3::UNIT_X), Ogre::Node::TS_WORLD);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
mFirstPersonOffset = 0.f; // reset the X, Y, Z offset for the next frame.
|
mFirstPersonOffset = 0.f; // reset the X, Y, Z offset for the next frame.
|
||||||
|
|
||||||
for(size_t i = 0;i < ESM::PRT_Count;i++)
|
for(size_t i = 0;i < ESM::PRT_Count;i++)
|
||||||
|
@ -659,7 +665,9 @@ Ogre::Vector3 NpcAnimation::runAnimation(float timepassed)
|
||||||
if (!isSkinned(mObjectParts[i]))
|
if (!isSkinned(mObjectParts[i]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
updateSkeletonInstance(baseinst, mObjectParts[i]->mSkelBase->getSkeleton());
|
if (mSkelBase)
|
||||||
|
updateSkeletonInstance(mSkelBase->getSkeleton(), mObjectParts[i]->mSkelBase->getSkeleton());
|
||||||
|
|
||||||
mObjectParts[i]->mSkelBase->getAllAnimationStates()->_notifyDirty();
|
mObjectParts[i]->mSkelBase->getAllAnimationStates()->_notifyDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue