1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-01 03:21:41 +00:00
OpenMW/apps/openmw/mwclass/bodypart.cpp

54 lines
1.4 KiB
C++
Raw Normal View History

#include "bodypart.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwrender/objects.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
namespace MWClass
{
2022-04-04 00:44:53 +00:00
BodyPart::BodyPart()
: MWWorld::RegisteredClass<BodyPart>(ESM::BodyPart::sRecordId)
{
}
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);
}
}
std::string BodyPart::getName(const MWWorld::ConstPtr &ptr) const
{
return std::string();
}
bool BodyPart::hasToolTip(const MWWorld::ConstPtr& ptr) const
{
return false;
}
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 MWBase::Environment::get().getWindowManager()->correctMeshPath(model);
}
return "";
}
}