Skip to content

Commit

Permalink
ValidateDataStructure.cpp:
Browse files Browse the repository at this point in the history
* Fixed warnings introduced by last commit (hopefully)
* Fixed case fallthrough (due to exception flow, it didn't make a practical difference, but hopefully will remove a warning)
* Minor formatting consistency improvements
  • Loading branch information
Cgettys committed Mar 10, 2019
1 parent 2e262db commit 7bb1303
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions code/ValidateDataStructure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ void ValidateDSProcess::Validate( const aiMesh* pMesh)
{
case 0:
ReportError("aiMesh::mFaces[%i].mNumIndices is 0",i);
break;
case 1:
if (0 == (pMesh->mPrimitiveTypes & aiPrimitiveType_POINT))
{
Expand Down Expand Up @@ -811,9 +812,9 @@ void ValidateDSProcess::Validate( const aiAnimation* pAnimation,
{
Validate(&pNodeAnim->mNodeName);

if (!pNodeAnim->mNumPositionKeys && !pNodeAnim->mScalingKeys && !pNodeAnim->mNumRotationKeys)
if (!pNodeAnim->mNumPositionKeys && !pNodeAnim->mScalingKeys && !pNodeAnim->mNumRotationKeys) {
ReportError("Empty node animation channel");

}
// otherwise check whether one of the keys exceeds the total duration of the animation
if (pNodeAnim->mNumPositionKeys)
{
Expand Down Expand Up @@ -916,8 +917,9 @@ void ValidateDSProcess::Validate( const aiNode* pNode)
}
// Validate node name string first so that it's safe to use in below expressions
this->Validate(&pNode->mName);
const char* nodeName = (&pNode->mName)->C_Str();
if (pNode != mScene->mRootNode && !pNode->mParent){
ReportError("Non-root node %s lacks a valid parent (aiNode::mParent is NULL) ",pNode->mName);
ReportError("Non-root node %s lacks a valid parent (aiNode::mParent is NULL) ", nodeName);
}

// validate all meshes
Expand All @@ -926,7 +928,7 @@ void ValidateDSProcess::Validate( const aiNode* pNode)
if (!pNode->mMeshes)
{
ReportError("aiNode::mMeshes is NULL for node %s (aiNode::mNumMeshes is %i)",
pNode->mNumMeshes, pNode->mName);
pNode->mNumMeshes, nodeName);
}
std::vector<bool> abHadMesh;
abHadMesh.resize(mScene->mNumMeshes,false);
Expand All @@ -935,12 +937,12 @@ void ValidateDSProcess::Validate( const aiNode* pNode)
if (pNode->mMeshes[i] >= mScene->mNumMeshes)
{
ReportError("aiNode::mMeshes[%i] is out of range for node %s (maximum is %i)",
pNode->mMeshes[i], pNode->mName, mScene->mNumMeshes-1);
pNode->mMeshes[i], nodeName, mScene->mNumMeshes-1);
}
if (abHadMesh[pNode->mMeshes[i]])
{
ReportError("aiNode::mMeshes[%i] is already referenced by this node %s (value: %i)",
i, pNode->mName, pNode->mMeshes[i]);
i, nodeName, pNode->mMeshes[i]);
}
abHadMesh[pNode->mMeshes[i]] = true;
}
Expand All @@ -949,7 +951,7 @@ void ValidateDSProcess::Validate( const aiNode* pNode)
{
if (!pNode->mChildren) {
ReportError("aiNode::mChildren is NULL for node %s (aiNode::mNumChildren is %i)",
pNode->mName, pNode->mNumChildren);
nodeName, pNode->mNumChildren);
}
for (unsigned int i = 0; i < pNode->mNumChildren;++i) {
Validate(pNode->mChildren[i]);
Expand Down

0 comments on commit 7bb1303

Please sign in to comment.