Don't create a CharacterController for objects with no animations

pull/142/head
scrawl 8 years ago
parent fe0cf5be05
commit cce42b6e9d

@ -29,7 +29,8 @@ void Objects::addObject(const MWWorld::Ptr& ptr)
removeObject(ptr); removeObject(ptr);
MWRender::Animation *anim = MWBase::Environment::get().getWorld()->getAnimation(ptr); MWRender::Animation *anim = MWBase::Environment::get().getWorld()->getAnimation(ptr);
if(anim) mObjects.insert(std::make_pair(ptr, new CharacterController(ptr, anim))); if (anim && anim->hasAnimSources())
mObjects.insert(std::make_pair(ptr, new CharacterController(ptr, anim)));
} }
void Objects::removeObject(const MWWorld::Ptr& ptr) void Objects::removeObject(const MWWorld::Ptr& ptr)

@ -565,6 +565,11 @@ namespace MWRender
} }
} }
bool Animation::hasAnimSources() const
{
return !mAnimSources.empty();
}
void Animation::clearAnimSources() void Animation::clearAnimSources()
{ {
mStates.clear(); mStates.clear();

@ -341,6 +341,8 @@ public:
Animation(const MWWorld::Ptr &ptr, osg::ref_ptr<osg::Group> parentNode, Resource::ResourceSystem* resourceSystem); Animation(const MWWorld::Ptr &ptr, osg::ref_ptr<osg::Group> parentNode, Resource::ResourceSystem* resourceSystem);
virtual ~Animation(); virtual ~Animation();
bool hasAnimSources() const;
MWWorld::ConstPtr getPtr() const; MWWorld::ConstPtr getPtr() const;
/// Set active flag on the object skeleton, if one exists. /// Set active flag on the object skeleton, if one exists.

Loading…
Cancel
Save