mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-01 18:36:41 +00:00
Correct xnif use for creatures
This commit is contained in:
parent
434b4deda1
commit
e24db874dc
3 changed files with 16 additions and 11 deletions
|
@ -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…
Reference in a new issue