1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 03:39:14 +00:00
OpenMW/apps/openmw/mwclass/bodypart.cpp
Capostrophic 6b74630f6e Preparation work
Phase out canBeActivated() to unify activation checks
Use getName() for the name caption in tooltips
Always use tooltips for non-activator objects
Invert hasTooltip default value
2019-09-10 23:38:16 +03:00

58 lines
1.5 KiB
C++

#include "bodypart.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwrender/objects.hpp"
#include "../mwworld/cellstore.hpp"
namespace MWClass
{
MWWorld::Ptr BodyPart::copyToCellImpl(const MWWorld::ConstPtr &ptr, MWWorld::CellStore &cell) const
{
const MWWorld::LiveCellRef<ESM::BodyPart> *ref = ptr.get<ESM::BodyPart>();
return MWWorld::Ptr(cell.insert(ref), &cell);
}
void BodyPart::insertObjectRendering(const MWWorld::Ptr &ptr, const std::string &model, MWRender::RenderingInterface &renderingInterface) const
{
if (!model.empty()) {
renderingInterface.getObjects().insertModel(ptr, model);
}
}
void BodyPart::insertObject(const MWWorld::Ptr &ptr, const std::string &model, MWPhysics::PhysicsSystem &physics) const
{
}
std::string BodyPart::getName(const MWWorld::ConstPtr &ptr) const
{
return std::string();
}
bool BodyPart::hasToolTip(const MWWorld::ConstPtr& ptr) const
{
return false;
}
void BodyPart::registerSelf()
{
std::shared_ptr<MWWorld::Class> instance (new BodyPart);
registerClass (typeid (ESM::BodyPart).name(), instance);
}
std::string BodyPart::getModel(const MWWorld::ConstPtr &ptr) const
{
const MWWorld::LiveCellRef<ESM::BodyPart> *ref = ptr.get<ESM::BodyPart>();
const std::string &model = ref->mBase->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
return "";
}
}