diff --git a/src/Core/Resource/Animation/CSkeleton.cpp b/src/Core/Resource/Animation/CSkeleton.cpp index 933f2c47..f5c0b14d 100644 --- a/src/Core/Resource/Animation/CSkeleton.cpp +++ b/src/Core/Resource/Animation/CSkeleton.cpp @@ -131,7 +131,7 @@ void CSkeleton::Draw(FRenderOptions /*Options*/, const CBoneTransformData *pkDat } // Draw child links - for (uint32 iChild = 0; iChild < pBone->NumChildren(); iChild++) + for (size_t iChild = 0; iChild < pBone->NumChildren(); iChild++) { const CBone *pChild = pBone->ChildByIndex(iChild); const CVector3f ChildPos = pkData ? pChild->TransformedPosition(*pkData) : pChild->Position(); diff --git a/src/Core/Resource/Animation/CSkeleton.h b/src/Core/Resource/Animation/CSkeleton.h index c465658e..d828583c 100644 --- a/src/Core/Resource/Animation/CSkeleton.h +++ b/src/Core/Resource/Animation/CSkeleton.h @@ -73,8 +73,8 @@ public: // Accessors CSkeleton* Skeleton() const { return mpSkeleton; } CBone* Parent() const { return mpParent; } - uint32 NumChildren() const { return mChildren.size(); } - CBone* ChildByIndex(uint32 Index) const { return mChildren[Index]; } + size_t NumChildren() const { return mChildren.size(); } + CBone* ChildByIndex(size_t Index) const { return mChildren[Index]; } uint32 ID() const { return mID; } CVector3f Position() const { return mPosition; } CVector3f LocalPosition() const { return mLocalPosition; } diff --git a/src/Core/Resource/Factory/CSkeletonLoader.cpp b/src/Core/Resource/Factory/CSkeletonLoader.cpp index 84665c2d..da5639ea 100644 --- a/src/Core/Resource/Factory/CSkeletonLoader.cpp +++ b/src/Core/Resource/Factory/CSkeletonLoader.cpp @@ -6,7 +6,7 @@ void CSkeletonLoader::SetLocalBoneCoords(CBone *pBone) { - for (uint32 iChild = 0; iChild < pBone->NumChildren(); iChild++) + for (size_t iChild = 0; iChild < pBone->NumChildren(); iChild++) SetLocalBoneCoords(pBone->ChildByIndex(iChild)); if (pBone->mpParent) diff --git a/src/Editor/CharacterEditor/CSkeletonHierarchyModel.cpp b/src/Editor/CharacterEditor/CSkeletonHierarchyModel.cpp index 0067563e..86c2634a 100644 --- a/src/Editor/CharacterEditor/CSkeletonHierarchyModel.cpp +++ b/src/Editor/CharacterEditor/CSkeletonHierarchyModel.cpp @@ -20,8 +20,8 @@ QModelIndex CSkeletonHierarchyModel::index(int Row, int Column, const QModelInde return QModelIndex(); } - CBone *pBone = (CBone*) rkParent.internalPointer(); - if (Row < (int) pBone->NumChildren()) + auto *pBone = static_cast(rkParent.internalPointer()); + if (Row < static_cast(pBone->NumChildren())) return createIndex(Row, Column, pBone->ChildByIndex(Row)); else return QModelIndex(); @@ -29,7 +29,7 @@ QModelIndex CSkeletonHierarchyModel::index(int Row, int Column, const QModelInde QModelIndex CSkeletonHierarchyModel::parent(const QModelIndex& rkChild) const { - CBone *pBone = (CBone*) rkChild.internalPointer(); + auto *pBone = static_cast(rkChild.internalPointer()); if (pBone->Parent()) { @@ -40,10 +40,10 @@ QModelIndex CSkeletonHierarchyModel::parent(const QModelIndex& rkChild) const { CBone *pGrandparent = pParent->Parent(); - for (uint32 iChild = 0; iChild < pGrandparent->NumChildren(); iChild++) + for (size_t iChild = 0; iChild < pGrandparent->NumChildren(); iChild++) { if (pGrandparent->ChildByIndex(iChild) == pParent) - return createIndex(iChild, 0, pParent); + return createIndex(static_cast(iChild), 0, pParent); } } @@ -55,9 +55,11 @@ QModelIndex CSkeletonHierarchyModel::parent(const QModelIndex& rkChild) const int CSkeletonHierarchyModel::rowCount(const QModelIndex& rkParent) const { - if (!mpSkeleton) return 0; - CBone *pBone = (CBone*) rkParent.internalPointer(); - return (pBone ? pBone->NumChildren() : 1); + if (!mpSkeleton) + return 0; + + auto *pBone = static_cast(rkParent.internalPointer()); + return pBone ? static_cast(pBone->NumChildren()) : 1; } int CSkeletonHierarchyModel::columnCount(const QModelIndex& /*rkParent*/) const @@ -84,14 +86,15 @@ CBone* CSkeletonHierarchyModel::BoneForIndex(const QModelIndex& rkIndex) const QModelIndex CSkeletonHierarchyModel::IndexForBone(CBone *pBone) const { CBone *pParent = pBone->Parent(); - if (!pParent) return index(0, 0, QModelIndex()); + if (!pParent) + return index(0, 0, QModelIndex()); - QModelIndex ParentIndex = IndexForBone(pParent); + const QModelIndex ParentIndex = IndexForBone(pParent); - for (uint32 iChild = 0; iChild < pParent->NumChildren(); iChild++) + for (size_t iChild = 0; iChild < pParent->NumChildren(); iChild++) { if (pParent->ChildByIndex(iChild) == pBone) - return index(iChild, 0, ParentIndex); + return index(static_cast(iChild), 0, ParentIndex); } return QModelIndex();