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