mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-06 16:15:35 +00:00
Use normalized path for Class::getCorrectedModel
This commit is contained in:
parent
630e815f66
commit
6cd76fb8a7
8 changed files with 13 additions and 14 deletions
|
@ -4,7 +4,6 @@
|
||||||
#include "../mwworld/livecellref.hpp"
|
#include "../mwworld/livecellref.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
|
|
|
@ -441,15 +441,15 @@ namespace MWClass
|
||||||
return model.substr(prefix.size());
|
return model.substr(prefix.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Npc::getCorrectedModel(const MWWorld::ConstPtr& ptr) const
|
VFS::Path::Normalized Npc::getCorrectedModel(const MWWorld::ConstPtr& ptr) const
|
||||||
{
|
{
|
||||||
const MWWorld::LiveCellRef<ESM::NPC>* ref = ptr.get<ESM::NPC>();
|
const MWWorld::LiveCellRef<ESM::NPC>* ref = ptr.get<ESM::NPC>();
|
||||||
|
|
||||||
const ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(ref->mBase->mRace);
|
const ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(ref->mBase->mRace);
|
||||||
if (race->mData.mFlags & ESM::Race::Beast)
|
if (race->mData.mFlags & ESM::Race::Beast)
|
||||||
return Settings::models().mBaseanimkna.get().value();
|
return Settings::models().mBaseanimkna.get();
|
||||||
|
|
||||||
return Settings::models().mBaseanim.get().value();
|
return Settings::models().mBaseanim.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Npc::getModelsToPreload(const MWWorld::ConstPtr& ptr, std::vector<std::string_view>& models) const
|
void Npc::getModelsToPreload(const MWWorld::ConstPtr& ptr, std::vector<std::string_view>& models) const
|
||||||
|
|
|
@ -133,7 +133,7 @@ namespace MWClass
|
||||||
|
|
||||||
std::string_view getModel(const MWWorld::ConstPtr& ptr) const override;
|
std::string_view getModel(const MWWorld::ConstPtr& ptr) const override;
|
||||||
|
|
||||||
std::string getCorrectedModel(const MWWorld::ConstPtr& ptr) const override;
|
VFS::Path::Normalized getCorrectedModel(const MWWorld::ConstPtr& ptr) const override;
|
||||||
|
|
||||||
float getSkill(const MWWorld::Ptr& ptr, ESM::RefId id) const override;
|
float getSkill(const MWWorld::Ptr& ptr, ESM::RefId id) const override;
|
||||||
|
|
||||||
|
|
|
@ -1437,8 +1437,8 @@ namespace MWScript
|
||||||
osg::Vec3f pos(ptr.getRefData().getPosition().asVec3());
|
osg::Vec3f pos(ptr.getRefData().getPosition().asVec3());
|
||||||
msg << "Coordinates: " << pos.x() << " " << pos.y() << " " << pos.z() << std::endl;
|
msg << "Coordinates: " << pos.x() << " " << pos.y() << " " << pos.z() << std::endl;
|
||||||
auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
|
auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
|
||||||
const VFS::Path::Normalized model = ::Misc::ResourceHelpers::correctActorModelPath(
|
const VFS::Path::Normalized model
|
||||||
VFS::Path::toNormalized(ptr.getClass().getCorrectedModel(ptr)), vfs);
|
= ::Misc::ResourceHelpers::correctActorModelPath(ptr.getClass().getCorrectedModel(ptr), vfs);
|
||||||
msg << "Model: " << model.value() << std::endl;
|
msg << "Model: " << model.value() << std::endl;
|
||||||
if (!model.empty())
|
if (!model.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -311,7 +311,7 @@ namespace MWWorld
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Class::getCorrectedModel(const MWWorld::ConstPtr& ptr) const
|
VFS::Path::Normalized Class::getCorrectedModel(const MWWorld::ConstPtr& ptr) const
|
||||||
{
|
{
|
||||||
std::string_view model = getModel(ptr);
|
std::string_view model = getModel(ptr);
|
||||||
if (!model.empty())
|
if (!model.empty())
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include <components/esm/refid.hpp>
|
#include <components/esm/refid.hpp>
|
||||||
#include <components/esm3/loadskil.hpp>
|
#include <components/esm3/loadskil.hpp>
|
||||||
|
#include <components/vfs/pathutil.hpp>
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
|
@ -277,7 +278,7 @@ namespace MWWorld
|
||||||
|
|
||||||
virtual std::string_view getModel(const MWWorld::ConstPtr& ptr) const;
|
virtual std::string_view getModel(const MWWorld::ConstPtr& ptr) const;
|
||||||
|
|
||||||
virtual std::string getCorrectedModel(const MWWorld::ConstPtr& ptr) const;
|
virtual VFS::Path::Normalized getCorrectedModel(const MWWorld::ConstPtr& ptr) const;
|
||||||
|
|
||||||
virtual bool useAnim() const;
|
virtual bool useAnim() const;
|
||||||
///< Whether or not to use animated variant of model (default false)
|
///< Whether or not to use animated variant of model (default false)
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace
|
||||||
rendering.rotateObject(ptr, rotation);
|
rendering.rotateObject(ptr, rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getModel(const MWWorld::Ptr& ptr)
|
VFS::Path::Normalized getModel(const MWWorld::Ptr& ptr)
|
||||||
{
|
{
|
||||||
if (Misc::ResourceHelpers::isHiddenMarker(ptr.getCellRef().getRefId()))
|
if (Misc::ResourceHelpers::isHiddenMarker(ptr.getCellRef().getRefId()))
|
||||||
return {};
|
return {};
|
||||||
|
@ -115,7 +115,7 @@ namespace
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string model = getModel(ptr);
|
const VFS::Path::Normalized model = getModel(ptr);
|
||||||
const auto rotation = makeDirectNodeRotation(ptr);
|
const auto rotation = makeDirectNodeRotation(ptr);
|
||||||
|
|
||||||
ESM::RefNum refnum = ptr.getCellRef().getRefNum();
|
ESM::RefNum refnum = ptr.getCellRef().getRefNum();
|
||||||
|
@ -706,7 +706,7 @@ namespace MWWorld
|
||||||
ptr.mRef->mData.mPhysicsPostponed = false;
|
ptr.mRef->mData.mPhysicsPostponed = false;
|
||||||
if (ptr.mRef->mData.isEnabled() && ptr.mRef->mRef.getCount() > 0)
|
if (ptr.mRef->mData.isEnabled() && ptr.mRef->mRef.getCount() > 0)
|
||||||
{
|
{
|
||||||
std::string model = getModel(ptr);
|
const VFS::Path::Normalized model = getModel(ptr);
|
||||||
if (!model.empty())
|
if (!model.empty())
|
||||||
{
|
{
|
||||||
const auto rotation = makeNodeRotation(ptr, RotationOrder::direct);
|
const auto rotation = makeNodeRotation(ptr, RotationOrder::direct);
|
||||||
|
|
|
@ -2325,8 +2325,7 @@ namespace MWWorld
|
||||||
MWBase::Environment::get().getWindowManager()->watchActor(getPlayerPtr());
|
MWBase::Environment::get().getWindowManager()->watchActor(getPlayerPtr());
|
||||||
|
|
||||||
mPhysics->remove(getPlayerPtr());
|
mPhysics->remove(getPlayerPtr());
|
||||||
mPhysics->addActor(
|
mPhysics->addActor(getPlayerPtr(), getPlayerPtr().getClass().getCorrectedModel(getPlayerPtr()));
|
||||||
getPlayerPtr(), VFS::Path::toNormalized(getPlayerPtr().getClass().getCorrectedModel(getPlayerPtr())));
|
|
||||||
|
|
||||||
applyLoopingParticles(player);
|
applyLoopingParticles(player);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue