AzaezelX 1 месяц назад
Родитель
Сommit
9bcf8a90b2

+ 13 - 10
Engine/source/T3D/assets/assetImporter.cpp

@@ -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);
       }

+ 15 - 3
Engine/source/ts/assimp/assimpShapeLoader.cpp

@@ -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();