mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-01 18:06:43 +00:00
Merge pull request #2209 from akortunov/effectfix
[Regression] Fix magic glow update for sheathing weapons
This commit is contained in:
commit
cb29dc7b85
2 changed files with 14 additions and 11 deletions
|
@ -194,15 +194,16 @@ void ActorAnimation::injectWeaponBones()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// To make sure we do not run morph controllers for weapons, i.e. bows
|
void ActorAnimation::resetControllers(osg::Node* node)
|
||||||
class EmptyCallback : public osg::NodeCallback
|
|
||||||
{
|
{
|
||||||
public:
|
if (node == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
std::shared_ptr<SceneUtil::ControllerSource> src;
|
||||||
{
|
src.reset(new NullAnimationTime);
|
||||||
}
|
SceneUtil::AssignControllerSourcesVisitor removeVisitor(src);
|
||||||
};
|
node->accept(removeVisitor);
|
||||||
|
}
|
||||||
|
|
||||||
void ActorAnimation::updateHolsteredWeapon(bool showHolsteredWeapons)
|
void ActorAnimation::updateHolsteredWeapon(bool showHolsteredWeapons)
|
||||||
{
|
{
|
||||||
|
@ -230,7 +231,9 @@ void ActorAnimation::updateHolsteredWeapon(bool showHolsteredWeapons)
|
||||||
if (mesh.empty() || boneName.empty())
|
if (mesh.empty() || boneName.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If the scabbard is not found, use a weapon mesh as fallback
|
// If the scabbard is not found, use a weapon mesh as fallback.
|
||||||
|
// Note: it is unclear how to handle time for controllers attached to bodyparts, so disable them for now.
|
||||||
|
// We use the similar approach for other bodyparts.
|
||||||
scabbardName = scabbardName.replace(scabbardName.size()-4, 4, "_sh.nif");
|
scabbardName = scabbardName.replace(scabbardName.size()-4, 4, "_sh.nif");
|
||||||
bool isEnchanted = !weapon->getClass().getEnchantment(*weapon).empty();
|
bool isEnchanted = !weapon->getClass().getEnchantment(*weapon).empty();
|
||||||
if(!mResourceSystem->getVFS()->exists(scabbardName))
|
if(!mResourceSystem->getVFS()->exists(scabbardName))
|
||||||
|
@ -239,8 +242,7 @@ void ActorAnimation::updateHolsteredWeapon(bool showHolsteredWeapons)
|
||||||
{
|
{
|
||||||
osg::Vec4f glowColor = getEnchantmentColor(*weapon);
|
osg::Vec4f glowColor = getEnchantmentColor(*weapon);
|
||||||
mScabbard = getWeaponPart(mesh, boneName, isEnchanted, &glowColor);
|
mScabbard = getWeaponPart(mesh, boneName, isEnchanted, &glowColor);
|
||||||
if (mScabbard)
|
resetControllers(mScabbard->getNode());
|
||||||
mScabbard->getNode()->setUpdateCallback(new EmptyCallback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -265,7 +267,7 @@ void ActorAnimation::updateHolsteredWeapon(bool showHolsteredWeapons)
|
||||||
if (!weaponNode->getNumChildren())
|
if (!weaponNode->getNumChildren())
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Node> fallbackNode = mResourceSystem->getSceneManager()->getInstance(mesh, weaponNode);
|
osg::ref_ptr<osg::Node> fallbackNode = mResourceSystem->getSceneManager()->getInstance(mesh, weaponNode);
|
||||||
fallbackNode->setUpdateCallback(new EmptyCallback);
|
resetControllers(fallbackNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEnchanted)
|
if (isEnchanted)
|
||||||
|
|
|
@ -59,6 +59,7 @@ class ActorAnimation : public Animation, public MWWorld::ContainerStoreListener
|
||||||
private:
|
private:
|
||||||
void addHiddenItemLight(const MWWorld::ConstPtr& item, const ESM::Light* esmLight);
|
void addHiddenItemLight(const MWWorld::ConstPtr& item, const ESM::Light* esmLight);
|
||||||
void removeHiddenItemLight(const MWWorld::ConstPtr& item);
|
void removeHiddenItemLight(const MWWorld::ConstPtr& item);
|
||||||
|
void resetControllers(osg::Node* node);
|
||||||
|
|
||||||
typedef std::map<MWWorld::ConstPtr, osg::ref_ptr<SceneUtil::LightSource> > ItemLightMap;
|
typedef std::map<MWWorld::ConstPtr, osg::ref_ptr<SceneUtil::LightSource> > ItemLightMap;
|
||||||
ItemLightMap mItemLights;
|
ItemLightMap mItemLights;
|
||||||
|
|
Loading…
Reference in a new issue