Use the Weapon Bone as fallback

pull/541/head
Andrei Kortunov 5 years ago
parent f0cef772fa
commit afaff8231d

@ -197,7 +197,7 @@ namespace MWMechanics
/* short group */ "1h", /* short group */ "1h",
/* long group */ "bowandarrow", /* long group */ "bowandarrow",
/* sound ID */ "Item Weapon Bow", /* sound ID */ "Item Weapon Bow",
/* attach bone */ "Weapon Bone", /* attach bone */ "Weapon Bone Left",
/* sheath bone */ "Bip01 MarksmanBow", /* sheath bone */ "Bip01 MarksmanBow",
/* usage skill */ ESM::Skill::Marksman, /* usage skill */ ESM::Skill::Marksman,
/* weapon class*/ ESM::WeaponType::Ranged, /* weapon class*/ ESM::WeaponType::Ranged,

@ -119,6 +119,13 @@ void CreatureWeaponAnimation::updatePart(PartHolderPtr& scene, int slot)
{ {
int type = item.get<ESM::Weapon>()->mBase->mData.mType; int type = item.get<ESM::Weapon>()->mBase->mData.mType;
bonename = MWMechanics::getWeaponType(type)->mAttachBone; bonename = MWMechanics::getWeaponType(type)->mAttachBone;
if (bonename != "Weapon Bone")
{
const NodeMap& nodeMap = getNodeMap();
NodeMap::const_iterator found = nodeMap.find(Misc::StringUtils::lowerCase(bonename));
if (found == nodeMap.end())
bonename = "Weapon Bone";
}
} }
else else
bonename = "Weapon Bone"; bonename = "Weapon Bone";

@ -745,7 +745,15 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g
if(weapon != inv.end() && weapon->getTypeName() == typeid(ESM::Weapon).name()) if(weapon != inv.end() && weapon->getTypeName() == typeid(ESM::Weapon).name())
{ {
int weaponType = weapon->get<ESM::Weapon>()->mBase->mData.mType; int weaponType = weapon->get<ESM::Weapon>()->mBase->mData.mType;
bonename = MWMechanics::getWeaponType(weaponType)->mAttachBone; const std::string weaponBonename = MWMechanics::getWeaponType(weaponType)->mAttachBone;
if (weaponBonename != bonename)
{
const NodeMap& nodeMap = getNodeMap();
NodeMap::const_iterator found = nodeMap.find(Misc::StringUtils::lowerCase(weaponBonename));
if (found != nodeMap.end())
bonename = weaponBonename;
}
} }
} }

Loading…
Cancel
Save