mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-06 23:45:35 +00:00
Merge branch 'vfs_normalized_path_21' into 'master'
Use normalized path for Class::getCorrectedModel (#8138) See merge request OpenMW/openmw!4461
This commit is contained in:
commit
b6a1461141
11 changed files with 20 additions and 19 deletions
|
@ -131,8 +131,7 @@ namespace NavMeshTool
|
|||
osg::ref_ptr<const Resource::BulletShape> shape = [&] {
|
||||
try
|
||||
{
|
||||
return bulletShapeManager.getShape(
|
||||
VFS::Path::toNormalized(Misc::ResourceHelpers::correctMeshPath(model)));
|
||||
return bulletShapeManager.getShape(Misc::ResourceHelpers::correctMeshPath(model));
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "../mwworld/livecellref.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace MWClass
|
||||
|
|
|
@ -441,15 +441,15 @@ namespace MWClass
|
|||
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 ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(ref->mBase->mRace);
|
||||
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
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace MWClass
|
|||
|
||||
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;
|
||||
|
||||
|
|
|
@ -571,7 +571,7 @@ namespace MWPhysics
|
|||
{
|
||||
if (animationMesh != mesh)
|
||||
{
|
||||
shape = mShapeManager->getShape(VFS::Path::toNormalized(mesh));
|
||||
shape = mShapeManager->getShape(mesh);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -591,8 +591,7 @@ namespace MWPhysics
|
|||
int PhysicsSystem::addProjectile(
|
||||
const MWWorld::Ptr& caster, const osg::Vec3f& position, VFS::Path::NormalizedView mesh, bool computeRadius)
|
||||
{
|
||||
osg::ref_ptr<Resource::BulletShapeInstance> shapeInstance
|
||||
= mShapeManager->getInstance(VFS::Path::toNormalized(mesh));
|
||||
osg::ref_ptr<Resource::BulletShapeInstance> shapeInstance = mShapeManager->getInstance(mesh);
|
||||
assert(shapeInstance);
|
||||
float radius = computeRadius ? shapeInstance->mCollisionBox.mExtents.length() / 2.f : 1.f;
|
||||
|
||||
|
|
|
@ -1437,8 +1437,8 @@ namespace MWScript
|
|||
osg::Vec3f pos(ptr.getRefData().getPosition().asVec3());
|
||||
msg << "Coordinates: " << pos.x() << " " << pos.y() << " " << pos.z() << std::endl;
|
||||
auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
|
||||
const VFS::Path::Normalized model = ::Misc::ResourceHelpers::correctActorModelPath(
|
||||
VFS::Path::toNormalized(ptr.getClass().getCorrectedModel(ptr)), vfs);
|
||||
const VFS::Path::Normalized model
|
||||
= ::Misc::ResourceHelpers::correctActorModelPath(ptr.getClass().getCorrectedModel(ptr), vfs);
|
||||
msg << "Model: " << model.value() << std::endl;
|
||||
if (!model.empty())
|
||||
{
|
||||
|
|
|
@ -311,7 +311,7 @@ namespace MWWorld
|
|||
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);
|
||||
if (!model.empty())
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include <components/esm/refid.hpp>
|
||||
#include <components/esm3/loadskil.hpp>
|
||||
#include <components/vfs/pathutil.hpp>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
|
@ -277,7 +278,7 @@ namespace MWWorld
|
|||
|
||||
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;
|
||||
///< Whether or not to use animated variant of model (default false)
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace
|
|||
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()))
|
||||
return {};
|
||||
|
@ -115,7 +115,7 @@ namespace
|
|||
return;
|
||||
}
|
||||
|
||||
std::string model = getModel(ptr);
|
||||
const VFS::Path::Normalized model = getModel(ptr);
|
||||
const auto rotation = makeDirectNodeRotation(ptr);
|
||||
|
||||
ESM::RefNum refnum = ptr.getCellRef().getRefNum();
|
||||
|
@ -706,7 +706,7 @@ namespace MWWorld
|
|||
ptr.mRef->mData.mPhysicsPostponed = false;
|
||||
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())
|
||||
{
|
||||
const auto rotation = makeNodeRotation(ptr, RotationOrder::direct);
|
||||
|
|
|
@ -2325,8 +2325,7 @@ namespace MWWorld
|
|||
MWBase::Environment::get().getWindowManager()->watchActor(getPlayerPtr());
|
||||
|
||||
mPhysics->remove(getPlayerPtr());
|
||||
mPhysics->addActor(
|
||||
getPlayerPtr(), VFS::Path::toNormalized(getPlayerPtr().getClass().getCorrectedModel(getPlayerPtr())));
|
||||
mPhysics->addActor(getPlayerPtr(), getPlayerPtr().getClass().getCorrectedModel(getPlayerPtr()));
|
||||
|
||||
applyLoopingParticles(player);
|
||||
|
||||
|
|
|
@ -297,6 +297,10 @@ namespace VFS::Path
|
|||
{
|
||||
return Normalized(std::forward<T>(value));
|
||||
}
|
||||
|
||||
Normalized toNormalized(NormalizedView value) = delete;
|
||||
|
||||
Normalized toNormalized(Normalized value) = delete;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue