From 945858876ebab1979da7f929d9780409fe333c37 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 13 Mar 2018 09:53:25 +1300 Subject: [PATCH] Use std::vector<> instead of QVector --- libraries/animation/src/AnimSkeleton.cpp | 13 ++++++++----- libraries/animation/src/AnimSkeleton.h | 2 +- libraries/animation/src/Rig.h | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/libraries/animation/src/AnimSkeleton.cpp b/libraries/animation/src/AnimSkeleton.cpp index 5976231d83..e00cad9bc7 100644 --- a/libraries/animation/src/AnimSkeleton.cpp +++ b/libraries/animation/src/AnimSkeleton.cpp @@ -78,12 +78,15 @@ int AnimSkeleton::getParentIndex(int jointIndex) const { return _joints[jointIndex].parentIndex; } -QVector AnimSkeleton::getChildrenOfJoint(int jointIndex) const { +std::vector AnimSkeleton::getChildrenOfJoint(int jointIndex) const { // Children and grandchildren, etc. - QVector result; - for (int i = jointIndex + 1; i < (int)_joints.size(); i++) { - if (_joints[i].parentIndex == jointIndex || result.contains(_joints[i].parentIndex)) { - result.push_back(i); + std::vector result; + if (jointIndex != -1) { + for (int i = jointIndex + 1; i < (int)_joints.size(); i++) { + if (_joints[i].parentIndex == jointIndex + || (std::find(result.begin(), result.end(), _joints[i].parentIndex) != result.end())) { + result.push_back(i); + } } } return result; diff --git a/libraries/animation/src/AnimSkeleton.h b/libraries/animation/src/AnimSkeleton.h index 52f3ac7182..27dbf5ea92 100644 --- a/libraries/animation/src/AnimSkeleton.h +++ b/libraries/animation/src/AnimSkeleton.h @@ -43,7 +43,7 @@ public: const AnimPose& getPostRotationPose(int jointIndex) const; int getParentIndex(int jointIndex) const; - QVector getChildrenOfJoint(int jointIndex) const; + std::vector getChildrenOfJoint(int jointIndex) const; AnimPose getAbsolutePose(int jointIndex, const AnimPoseVec& relativePoses) const; diff --git a/libraries/animation/src/Rig.h b/libraries/animation/src/Rig.h index 72f9f64482..e30b5d655c 100644 --- a/libraries/animation/src/Rig.h +++ b/libraries/animation/src/Rig.h @@ -269,8 +269,8 @@ protected: int _leftEyeJointIndex { -1 }; int _rightEyeJointIndex { -1 }; - QVector _leftEyeJointChildren; - QVector _rightEyeJointChildren; + std::vector _leftEyeJointChildren; + std::vector _rightEyeJointChildren; int _leftHandJointIndex { -1 }; int _leftElbowJointIndex { -1 };