diff --git a/code/AssetLib/USD/USDLoaderUtil.cpp b/code/AssetLib/USD/USDLoaderUtil.cpp index 6f07d4312..16f0ba8ae 100644 --- a/code/AssetLib/USD/USDLoaderUtil.cpp +++ b/code/AssetLib/USD/USDLoaderUtil.cpp @@ -87,6 +87,30 @@ bool isUsdc(const std::string &pFile) { } return (ext[0] == 'u' || ext[0] == 'U') && (ext[1] == 's' || ext[1] == 'S') && (ext[2] == 'd' || ext[2] == 'D') && (ext[3] == 'c' || ext[3] == 'C'); } + +bool isUsdz(const std::string &pFile) { + size_t pos = pFile.find_last_of('.'); + if (pos == string::npos) { + return false; + } + string ext = pFile.substr(pos + 1); + if (ext.size() != 4) { + return false; + } + return (ext[0] == 'u' || ext[0] == 'U') && (ext[1] == 's' || ext[1] == 'S') && (ext[2] == 'd' || ext[2] == 'D') && (ext[3] == 'z' || ext[3] == 'Z'); +} + +bool isUsd(const std::string &pFile) { + size_t pos = pFile.find_last_of('.'); + if (pos == string::npos) { + return false; + } + string ext = pFile.substr(pos + 1); + if (ext.size() != 3) { + return false; + } + return (ext[0] == 'u' || ext[0] == 'U') && (ext[1] == 's' || ext[1] == 'S') && (ext[2] == 'd' || ext[2] == 'D'); +} } // namespace Assimp #endif // !! ASSIMP_BUILD_NO_USD_IMPORTER diff --git a/code/AssetLib/USD/USDLoaderUtil.h b/code/AssetLib/USD/USDLoaderUtil.h index 858f3a900..b39cd254e 100644 --- a/code/AssetLib/USD/USDLoaderUtil.h +++ b/code/AssetLib/USD/USDLoaderUtil.h @@ -53,5 +53,7 @@ Copyright (c) 2006-2024, assimp team namespace Assimp { bool isUsda(const std::string &pFile); bool isUsdc(const std::string &pFile); +bool isUsdz(const std::string &pFile); +bool isUsd(const std::string &pFile); } // namespace Assimp #endif // AI_USDLOADER_UTIL_H_INCLUDED