Merge pull request #8 from Azaezel/dsqFilters

dsq detection filters
This commit is contained in:
marauder2k7 2025-11-26 01:09:41 +00:00 committed by GitHub
commit e345120d81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 13 deletions

View file

@ -1359,16 +1359,19 @@ static bool enumDTSForImport(const char* shapePath, GuiTreeViewCtrl* tree)
stats.numMeshes++;
}
// Get material count
for (S32 i = 0; i < dtsShape->materialList->size(); i++)
if (dtsShape->materialList)
{
S32 matId = tree->insertItem(matsID, dtsShape->materialList->getMaterialName(i).c_str(), "", "", 0, 0);
stats.numMaterials++;
GFXTextureObject* difTex = dtsShape->materialList->getDiffuseTexture(i);
if (difTex)
// Get material count
for (S32 i = 0; i < dtsShape->materialList->size(); i++)
{
tree->insertItem(matId, difTex->getPath().c_str(), "", "", 0, 0);
S32 matId = tree->insertItem(matsID, dtsShape->materialList->getMaterialName(i).c_str(), "", "", 0, 0);
stats.numMaterials++;
GFXTextureObject* difTex = dtsShape->materialList->getDiffuseTexture(i);
if (difTex)
{
tree->insertItem(matId, difTex->getPath().c_str(), "", "", 0, 0);
}
}
}
@ -2003,7 +2006,7 @@ void AssetImporter::processShapeAsset(AssetImportObject* assetItem)
{
enumColladaForImport(filePath, shapeInfo, false);
}
else if (fileExt.compare("dts") == 0)
else if ((fileExt.compare("dts") == 0) || (fileExt.compare("dsq") == 0))
{
enumDTSForImport(filePath, shapeInfo);
}
@ -2097,7 +2100,7 @@ void AssetImporter::processShapeAnimationAsset(AssetImportObject* assetItem)
{
enumColladaForImport(filePath, shapeInfo, false);
}
else if (fileExt.compare("dts") == 0)
else if ((fileExt.compare("dts") == 0)|| (fileExt.compare("dsq") == 0))
{
enumDTSForImport(filePath, shapeInfo);
}

View file

@ -610,7 +610,8 @@ bool AssimpShapeLoader::canLoadCachedDTS(const Torque::Path& path)
{
// Generate the cached filename
Torque::Path cachedPath(path);
cachedPath.setExtension("cached.dts");
if (String::compare(path.getExtension(), "dsq") != 0)
cachedPath.setExtension("cached.dts");
// Check if a cached DTS newer than this file is available
FileTime cachedModifyTime;
@ -626,7 +627,6 @@ bool AssimpShapeLoader::canLoadCachedDTS(const Torque::Path& path)
return true;
}
}
return false;
}
@ -914,7 +914,8 @@ TSShape* assimpLoadShape(const Torque::Path &path)
// TODO: add .cached.dts generation.
// Generate the cached filename
Torque::Path cachedPath(path);
cachedPath.setExtension("cached.dts");
if ( String::compare(path.getExtension(),"dsq") != 0)
cachedPath.setExtension("cached.dts");
// Check if an up-to-date cached DTS version of this file exists, and
// if so, use that instead.
@ -925,6 +926,17 @@ TSShape* assimpLoadShape(const Torque::Path &path)
if (cachedStream.getStatus() == Stream::Ok)
{
TSShape *shape = new TSShape;
if (String::compare(path.getExtension(), "dsq") == 0)
{
if (!shape->importSequences(&cachedStream, cachedPath.getFullPath()))
{
Con::errorf("assimpLoadShape: Load sequence file '%s' failed", cachedPath.getFullPath().c_str());
delete shape;
shape = NULL;
}
cachedStream.close();
return shape;
}
bool readSuccess = shape->read(&cachedStream);
cachedStream.close();