Correct xnif use for creatures

7220-lua-add-a-general-purpose-lexical-parser
Alexei Kotov 2 years ago
parent 434b4deda1
commit e24db874dc

@ -17,7 +17,7 @@ namespace MWRender
{
CreatureAnimation::CreatureAnimation(
const MWWorld::Ptr& ptr, const std::string& model, Resource::ResourceSystem* resourceSystem)
const MWWorld::Ptr& ptr, const std::string& model, Resource::ResourceSystem* resourceSystem, bool animated)
: ActorAnimation(ptr, osg::ref_ptr<osg::Group>(ptr.getRefData().getBaseNode()), resourceSystem)
{
MWWorld::LiveCellRef<ESM::Creature>* ref = mPtr.get<ESM::Creature>();
@ -28,12 +28,14 @@ namespace MWRender
if ((ref->mBase->mFlags & ESM::Creature::Bipedal))
addAnimSource(Settings::Manager::getString("xbaseanim", "Models"), model);
addAnimSource(model, model);
if (animated)
addAnimSource(model, model);
}
}
CreatureWeaponAnimation::CreatureWeaponAnimation(
const MWWorld::Ptr& ptr, const std::string& model, Resource::ResourceSystem* resourceSystem)
const MWWorld::Ptr& ptr, const std::string& model, Resource::ResourceSystem* resourceSystem, bool animated)
: ActorAnimation(ptr, osg::ref_ptr<osg::Group>(ptr.getRefData().getBaseNode()), resourceSystem)
, mShowWeapons(false)
, mShowCarriedLeft(false)
@ -45,10 +47,10 @@ namespace MWRender
setObjectRoot(model, true, false, true);
if ((ref->mBase->mFlags & ESM::Creature::Bipedal))
{
addAnimSource(Settings::Manager::getString("xbaseanim", "Models"), model);
}
addAnimSource(model, model);
if (animated)
addAnimSource(model, model);
mPtr.getClass().getInventoryStore(mPtr).setInvListener(this, mPtr);

@ -15,7 +15,8 @@ namespace MWRender
class CreatureAnimation : public ActorAnimation
{
public:
CreatureAnimation(const MWWorld::Ptr& ptr, const std::string& model, Resource::ResourceSystem* resourceSystem);
CreatureAnimation(
const MWWorld::Ptr& ptr, const std::string& model, Resource::ResourceSystem* resourceSystem, bool animated);
virtual ~CreatureAnimation() {}
};
@ -28,7 +29,7 @@ namespace MWRender
{
public:
CreatureWeaponAnimation(
const MWWorld::Ptr& ptr, const std::string& model, Resource::ResourceSystem* resourceSystem);
const MWWorld::Ptr& ptr, const std::string& model, Resource::ResourceSystem* resourceSystem, bool animated);
virtual ~CreatureWeaponAnimation() {}
void equipmentChanged() override { updateParts(); }

@ -93,16 +93,18 @@ namespace MWRender
insertBegin(ptr);
ptr.getRefData().getBaseNode()->setNodeMask(Mask_Actor);
bool animated = true;
std::string animationMesh = Misc::ResourceHelpers::correctActorModelPath(mesh, mResourceSystem->getVFS());
// FIXME: if animationMesh == mesh, the creature shouldn't be animated
if (animationMesh == mesh)
animated = false;
// CreatureAnimation
osg::ref_ptr<Animation> anim;
if (weaponsShields)
anim = new CreatureWeaponAnimation(ptr, animationMesh, mResourceSystem);
anim = new CreatureWeaponAnimation(ptr, animationMesh, mResourceSystem, animated);
else
anim = new CreatureAnimation(ptr, animationMesh, mResourceSystem);
anim = new CreatureAnimation(ptr, animationMesh, mResourceSystem, animated);
if (mObjects.emplace(ptr.mRef, anim).second)
ptr.getClass().getContainerStore(ptr).setContListener(static_cast<ActorAnimation*>(anim.get()));

Loading…
Cancel
Save