Explorar el Código

Fix issues encountered during integration atempt

Adrian Perez hace 4 años
padre
commit
5285736ba0
Se han modificado 2 ficheros con 5 adiciones y 6 borrados
  1. 3 4
      code/AssetLib/glTF/glTFCommon.h
  2. 2 2
      code/AssetLib/glTF2/glTF2Asset.inl

+ 3 - 4
code/AssetLib/glTF/glTFCommon.h

@@ -194,12 +194,11 @@ inline void CopyValue(const glTFCommon::mat4 &v, aiMatrix4x4 &o) {
 
 
 inline std::string getCurrentAssetDir(const std::string &pFile) {
 inline std::string getCurrentAssetDir(const std::string &pFile) {
     std::string path = pFile;
     std::string path = pFile;
-    int pos = std::max(int(pFile.rfind('/')), int(pFile.rfind('\\')));
-    if (pos != int(std::string::npos)) {
-        path = pFile.substr(0, pos + 1);
+    if (pos == int(std::string::npos)) {
+        return "";
     }
     }
 
 
-    return path;
+    return pFile.substr(0, pos + 1);
 }
 }
 #if _MSC_VER
 #if _MSC_VER
 #    pragma warning(pop)
 #    pragma warning(pop)

+ 2 - 2
code/AssetLib/glTF2/glTF2Asset.inl

@@ -965,9 +965,9 @@ inline void Accessor::Read(Value &obj, Asset &r) {
     componentType = MemberOrDefault(obj, "componentType", ComponentType_BYTE);
     componentType = MemberOrDefault(obj, "componentType", ComponentType_BYTE);
     {
     {
         const Value* countValue = FindUInt(obj, "count");
         const Value* countValue = FindUInt(obj, "count");
-        if (!countValue || countValue->GetUint() < 1)
+        if (!countValue)
         {
         {
-            throw DeadlyImportError("A strictly positive count value is required, when reading ", id.c_str(), name.empty() ? "" : " (" + name + ")");
+            throw DeadlyImportError("A count value is required, when reading ", id.c_str(), name.empty() ? "" : " (" + name + ")");
         }
         }
         count = countValue->GetUint();
         count = countValue->GetUint();
     }
     }