Merge branch 'master' into clang-fix

pull/4744/head
slinky55 2022-09-30 21:57:32 -04:00 committed by GitHub
commit 5f28370f7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 4 deletions

View File

@ -415,9 +415,11 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
{ {
bool isDirect = ReferenceInformationType == "Direct"; bool isDirect = ReferenceInformationType == "Direct";
bool isIndexToDirect = ReferenceInformationType == "IndexToDirect"; bool isIndexToDirect = ReferenceInformationType == "IndexToDirect";
const bool hasDataElement = HasElement(source, dataElementName);
const bool hasIndexDataElement = HasElement(source, indexDataElementName);
// fall-back to direct data if there is no index data element // fall-back to direct data if there is no index data element
if ( isIndexToDirect && !HasElement( source, indexDataElementName ) ) { if (isIndexToDirect && !hasIndexDataElement) {
isDirect = true; isDirect = true;
isIndexToDirect = false; isIndexToDirect = false;
} }
@ -426,7 +428,8 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
// deal with this more elegantly and with less redundancy, but right // deal with this more elegantly and with less redundancy, but right
// now it seems unavoidable. // now it seems unavoidable.
if (MappingInformationType == "ByVertice" && isDirect) { if (MappingInformationType == "ByVertice" && isDirect) {
if (!HasElement(source, dataElementName)) { if (!hasDataElement) {
FBXImporter::LogWarn("missing data element: ", dataElementName);
return; return;
} }
std::vector<T> tempData; std::vector<T> tempData;
@ -448,6 +451,14 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
} }
else if (MappingInformationType == "ByVertice" && isIndexToDirect) { else if (MappingInformationType == "ByVertice" && isIndexToDirect) {
std::vector<T> tempData; std::vector<T> tempData;
if (!hasDataElement || !hasIndexDataElement) {
if (!hasDataElement)
FBXImporter::LogWarn("missing data element: ", dataElementName);
if (!hasIndexDataElement)
FBXImporter::LogWarn("missing index data element: ", indexDataElementName);
return;
}
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName)); ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
std::vector<int> uvIndices; std::vector<int> uvIndices;
@ -473,6 +484,11 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
} }
} }
else if (MappingInformationType == "ByPolygonVertex" && isDirect) { else if (MappingInformationType == "ByPolygonVertex" && isDirect) {
if (!hasDataElement) {
FBXImporter::LogWarn("missing data element: ", dataElementName);
return;
}
std::vector<T> tempData; std::vector<T> tempData;
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName)); ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
@ -487,6 +503,13 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
} }
else if (MappingInformationType == "ByPolygonVertex" && isIndexToDirect) { else if (MappingInformationType == "ByPolygonVertex" && isIndexToDirect) {
std::vector<T> tempData; std::vector<T> tempData;
if (!hasDataElement || !hasIndexDataElement) {
if (!hasDataElement)
FBXImporter::LogWarn("missing data element: ", dataElementName);
if (!hasIndexDataElement)
FBXImporter::LogWarn("missing index data element: ", indexDataElementName);
return;
}
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName)); ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
std::vector<int> uvIndices; std::vector<int> uvIndices;