Object animation fix

This commit is contained in:
scrawl 2015-05-28 15:44:58 +02:00
parent c811ac6afe
commit f4ee805e3b
7 changed files with 8 additions and 8 deletions

View file

@ -2,11 +2,12 @@
#include <iostream> #include <iostream>
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "creaturestats.hpp" #include "creaturestats.hpp"
#include "movement.hpp" #include "movement.hpp"
#include "mechanicsmanagerimp.hpp"
#include <OgreMath.h> #include <OgreMath.h>

View file

@ -1875,7 +1875,7 @@ void CharacterController::update(float duration)
void CharacterController::playGroup(const std::string &groupname, int mode, int count) void CharacterController::playGroup(const std::string &groupname, int mode, int count)
{ {
if(!mAnimation || !mAnimation->hasAnimation(groupname)) if(!mAnimation || !mAnimation->hasAnimation(groupname))
std::cerr<< "Animation "<<groupname<<" not found" <<std::endl; std::cerr<< "Animation "<<groupname<<" not found for " << mPtr.getCellRef().getRefId() << std::endl;
else else
{ {
count = std::max(count, 1); count = std::max(count, 1);

View file

@ -1176,12 +1176,14 @@ namespace MWRender
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
ObjectAnimation::ObjectAnimation(const MWWorld::Ptr &ptr, const std::string &model, Resource::ResourceSystem* resourceSystem, bool allowLight) ObjectAnimation::ObjectAnimation(const MWWorld::Ptr &ptr, const std::string &model, Resource::ResourceSystem* resourceSystem, bool animated, bool allowLight)
: Animation(ptr, osg::ref_ptr<osg::Group>(ptr.getRefData().getBaseNode()), resourceSystem) : Animation(ptr, osg::ref_ptr<osg::Group>(ptr.getRefData().getBaseNode()), resourceSystem)
{ {
if (!model.empty()) if (!model.empty())
{ {
setObjectRoot(model, false, false); setObjectRoot(model, false, false);
if (animated)
addAnimSource(model);
if (!ptr.getClass().getEnchantment(ptr).empty()) if (!ptr.getClass().getEnchantment(ptr).empty())
addGlow(mObjectRoot, getEnchantmentColor(ptr)); addGlow(mObjectRoot, getEnchantmentColor(ptr));

View file

@ -395,7 +395,7 @@ private:
class ObjectAnimation : public Animation { class ObjectAnimation : public Animation {
public: public:
ObjectAnimation(const MWWorld::Ptr& ptr, const std::string &model, Resource::ResourceSystem* resourceSystem, bool allowLight); ObjectAnimation(const MWWorld::Ptr& ptr, const std::string &model, Resource::ResourceSystem* resourceSystem, bool animated, bool allowLight);
}; };
} }

View file

@ -24,7 +24,6 @@ CreatureAnimation::CreatureAnimation(const MWWorld::Ptr &ptr,
if(!model.empty()) if(!model.empty())
{ {
setObjectRoot(model, false, false); setObjectRoot(model, false, false);
//setRenderProperties(mObjectRoot, RV_Actors, RQG_Main, RQG_Alpha);
if((ref->mBase->mFlags&ESM::Creature::Bipedal)) if((ref->mBase->mFlags&ESM::Creature::Bipedal))
addAnimSource("meshes\\xbase_anim.nif"); addAnimSource("meshes\\xbase_anim.nif");
@ -43,7 +42,6 @@ CreatureWeaponAnimation::CreatureWeaponAnimation(const MWWorld::Ptr &ptr, const
if(!model.empty()) if(!model.empty())
{ {
setObjectRoot(model, true, false); setObjectRoot(model, true, false);
//setRenderProperties(mObjectRoot, RV_Actors, RQG_Main, RQG_Alpha);
if((ref->mBase->mFlags&ESM::Creature::Bipedal)) if((ref->mBase->mFlags&ESM::Creature::Bipedal))
addAnimSource("meshes\\xbase_anim.nif"); addAnimSource("meshes\\xbase_anim.nif");

View file

@ -109,7 +109,7 @@ void Objects::insertModel(const MWWorld::Ptr &ptr, const std::string &mesh, bool
{ {
insertBegin(ptr); insertBegin(ptr);
std::auto_ptr<ObjectAnimation> anim (new ObjectAnimation(ptr, mesh, mResourceSystem, allowLight)); std::auto_ptr<ObjectAnimation> anim (new ObjectAnimation(ptr, mesh, mResourceSystem, animated, allowLight));
if (!allowLight) if (!allowLight)
{ {

View file

@ -20,7 +20,6 @@
#include "../mwmechanics/movement.hpp" #include "../mwmechanics/movement.hpp"
#include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/npcstats.hpp"
#include "../mwmechanics/actors.hpp" #include "../mwmechanics/actors.hpp"
#include "../mwmechanics/mechanicsmanagerimp.hpp"
#include "class.hpp" #include "class.hpp"
#include "ptr.hpp" #include "ptr.hpp"