History

remove extraneous roots from Model::_jointStates

Andrew Meadows committed 12 years ago

Commit 9a552521 parent bb332662 files · +45 −19Browse files

Showing the changes to interface/src/avatar/SkeletonModel.cpp (1 of 2 files). Show all

Unified · Split

interface/src/avatar/SkeletonModel.cpp+11−13
@@ -515,9 +515,9 @@ void SkeletonModel::initRagdollPoints() { · 514 unmodified lines
515515
516516 initRagdollTransform();
517517 // 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) {
521521 const JointState& state = _jointStates.at(i);
522522 // _ragdollPoints start in model-frame
523523 _ragdollPoints[i].initPosition(state.getPosition());
@@ -719,8 +719,8 @@ void SkeletonModel::buildShapes() { · 195 unmodified lines
719719
720720 // ... then move shapes back to current joint positions
721721 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) {
724724 // ragdollPoints start in model-frame
725725 _ragdollPoints[i].initPosition(_jointStates.at(i).getPosition());
726726 }
@@ -765,17 +765,15 @@ void SkeletonModel::updateMuscles() { · 38 unmodified lines
765765
766766 void SkeletonModel::computeBoundingShape(const FBXGeometry& geometry) {
767767 // compute default joint transforms
768− int numJoints = geometry.joints.size();
769− if (numJoints != _ragdollPoints.size()) {
770− return;
771− }
768+ int numStates = _jointStates.size();
772769 QVector<glm::mat4> transforms;
773− transforms.fill(glm::mat4(), numJoints);
770+ transforms.fill(glm::mat4(), numStates);
774771
775772 // compute the default transforms and slam the ragdoll positions accordingly
776773 // (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();
779777 int parentIndex = joint.parentIndex;
780778 if (parentIndex == -1) {
781779 transforms[i] = _jointStates[i].getTransform();
@@ -847,7 +845,7 @@ void SkeletonModel::resetShapePositionsToDefaultPose() { · 65 unmodified lines
847845 }
848846
849847 const FBXGeometry& geometry = _geometry->getFBXGeometry();
850− if (geometry.joints.isEmpty() || _shapes.size() != geometry.joints.size()) {
848+ if (geometry.joints.isEmpty()) {
851849 return;
852850 }
853851

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t