mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-30 16:20:21 +00:00
Merge branch 'revert-c284d0cf' into 'master'
Fix weapon sheathing is broken Closes #6272 See merge request OpenMW/openmw!1215
This commit is contained in:
commit
ff29bd8dfa
@ -67,14 +67,17 @@ ActorAnimation::~ActorAnimation()
|
|||||||
|
|
||||||
PartHolderPtr ActorAnimation::attachMesh(const std::string& model, const std::string& bonename, bool enchantedGlow, osg::Vec4f* glowColor)
|
PartHolderPtr ActorAnimation::attachMesh(const std::string& model, const std::string& bonename, bool enchantedGlow, osg::Vec4f* glowColor)
|
||||||
{
|
{
|
||||||
|
osg::Group* parent = getBoneByName(bonename);
|
||||||
|
if (!parent)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
osg::ref_ptr<osg::Node> instance = mResourceSystem->getSceneManager()->getInstance(model, parent);
|
||||||
|
|
||||||
const NodeMap& nodeMap = getNodeMap();
|
const NodeMap& nodeMap = getNodeMap();
|
||||||
NodeMap::const_iterator found = nodeMap.find(Misc::StringUtils::lowerCase(bonename));
|
NodeMap::const_iterator found = nodeMap.find(Misc::StringUtils::lowerCase(bonename));
|
||||||
if (found == nodeMap.end())
|
if (found == nodeMap.end())
|
||||||
return PartHolderPtr();
|
return PartHolderPtr();
|
||||||
|
|
||||||
osg::Group* parent = found->second;
|
|
||||||
osg::ref_ptr<osg::Node> instance = mResourceSystem->getSceneManager()->getInstance(model, parent);
|
|
||||||
|
|
||||||
if (enchantedGlow)
|
if (enchantedGlow)
|
||||||
mGlowUpdater = SceneUtil::addEnchantedGlow(instance, mResourceSystem, *glowColor);
|
mGlowUpdater = SceneUtil::addEnchantedGlow(instance, mResourceSystem, *glowColor);
|
||||||
|
|
||||||
@ -133,9 +136,9 @@ bool ActorAnimation::updateCarriedLeftVisible(const int weaptype) const
|
|||||||
MWMechanics::CreatureStats &stats = cls.getCreatureStats(mPtr);
|
MWMechanics::CreatureStats &stats = cls.getCreatureStats(mPtr);
|
||||||
if (cls.hasInventoryStore(mPtr) && weaptype != ESM::Weapon::Spell)
|
if (cls.hasInventoryStore(mPtr) && weaptype != ESM::Weapon::Spell)
|
||||||
{
|
{
|
||||||
osg::Group* foundNode = getBoneByName ("Bip01 AttachShield");
|
SceneUtil::FindByNameVisitor findVisitor ("Bip01 AttachShield");
|
||||||
|
mObjectRoot->accept(findVisitor);
|
||||||
if (foundNode || (mPtr == MWMechanics::getPlayer() && mPtr.isInCell() && MWBase::Environment::get().getWorld()->isFirstPerson()))
|
if (findVisitor.mFoundNode || (mPtr == MWMechanics::getPlayer() && mPtr.isInCell() && MWBase::Environment::get().getWorld()->isFirstPerson()))
|
||||||
{
|
{
|
||||||
const MWWorld::InventoryStore& inv = cls.getInventoryStore(mPtr);
|
const MWWorld::InventoryStore& inv = cls.getInventoryStore(mPtr);
|
||||||
const MWWorld::ConstContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
const MWWorld::ConstContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||||
@ -273,11 +276,10 @@ osg::Group* ActorAnimation::getBoneByName(const std::string& boneName) const
|
|||||||
if (!mObjectRoot)
|
if (!mObjectRoot)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
const NodeMap& nodeMap = getNodeMap();
|
SceneUtil::FindByNameVisitor findVisitor (boneName);
|
||||||
NodeMap::const_iterator found = nodeMap.find(Misc::StringUtils::lowerCase(boneName));
|
mObjectRoot->accept(findVisitor);
|
||||||
if (found == nodeMap.end())
|
|
||||||
return nullptr;
|
return findVisitor.mFoundNode;
|
||||||
return found->second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ActorAnimation::getHolsteredWeaponBoneName(const MWWorld::ConstPtr& weapon)
|
std::string ActorAnimation::getHolsteredWeaponBoneName(const MWWorld::ConstPtr& weapon)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user