AnimController fix for crash if underPoses vector was empty.

This commit is contained in:
Anthony J. Thibault 2015-09-08 21:42:42 -07:00
parent 75ecf0020d
commit 39aef6edc9
2 changed files with 7 additions and 2 deletions

View file

@ -56,7 +56,12 @@ const AnimPoseVec& AnimController::overlay(const AnimVariantMap& animVars, float
}
if (jointVar.jointIndex >= 0) {
AnimPose pose(animVars.lookup(jointVar.var, underPoses[jointVar.jointIndex]));
AnimPose pose;
if (jointVar.jointIndex <= (int)underPoses.size()) {
pose = AnimPose(animVars.lookup(jointVar.var, underPoses[jointVar.jointIndex]));
} else {
pose = AnimPose(animVars.lookup(jointVar.var, AnimPose::identity));
}
_poses[jointVar.jointIndex] = pose;
}
}

View file

@ -962,7 +962,7 @@ void Rig::updateLeanJoint(int index, float leanSideways, float leanForward, floa
AnimPose pose = _animSkeleton->getRelativeBindPose(index);
pose.rot = rot;
_animVars.set("lean", static_cast<glm::mat4>(pose));
} else {
} else if (!_enableAnimGraph) {
auto& parentState = _jointStates[_jointStates[index].getParentIndex()];
// get the rotation axes in joint space and use them to adjust the rotation