1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-29 22:45:34 +00:00

Support animated container models

This commit is contained in:
scrawl 2014-12-05 20:58:33 +01:00
parent 5a25649076
commit e313ed3cef
2 changed files with 11 additions and 9 deletions

View file

@ -7,6 +7,7 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/failedaction.hpp"
@ -21,7 +22,7 @@
#include "../mwgui/tooltips.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/actors.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwmechanics/npcstats.hpp"
@ -87,7 +88,8 @@ namespace MWClass
{
const std::string model = getModel(ptr);
if (!model.empty()) {
renderingInterface.getObjects().insertModel(ptr, model);
MWRender::Actors& actors = renderingInterface.getActors();
actors.insertActivator(ptr);
}
}
@ -96,6 +98,7 @@ namespace MWClass
const std::string model = getModel(ptr);
if(!model.empty())
physics.addObject(ptr);
MWBase::Environment::get().getMechanicsManager()->add(ptr);
}
std::string Container::getModel(const MWWorld::Ptr &ptr) const

View file

@ -4,6 +4,8 @@
#include "../mwbase/world.hpp"
#include "../mwworld/class.hpp"
#include "renderconst.hpp"
namespace MWRender
@ -16,17 +18,14 @@ ActivatorAnimation::~ActivatorAnimation()
ActivatorAnimation::ActivatorAnimation(const MWWorld::Ptr &ptr)
: Animation(ptr, ptr.getRefData().getBaseNode())
{
MWWorld::LiveCellRef<ESM::Activator> *ref = mPtr.get<ESM::Activator>();
const std::string& model = mPtr.getClass().getModel(mPtr);
assert(ref->mBase != NULL);
if(!ref->mBase->mModel.empty())
if(!model.empty())
{
const std::string name = "meshes\\"+ref->mBase->mModel;
setObjectRoot(name, false);
setObjectRoot(model, false);
setRenderProperties(mObjectRoot, RV_Misc, RQG_Main, RQG_Alpha);
addAnimSource(name);
addAnimSource(model);
}
}