2
0
Эх сурвалжийг харах

trim uvIndices to fix import of Cheetah3D generated fbx files

Urs Hanselmann 4 жил өмнө
parent
commit
c0c7e6a0de

+ 11 - 5
code/AssetLib/FBX/FBXMeshGeometry.cpp

@@ -508,11 +508,17 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
         std::vector<int> uvIndices;
         ParseVectorDataArray(uvIndices,GetRequiredElement(source,indexDataElementName));
 
-        // if (uvIndices.size() != vertex_count) {
-        //     FBXImporter::LogError(Formatter::format("length of input data unexpected for ByPolygonVertex mapping: ")
-        //                           << uvIndices.size() << ", expected " << vertex_count);
-        //     return;
-        // }
+        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) {
+            FBXImporter::LogError(Formatter::format("length of input data unexpected for ByPolygonVertex mapping: ")
+                                  << uvIndices.size() << ", expected " << vertex_count);
+            return;
+        }
 
         data_out.resize(vertex_count);