Check node parents in ValidateDataStructure

pull/5023/head
Turo Lamminen 2023-03-09 14:31:29 +02:00 committed by Turo Lamminen
parent 48d89622ee
commit ea3cc37890
1 changed files with 6 additions and 1 deletions

View File

@ -911,7 +911,12 @@ void ValidateDSProcess::Validate(const aiNode *pNode) {
nodeName, pNode->mNumChildren); nodeName, pNode->mNumChildren);
} }
for (unsigned int i = 0; i < pNode->mNumChildren; ++i) { for (unsigned int i = 0; i < pNode->mNumChildren; ++i) {
Validate(pNode->mChildren[i]); const aiNode *pChild = pNode->mChildren[i];
Validate(pChild);
if (pChild->mParent != pNode) {
const char *parentName = (pChild->mParent != nullptr) ? pChild->mParent->mName.C_Str() : "null";
ReportError("aiNode \"%s\" child %i \"%s\" parent is someone else: \"%s\"", pNode->mName.C_Str(), i, pChild->mName.C_Str(), parentName);
}
} }
} }
} }