From a550a8af368aeaecbb6e0afa23f34e761b616361 Mon Sep 17 00:00:00 2001 From: elsid Date: Fri, 15 Nov 2024 13:41:32 +0100 Subject: [PATCH] Use normalized path for KeyframeManager::get --- .../nifloader/testbulletnifloader.cpp | 87 ++++++++++--------- .../components_tests/nifosg/testnifloader.cpp | 8 +- apps/niftest/niftest.cpp | 2 +- apps/openmw/mwrender/animation.cpp | 2 +- components/nif/niffile.hpp | 5 +- components/resource/keyframemanager.cpp | 43 +++++---- components/resource/keyframemanager.hpp | 2 +- components/resource/niffilemanager.cpp | 18 ++-- 8 files changed, 84 insertions(+), 83 deletions(-) diff --git a/apps/components_tests/nifloader/testbulletnifloader.cpp b/apps/components_tests/nifloader/testbulletnifloader.cpp index f7ee559578..c6df103858 100644 --- a/apps/components_tests/nifloader/testbulletnifloader.cpp +++ b/apps/components_tests/nifloader/testbulletnifloader.cpp @@ -295,6 +295,9 @@ namespace using namespace Nif::Testing; using NifBullet::BulletNifLoader; + constexpr VFS::Path::NormalizedView testNif("test.nif"); + constexpr VFS::Path::NormalizedView xtestNif("xtest.nif"); + void copy(const btTransform& src, Nif::NiTransform& dst) { dst.mTranslation = osg::Vec3f(src.getOrigin().x(), src.getOrigin().y(), src.getOrigin().z()); @@ -366,7 +369,7 @@ namespace TEST_F(TestBulletNifLoader, for_zero_num_roots_should_return_default) { - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mHash = mHash; const auto result = mLoader.load(file); @@ -380,7 +383,7 @@ namespace TEST_F(TestBulletNifLoader, should_ignore_nullptr_root) { - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(nullptr); file.mHash = mHash; @@ -393,7 +396,7 @@ namespace TEST_F(TestBulletNifLoader, for_default_root_nif_node_should_return_default) { - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNode); file.mHash = mHash; @@ -408,7 +411,7 @@ namespace { mNode.recType = Nif::RC_RootCollisionNode; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNode); file.mHash = mHash; @@ -421,7 +424,7 @@ namespace TEST_F(TestBulletNifLoader, for_default_root_nif_node_and_filename_starting_with_x_should_return_default) { - Nif::NIFFile file("xtest.nif"); + Nif::NIFFile file(xtestNif); file.mRoots.push_back(&mNode); file.mHash = mHash; @@ -439,7 +442,7 @@ namespace mNode.mBounds.mBox.mExtents = osg::Vec3f(1, 2, 3); mNode.mBounds.mBox.mCenter = osg::Vec3f(-1, -2, -3); - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNode); file.mHash = mHash; @@ -461,7 +464,7 @@ namespace mNode.mParents.push_back(&mNiNode); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNode) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -487,7 +490,7 @@ namespace mNiNode.mBounds.mBox.mCenter = osg::Vec3f(-4, -5, -6); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNode) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -519,7 +522,7 @@ namespace mNiNode.mBounds.mBox.mCenter = osg::Vec3f(-7, -8, -9); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNode), Nif::NiAVObjectPtr(&mNode2) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -551,7 +554,7 @@ namespace mNiNode.mBounds.mBox.mCenter = osg::Vec3f(-7, -8, -9); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNode), Nif::NiAVObjectPtr(&mNode2) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -570,7 +573,7 @@ namespace mNode.mBounds.mBox.mExtents = osg::Vec3f(1, 2, 3); mNode.mBounds.mBox.mCenter = osg::Vec3f(-1, -2, -3); - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNode); file.mHash = mHash; @@ -583,7 +586,7 @@ namespace TEST_F(TestBulletNifLoader, for_tri_shape_root_node_should_return_static_shape) { - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiTriShape); file.mHash = mHash; @@ -609,7 +612,7 @@ namespace mNiTriShape.mBounds.mBox.mExtents = osg::Vec3f(1, 2, 3); mNiTriShape.mBounds.mBox.mCenter = osg::Vec3f(-1, -2, -3); - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiTriShape); file.mHash = mHash; @@ -634,7 +637,7 @@ namespace mNiTriShape.mParents.push_back(&mNiNode); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -661,7 +664,7 @@ namespace mNiNode2.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; mNiTriShape.mParents.push_back(&mNiNode2); - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -687,7 +690,7 @@ namespace mNiTriShape2.mParents.push_back(&mNiNode); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape), Nif::NiAVObjectPtr(&mNiTriShape2) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -719,7 +722,7 @@ namespace mNiTriShape.mParents.push_back(&mNiNode); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; - Nif::NIFFile file("xtest.nif"); + Nif::NIFFile file(xtestNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -743,7 +746,7 @@ namespace copy(mTransform, mNiTriShape.mTransform); mNiTriShape.mTransform.mScale = 3; - Nif::NIFFile file("xtest.nif"); + Nif::NIFFile file(xtestNif); file.mRoots.push_back(&mNiTriShape); file.mHash = mHash; @@ -769,7 +772,7 @@ namespace mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; mNiNode.mTransform.mScale = 4; - Nif::NIFFile file("xtest.nif"); + Nif::NIFFile file(xtestNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -801,7 +804,7 @@ namespace mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape), Nif::NiAVObjectPtr(&mNiTriShape2) }; - Nif::NIFFile file("xtest.nif"); + Nif::NIFFile file(xtestNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -836,7 +839,7 @@ namespace mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; mNiNode.mTransform.mScale = 4; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -872,7 +875,7 @@ namespace }; mNiNode.mTransform.mScale = 4; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -903,7 +906,7 @@ namespace mNiTriShape.mParents.push_back(&mNiNode); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; - Nif::NIFFile file("xtest.nif"); + Nif::NIFFile file(xtestNif); file.mRoots.push_back(&mNiNode); file.mRoots.push_back(&mNiTriShape2); file.mHash = mHash; @@ -938,7 +941,7 @@ namespace mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; mNiNode.recType = Nif::RC_AvoidNode; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -963,7 +966,7 @@ namespace mNiTriShape.mParents.push_back(&mNiNode); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -982,7 +985,7 @@ namespace mNiTriShape.mParents.push_back(&mNiNode); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -1002,7 +1005,7 @@ namespace mNiNode.mExtra = Nif::ExtraPtr(&mNiStringExtraData); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -1033,7 +1036,7 @@ namespace mNiNode.mExtra = Nif::ExtraPtr(&mNiStringExtraData); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -1062,7 +1065,7 @@ namespace mNiNode.mExtra = Nif::ExtraPtr(&mNiStringExtraData); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -1092,7 +1095,7 @@ namespace mNiNode.mExtra = Nif::ExtraPtr(&mNiStringExtraData); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -1120,7 +1123,7 @@ namespace mNiTriShape.mParents.push_back(&mNiNode); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -1155,7 +1158,7 @@ namespace mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&niTriShape), Nif::NiAVObjectPtr(&emptyCollisionNode) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -1184,7 +1187,7 @@ namespace mNiNode.mExtraList.push_back(Nif::ExtraPtr(&mNiIntegerExtraData)); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; file.mVersion = Nif::NIFStream::generateVersion(10, 0, 1, 0); @@ -1205,7 +1208,7 @@ namespace mNiNode.mExtra = Nif::ExtraPtr(&mNiStringExtraData); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -1218,7 +1221,7 @@ namespace TEST_F(TestBulletNifLoader, for_tri_strips_root_node_should_return_static_shape) { - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiTriStrips); file.mHash = mHash; @@ -1242,7 +1245,7 @@ namespace { mNiTriStripsData.mStrips.clear(); - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiTriStrips); file.mHash = mHash; @@ -1257,7 +1260,7 @@ namespace { mNiTriStripsData.mStrips.front() = { 0, 1 }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiTriStrips); file.mHash = mHash; @@ -1275,7 +1278,7 @@ namespace mNiNode.recType = Nif::RC_AvoidNode; mNiTriStripsData.mStrips.front() = { 0, 1 }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiTriStrips); file.mHash = mHash; @@ -1292,7 +1295,7 @@ namespace mNiTriStrips.mParents.push_back(&mNiNode); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriStrips) }; - Nif::NIFFile file("xtest.nif"); + Nif::NIFFile file(xtestNif); file.mRoots.push_back(&mNiNode); file.mHash = mHash; @@ -1309,7 +1312,7 @@ namespace mNiTriShape.mParents.push_back(&mNiNode); mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; - Nif::NIFFile file("xtest.nif"); + Nif::NIFFile file(xtestNif); file.mRoots.push_back(&mNiNode); file.mRoots.push_back(&mNiTriStrips); file.mHash = mHash; @@ -1340,7 +1343,7 @@ namespace mNiNode2.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape) }; mNiNode2.mTransform.mScale = 3; - Nif::NIFFile file("xtest.nif"); + Nif::NIFFile file(xtestNif); file.mRoots.push_back(&mNiNode); file.mRoots.push_back(&mNiNode2); file.mHash = mHash; @@ -1378,7 +1381,7 @@ namespace mNiNode.mChildren = Nif::NiAVObjectList{ Nif::NiAVObjectPtr(&mNiTriShape), Nif::NiAVObjectPtr(&mNiTriShape2) }; - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&mNiNode); const auto result = mLoader.load(file); diff --git a/apps/components_tests/nifosg/testnifloader.cpp b/apps/components_tests/nifosg/testnifloader.cpp index fa023fff0d..37b52af9ac 100644 --- a/apps/components_tests/nifosg/testnifloader.cpp +++ b/apps/components_tests/nifosg/testnifloader.cpp @@ -26,6 +26,8 @@ namespace using namespace NifOsg; using namespace Nif::Testing; + constexpr VFS::Path::NormalizedView testNif("test.nif"); + struct BaseNifOsgLoaderTest { VFS::Manager mVfs; @@ -70,7 +72,7 @@ namespace { Nif::NiAVObject node; init(node); - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&node); auto result = Loader::load(file, &mImageManager, &mMaterialManager); EXPECT_EQ(serialize(*result), R"( @@ -259,7 +261,7 @@ osg::Group { property.mController = nullptr; property.mType = GetParam().mShaderType; node.mProperties.push_back(Nif::RecordPtrT(&property)); - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&node); auto result = Loader::load(file, &mImageManager, &mMaterialManager); EXPECT_EQ(serialize(*result), formatOsgNodeForBSShaderProperty(GetParam().mExpectedShaderPrefix)); @@ -289,7 +291,7 @@ osg::Group { property.mShaderFlags1 |= Nif::BSShaderFlags1::BSSFlag1_DepthTest; property.mShaderFlags2 |= Nif::BSShaderFlags2::BSSFlag2_DepthWrite; node.mProperties.push_back(Nif::RecordPtrT(&property)); - Nif::NIFFile file("test.nif"); + Nif::NIFFile file(testNif); file.mRoots.push_back(&node); auto result = Loader::load(file, &mImageManager, &mMaterialManager); EXPECT_EQ(serialize(*result), formatOsgNodeForBSLightingShaderProperty(GetParam().mExpectedShaderPrefix)); diff --git a/apps/niftest/niftest.cpp b/apps/niftest/niftest.cpp index 012245937f..8634134665 100644 --- a/apps/niftest/niftest.cpp +++ b/apps/niftest/niftest.cpp @@ -141,7 +141,7 @@ bool readFile( { case FileClass::NIF: { - Nif::NIFFile file(Files::pathToUnicodeString(fullPath)); + Nif::NIFFile file(VFS::Path::Normalized(Files::pathToUnicodeString(fullPath))); Nif::Reader reader(file, nullptr); if (vfs != nullptr) reader.parse(vfs->get(pathStr)); diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 5779a4f709..2b5092087a 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -704,7 +704,7 @@ namespace MWRender return nullptr; auto animsrc = std::make_shared(); - animsrc->mKeyframes = mResourceSystem->getKeyframeManager()->get(kfname); + animsrc->mKeyframes = mResourceSystem->getKeyframeManager()->get(VFS::Path::toNormalized(kfname)); if (!animsrc->mKeyframes || animsrc->mKeyframes->mTextKeys.empty() || animsrc->mKeyframes->mKeyframeControllers.empty()) diff --git a/components/nif/niffile.hpp b/components/nif/niffile.hpp index 6bff30a225..106a896c30 100644 --- a/components/nif/niffile.hpp +++ b/components/nif/niffile.hpp @@ -8,6 +8,7 @@ #include #include +#include #include "record.hpp" @@ -45,7 +46,7 @@ namespace Nif std::uint32_t mBethVersion = 0; /// File name, used for error messages and opening the file - std::string mPath; + VFS::Path::Normalized mPath; std::string mHash; /// Record list @@ -56,7 +57,7 @@ namespace Nif bool mUseSkinning = false; - explicit NIFFile(std::string_view path) + explicit NIFFile(VFS::Path::NormalizedView path) : mPath(path) { } diff --git a/components/resource/keyframemanager.cpp b/components/resource/keyframemanager.cpp index a272d89dd1..f962ba03fb 100644 --- a/components/resource/keyframemanager.cpp +++ b/components/resource/keyframemanager.cpp @@ -206,37 +206,34 @@ namespace Resource { } - osg::ref_ptr KeyframeManager::get(const std::string& name) + osg::ref_ptr KeyframeManager::get(VFS::Path::NormalizedView name) { - const VFS::Path::Normalized normalized(name); + osg::ref_ptr obj = mCache->getRefFromObjectCache(name); - osg::ref_ptr obj = mCache->getRefFromObjectCache(normalized); - if (obj) + if (obj != nullptr) return osg::ref_ptr(static_cast(obj.get())); + + osg::ref_ptr loaded(new SceneUtil::KeyframeHolder); + if (Misc::getFileExtension(name.value()) == "kf") + { + auto file = std::make_shared(name); + Nif::Reader reader(*file, mEncoder); + reader.parse(mVFS->get(name)); + NifOsg::Loader::loadKf(*file, *loaded.get()); + } else { - osg::ref_ptr loaded(new SceneUtil::KeyframeHolder); - if (Misc::getFileExtension(normalized) == "kf") + osg::ref_ptr scene = const_cast(mSceneManager->getTemplate(name).get()); + osg::ref_ptr bam + = dynamic_cast(scene->getUpdateCallback()); + if (bam) { - auto file = std::make_shared(normalized); - Nif::Reader reader(*file, mEncoder); - reader.parse(mVFS->get(normalized)); - NifOsg::Loader::loadKf(*file, *loaded.get()); - } - else - { - osg::ref_ptr scene = const_cast(mSceneManager->getTemplate(normalized).get()); - osg::ref_ptr bam - = dynamic_cast(scene->getUpdateCallback()); - if (bam) - { - Resource::RetrieveAnimationsVisitor rav(*loaded.get(), std::move(bam), normalized, *mVFS); - scene->accept(rav); - } + Resource::RetrieveAnimationsVisitor rav(*loaded.get(), std::move(bam), name, *mVFS); + scene->accept(rav); } - mCache->addEntryToObjectCache(normalized, loaded); - return loaded; } + mCache->addEntryToObjectCache(name.value(), loaded); + return loaded; } void KeyframeManager::reportStats(unsigned int frameNumber, osg::Stats* stats) const diff --git a/components/resource/keyframemanager.hpp b/components/resource/keyframemanager.hpp index 2f5aa875d0..ef7e7e4e4a 100644 --- a/components/resource/keyframemanager.hpp +++ b/components/resource/keyframemanager.hpp @@ -56,7 +56,7 @@ namespace Resource /// Retrieve a read-only keyframe resource by name (case-insensitive). /// @note Throws an exception if the resource is not found. - osg::ref_ptr get(const std::string& name); + osg::ref_ptr get(VFS::Path::NormalizedView name); void reportStats(unsigned int frameNumber, osg::Stats* stats) const override; diff --git a/components/resource/niffilemanager.cpp b/components/resource/niffilemanager.cpp index 481126f304..d670f41ee9 100644 --- a/components/resource/niffilemanager.cpp +++ b/components/resource/niffilemanager.cpp @@ -43,17 +43,15 @@ namespace Resource Nif::NIFFilePtr NifFileManager::get(VFS::Path::NormalizedView name) { osg::ref_ptr obj = mCache->getRefFromObjectCache(name); - if (obj) + if (obj != nullptr) return static_cast(obj.get())->mNifFile; - else - { - auto file = std::make_shared(name.value()); - Nif::Reader reader(*file, mEncoder); - reader.parse(mVFS->get(name)); - obj = new NifFileHolder(file); - mCache->addEntryToObjectCache(name.value(), obj); - return file; - } + + auto file = std::make_shared(name); + Nif::Reader reader(*file, mEncoder); + reader.parse(mVFS->get(name)); + obj = new NifFileHolder(file); + mCache->addEntryToObjectCache(name.value(), obj); + return file; } void NifFileManager::reportStats(unsigned int frameNumber, osg::Stats* stats) const