mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 07:56:40 +00:00 
			
		
		
		
	Revert "actoranimation.cpp faster getbonebyname (#3099)"
This reverts commit c284d0cf5c
			
			
This commit is contained in:
		
							parent
							
								
									e2d0e86020
								
							
						
					
					
						commit
						c40f921396
					
				
					 1 changed files with 13 additions and 11 deletions
				
			
		| 
						 | 
					@ -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…
	
		Reference in a new issue