mirror of
https://github.com/OpenMW/openmw.git
synced 2025-05-13 03:41:28 +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(
|
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)
|
: ActorAnimation(ptr, osg::ref_ptr<osg::Group>(ptr.getRefData().getBaseNode()), resourceSystem)
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Creature>* ref = mPtr.get<ESM::Creature>();
|
MWWorld::LiveCellRef<ESM::Creature>* ref = mPtr.get<ESM::Creature>();
|
||||||
|
@ -28,12 +28,14 @@ namespace MWRender
|
||||||
|
|
||||||
if ((ref->mBase->mFlags & ESM::Creature::Bipedal))
|
if ((ref->mBase->mFlags & ESM::Creature::Bipedal))
|
||||||
addAnimSource(Settings::Manager::getString("xbaseanim", "Models"), model);
|
addAnimSource(Settings::Manager::getString("xbaseanim", "Models"), model);
|
||||||
addAnimSource(model, model);
|
|
||||||
|
if (animated)
|
||||||
|
addAnimSource(model, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatureWeaponAnimation::CreatureWeaponAnimation(
|
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)
|
: ActorAnimation(ptr, osg::ref_ptr<osg::Group>(ptr.getRefData().getBaseNode()), resourceSystem)
|
||||||
, mShowWeapons(false)
|
, mShowWeapons(false)
|
||||||
, mShowCarriedLeft(false)
|
, mShowCarriedLeft(false)
|
||||||
|
@ -45,10 +47,10 @@ namespace MWRender
|
||||||
setObjectRoot(model, true, false, true);
|
setObjectRoot(model, true, false, true);
|
||||||
|
|
||||||
if ((ref->mBase->mFlags & ESM::Creature::Bipedal))
|
if ((ref->mBase->mFlags & ESM::Creature::Bipedal))
|
||||||
{
|
|
||||||
addAnimSource(Settings::Manager::getString("xbaseanim", "Models"), model);
|
addAnimSource(Settings::Manager::getString("xbaseanim", "Models"), model);
|
||||||
}
|
|
||||||
addAnimSource(model, model);
|
if (animated)
|
||||||
|
addAnimSource(model, model);
|
||||||
|
|
||||||
mPtr.getClass().getInventoryStore(mPtr).setInvListener(this, mPtr);
|
mPtr.getClass().getInventoryStore(mPtr).setInvListener(this, mPtr);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,8 @@ namespace MWRender
|
||||||
class CreatureAnimation : public ActorAnimation
|
class CreatureAnimation : public ActorAnimation
|
||||||
{
|
{
|
||||||
public:
|
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() {}
|
virtual ~CreatureAnimation() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,7 +29,7 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
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);
|
||||||
virtual ~CreatureWeaponAnimation() {}
|
virtual ~CreatureWeaponAnimation() {}
|
||||||
|
|
||||||
void equipmentChanged() override { updateParts(); }
|
void equipmentChanged() override { updateParts(); }
|
||||||
|
|
|
@ -93,16 +93,18 @@ namespace MWRender
|
||||||
insertBegin(ptr);
|
insertBegin(ptr);
|
||||||
ptr.getRefData().getBaseNode()->setNodeMask(Mask_Actor);
|
ptr.getRefData().getBaseNode()->setNodeMask(Mask_Actor);
|
||||||
|
|
||||||
|
bool animated = true;
|
||||||
std::string animationMesh = Misc::ResourceHelpers::correctActorModelPath(mesh, mResourceSystem->getVFS());
|
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
|
// CreatureAnimation
|
||||||
osg::ref_ptr<Animation> anim;
|
osg::ref_ptr<Animation> anim;
|
||||||
|
|
||||||
if (weaponsShields)
|
if (weaponsShields)
|
||||||
anim = new CreatureWeaponAnimation(ptr, animationMesh, mResourceSystem);
|
anim = new CreatureWeaponAnimation(ptr, animationMesh, mResourceSystem, animated);
|
||||||
else
|
else
|
||||||
anim = new CreatureAnimation(ptr, animationMesh, mResourceSystem);
|
anim = new CreatureAnimation(ptr, animationMesh, mResourceSystem, animated);
|
||||||
|
|
||||||
if (mObjects.emplace(ptr.mRef, anim).second)
|
if (mObjects.emplace(ptr.mRef, anim).second)
|
||||||
ptr.getClass().getContainerStore(ptr).setContListener(static_cast<ActorAnimation*>(anim.get()));
|
ptr.getClass().getContainerStore(ptr).setContListener(static_cast<ActorAnimation*>(anim.get()));
|
||||||
|
|
Loading…
Reference in a new issue