Showing the changes to interface/src/avatar/SkeletonModel.cpp (1 of 2 files). Show all
Unified · Split
| @@ -515,9 +515,9 @@ void SkeletonModel::initRagdollPoints() { · 514 unmodified lines | |||
| 515 | 515 | ||
| 516 | initRagdollTransform(); | 516 | initRagdollTransform(); |
| 517 | // one point for each joint | 517 | // one point for each joint |
| 518 | int numJoints = _jointStates.size(); | 518 | int numStates = _jointStates.size(); |
| 519 | _ragdollPoints.fill(VerletPoint(), numJoints); | 519 | _ragdollPoints.fill(VerletPoint(), numStates); |
| 520 | for (int i = 0; i < numJoints; ++i) { | 520 | for (int i = 0; i < numStates; ++i) { |
| 521 | const JointState& state = _jointStates.at(i); | 521 | const JointState& state = _jointStates.at(i); |
| 522 | // _ragdollPoints start in model-frame | 522 | // _ragdollPoints start in model-frame |
| 523 | _ragdollPoints[i].initPosition(state.getPosition()); | 523 | _ragdollPoints[i].initPosition(state.getPosition()); |
| @@ -719,8 +719,8 @@ void SkeletonModel::buildShapes() { · 195 unmodified lines | |||
| 719 | 719 | ||
| 720 | // ... then move shapes back to current joint positions | 720 | // ... then move shapes back to current joint positions |
| 721 | if (_ragdollPoints.size() == numStates) { | 721 | if (_ragdollPoints.size() == numStates) { |
| 722 | int numJoints = _jointStates.size(); | 722 | int numStates = _jointStates.size(); |
| 723 | for (int i = 0; i < numJoints; ++i) { | 723 | for (int i = 0; i < numStates; ++i) { |
| 724 | // ragdollPoints start in model-frame | 724 | // ragdollPoints start in model-frame |
| 725 | _ragdollPoints[i].initPosition(_jointStates.at(i).getPosition()); | 725 | _ragdollPoints[i].initPosition(_jointStates.at(i).getPosition()); |
| 726 | } | 726 | } |
| @@ -765,17 +765,15 @@ void SkeletonModel::updateMuscles() { · 38 unmodified lines | |||
| 765 | 765 | ||
| 766 | void SkeletonModel::computeBoundingShape(const FBXGeometry& geometry) { | 766 | void SkeletonModel::computeBoundingShape(const FBXGeometry& geometry) { |
| 767 | // compute default joint transforms | 767 | // compute default joint transforms |
| 768 | int numJoints = geometry.joints.size(); | 768 | int numStates = _jointStates.size(); |
| 769 | if (numJoints != _ragdollPoints.size()) { | ||
| 770 | return; | ||
| 771 | } | ||
| 772 | QVector<glm::mat4> transforms; | 769 | QVector<glm::mat4> transforms; |
| 773 | transforms.fill(glm::mat4(), numJoints); | 770 | transforms.fill(glm::mat4(), numStates); |
| 774 | 771 | ||
| 775 | // compute the default transforms and slam the ragdoll positions accordingly | 772 | // compute the default transforms and slam the ragdoll positions accordingly |
| 776 | // (which puts the shapes where we want them) | 773 | // (which puts the shapes where we want them) |
| 777 | for (int i = 0; i < numJoints; i++) { | 774 | for (int i = 0; i < numStates; i++) { |
| 778 | const FBXJoint& joint = geometry.joints.at(i); | 775 | JointState& state = _jointStates[i]; |
| 776 | const FBXJoint& joint = state.getFBXJoint(); | ||
| 779 | int parentIndex = joint.parentIndex; | 777 | int parentIndex = joint.parentIndex; |
| 780 | if (parentIndex == -1) { | 778 | if (parentIndex == -1) { |
| 781 | transforms[i] = _jointStates[i].getTransform(); | 779 | transforms[i] = _jointStates[i].getTransform(); |
| @@ -847,7 +845,7 @@ void SkeletonModel::resetShapePositionsToDefaultPose() { · 65 unmodified lines | |||
| 847 | } | 845 | } |
| 848 | 846 | ||
| 849 | const FBXGeometry& geometry = _geometry->getFBXGeometry(); | 847 | const FBXGeometry& geometry = _geometry->getFBXGeometry(); |
| 850 | if (geometry.joints.isEmpty() || _shapes.size() != geometry.joints.size()) { | 848 | if (geometry.joints.isEmpty()) { |
| 851 | return; | 849 | return; |
| 852 | } | 850 | } |
| 853 | 851 | ||