forked from mirror/openmw-tes3mp
getHitContact Head exception fix
This commit is contained in:
parent
cc3bfe2bb2
commit
988a9cad58
4 changed files with 13 additions and 17 deletions
|
@ -1158,10 +1158,10 @@ bool CharacterController::updateWeaponState()
|
|||
effect = store.get<ESM::MagicEffect>().find(effectentry.mEffectID);
|
||||
|
||||
const ESM::Static* castStatic = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>().find ("VFX_Hands");
|
||||
if (mAnimation->hasNode("Bip01 L Hand"))
|
||||
if (mAnimation->getNode("Bip01 L Hand"))
|
||||
mAnimation->addEffect("meshes\\" + castStatic->mModel, -1, false, "Bip01 L Hand", effect->mParticle);
|
||||
|
||||
if (mAnimation->hasNode("Bip01 R Hand"))
|
||||
if (mAnimation->getNode("Bip01 R Hand"))
|
||||
mAnimation->addEffect("meshes\\" + castStatic->mModel, -1, false, "Bip01 R Hand", effect->mParticle);
|
||||
|
||||
switch(effectentry.mRange)
|
||||
|
|
|
@ -1136,18 +1136,13 @@ namespace MWRender
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Animation::hasNode(const std::string &name) const
|
||||
{
|
||||
std::string lowerName = Misc::StringUtils::lowerCase(name);
|
||||
return (mNodeMap.find(lowerName) != mNodeMap.end());
|
||||
}
|
||||
|
||||
const osg::Node* Animation::getNode(const std::string &name) const
|
||||
{
|
||||
std::string lowerName = Misc::StringUtils::lowerCase(name);
|
||||
NodeMap::const_iterator found = mNodeMap.find(lowerName);
|
||||
if (found == mNodeMap.end())
|
||||
throw std::runtime_error("Can't find node " + name);
|
||||
return NULL;
|
||||
else
|
||||
return found->second;
|
||||
}
|
||||
|
||||
|
|
|
@ -367,11 +367,7 @@ public:
|
|||
/// This is typically called as part of runAnimation, but may be called manually if needed.
|
||||
void updateEffects(float duration);
|
||||
|
||||
/// Is there a node with the specified name?
|
||||
/// @note The matching is case-insensitive.
|
||||
bool hasNode(const std::string& name) const;
|
||||
|
||||
/// Return a node with the specified name, throws an exception if the node is not found.
|
||||
/// Return a node with the specified name, or NULL if not existing.
|
||||
/// @note The matching is case-insensitive.
|
||||
const osg::Node* getNode(const std::string& name) const;
|
||||
|
||||
|
|
|
@ -363,8 +363,13 @@ namespace MWRender
|
|||
mCamera->removeUpdateCallback(mUpdateCameraCallback);
|
||||
|
||||
const osg::Node* head = mAnimation->getNode("Bip01 Head");
|
||||
if (head)
|
||||
{
|
||||
mUpdateCameraCallback = new UpdateCameraCallback(head, mPosition, mLookAt);
|
||||
mCamera->addUpdateCallback(mUpdateCameraCallback);
|
||||
}
|
||||
else
|
||||
std::cerr << "Error: Bip01 Head node not found" << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue