Merge pull request #3992 from AdrianAtGoogle/gltf_fixes

Fix issues encountered during integration attempt
pull/3997/head
Kim Kulling 2021-07-23 21:59:26 +02:00 committed by GitHub
commit a96e7e6e2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -195,11 +195,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('\\'))); int pos = std::max(int(pFile.rfind('/')), int(pFile.rfind('\\')));
if (pos != int(std::string::npos)) { if (pos == int(std::string::npos)) {
path = pFile.substr(0, pos + 1); return "";
} }
return path; return pFile.substr(0, pos + 1);
} }
#if _MSC_VER #if _MSC_VER
# pragma warning(pop) # pragma warning(pop)

View File

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