forked from teamnwah/openmw-tes3coop
Cache the mesh names from the mesh/skeleton pairs
This commit is contained in:
parent
3131e8dae6
commit
8a086e3afb
1 changed files with 9 additions and 3 deletions
|
@ -1040,13 +1040,19 @@ public:
|
||||||
NIFMeshLoader::LoaderMap NIFMeshLoader::sLoaders;
|
NIFMeshLoader::LoaderMap NIFMeshLoader::sLoaders;
|
||||||
|
|
||||||
|
|
||||||
|
typedef std::map<std::string,MeshPairList> MeshPairMap;
|
||||||
|
static MeshPairMap sMeshPairMap;
|
||||||
|
|
||||||
MeshPairList NIFLoader::load(std::string name, std::string skelName, const std::string &group)
|
MeshPairList NIFLoader::load(std::string name, std::string skelName, const std::string &group)
|
||||||
{
|
{
|
||||||
MeshPairList meshes;
|
|
||||||
|
|
||||||
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
|
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
|
||||||
std::transform(skelName.begin(), skelName.end(), skelName.begin(), ::tolower);
|
std::transform(skelName.begin(), skelName.end(), skelName.begin(), ::tolower);
|
||||||
|
|
||||||
|
MeshPairMap::const_iterator meshiter = sMeshPairMap.find(name+"@skel="+skelName);
|
||||||
|
if(meshiter != sMeshPairMap.end())
|
||||||
|
return meshiter->second;
|
||||||
|
|
||||||
|
MeshPairList &meshes = sMeshPairMap[name+"@skel="+skelName];
|
||||||
Nif::NIFFile nif(name);
|
Nif::NIFFile nif(name);
|
||||||
if (nif.numRecords() < 1)
|
if (nif.numRecords() < 1)
|
||||||
{
|
{
|
||||||
|
@ -1067,7 +1073,7 @@ MeshPairList NIFLoader::load(std::string name, std::string skelName, const std::
|
||||||
}
|
}
|
||||||
|
|
||||||
NIFSkeletonLoader skelldr;
|
NIFSkeletonLoader skelldr;
|
||||||
bool hasSkel = skelldr.createSkeleton(skelName, group, node);
|
bool hasSkel = skelldr.createSkeleton(name, group, node);
|
||||||
|
|
||||||
NIFMeshLoader meshldr(name, group, (hasSkel ? skelName : std::string()));
|
NIFMeshLoader meshldr(name, group, (hasSkel ? skelName : std::string()));
|
||||||
meshldr.createMeshes(node, meshes);
|
meshldr.createMeshes(node, meshes);
|
||||||
|
|
Loading…
Reference in a new issue