浏览代码

Merge pull request #3708 from urschanselmann/master

Fix import of FBX files with last UV duplicated (caused by bug in FBX SDK 2019.0+)
Kim Kulling 4 年之前
父节点
当前提交
c9ba616eb6
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      code/AssetLib/FBX/FBXMeshGeometry.cpp

+ 6 - 0
code/AssetLib/FBX/FBXMeshGeometry.cpp

@@ -508,6 +508,12 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
         std::vector<int> uvIndices;
         std::vector<int> uvIndices;
         ParseVectorDataArray(uvIndices,GetRequiredElement(source,indexDataElementName));
         ParseVectorDataArray(uvIndices,GetRequiredElement(source,indexDataElementName));
 
 
+        if (uvIndices.size() > vertex_count) {
+            FBXImporter::LogWarn(Formatter::format("trimming length of input array for ByPolygonVertex mapping: ")
+                                          << uvIndices.size() << ", expected " << vertex_count);
+            uvIndices.resize(vertex_count);
+        }
+
         if (uvIndices.size() != vertex_count) {
         if (uvIndices.size() != vertex_count) {
             FBXImporter::LogError(Formatter::format("length of input data unexpected for ByPolygonVertex mapping: ")
             FBXImporter::LogError(Formatter::format("length of input data unexpected for ByPolygonVertex mapping: ")
                                   << uvIndices.size() << ", expected " << vertex_count);
                                   << uvIndices.size() << ", expected " << vertex_count);