From 39aef6edc97d6894365c95e9e972535affc3efbf Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Tue, 8 Sep 2015 21:42:42 -0700 Subject: [PATCH] AnimController fix for crash if underPoses vector was empty. --- libraries/animation/src/AnimController.cpp | 7 ++++++- libraries/animation/src/Rig.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libraries/animation/src/AnimController.cpp b/libraries/animation/src/AnimController.cpp index a6e1f15a14..d6edef57b5 100644 --- a/libraries/animation/src/AnimController.cpp +++ b/libraries/animation/src/AnimController.cpp @@ -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; } } diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 7e33ac51a4..2dae075454 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -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(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