forked from teamnwah/openmw-tes3coop
Support animated container models
This commit is contained in:
parent
5a25649076
commit
e313ed3cef
2 changed files with 11 additions and 9 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/failedaction.hpp"
|
#include "../mwworld/failedaction.hpp"
|
||||||
|
@ -21,7 +22,7 @@
|
||||||
|
|
||||||
#include "../mwgui/tooltips.hpp"
|
#include "../mwgui/tooltips.hpp"
|
||||||
|
|
||||||
#include "../mwrender/objects.hpp"
|
#include "../mwrender/actors.hpp"
|
||||||
#include "../mwrender/renderinginterface.hpp"
|
#include "../mwrender/renderinginterface.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/npcstats.hpp"
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
@ -87,7 +88,8 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
const std::string model = getModel(ptr);
|
const std::string model = getModel(ptr);
|
||||||
if (!model.empty()) {
|
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);
|
const std::string model = getModel(ptr);
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr);
|
physics.addObject(ptr);
|
||||||
|
MWBase::Environment::get().getMechanicsManager()->add(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Container::getModel(const MWWorld::Ptr &ptr) const
|
std::string Container::getModel(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
|
#include "../mwworld/class.hpp"
|
||||||
|
|
||||||
#include "renderconst.hpp"
|
#include "renderconst.hpp"
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
|
@ -16,17 +18,14 @@ ActivatorAnimation::~ActivatorAnimation()
|
||||||
ActivatorAnimation::ActivatorAnimation(const MWWorld::Ptr &ptr)
|
ActivatorAnimation::ActivatorAnimation(const MWWorld::Ptr &ptr)
|
||||||
: Animation(ptr, ptr.getRefData().getBaseNode())
|
: 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(!model.empty())
|
||||||
if(!ref->mBase->mModel.empty())
|
|
||||||
{
|
{
|
||||||
const std::string name = "meshes\\"+ref->mBase->mModel;
|
setObjectRoot(model, false);
|
||||||
|
|
||||||
setObjectRoot(name, false);
|
|
||||||
setRenderProperties(mObjectRoot, RV_Misc, RQG_Main, RQG_Alpha);
|
setRenderProperties(mObjectRoot, RV_Misc, RQG_Main, RQG_Alpha);
|
||||||
|
|
||||||
addAnimSource(name);
|
addAnimSource(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue