From 3d1edf4d9eda443e49e6f1046df3dddb70c419af Mon Sep 17 00:00:00 2001 From: sabrina-shanman Date: Thu, 31 Jan 2019 15:00:50 -0800 Subject: [PATCH] Make small code improvements to PrepareJointsTask --- .../model-baker/src/model-baker/PrepareJointsTask.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libraries/model-baker/src/model-baker/PrepareJointsTask.cpp b/libraries/model-baker/src/model-baker/PrepareJointsTask.cpp index 20715cfed7..3b1a57cb43 100644 --- a/libraries/model-baker/src/model-baker/PrepareJointsTask.cpp +++ b/libraries/model-baker/src/model-baker/PrepareJointsTask.cpp @@ -62,10 +62,11 @@ void PrepareJointsTask::run(const baker::BakeContextPointer& context, const Inpu // Apply joint metadata from FST file mappings for (const auto& jointIn : jointsIn) { jointsOut.push_back(jointIn); - auto& jointOut = jointsOut[jointsOut.size()-1]; + auto& jointOut = jointsOut.back(); - if (jointNameMapping.contains(jointNameMapping.key(jointIn.name))) { - jointOut.name = jointNameMapping.key(jointIn.name); + auto jointNameMapKey = jointNameMapping.key(jointIn.name); + if (jointNameMapping.contains(jointNameMapKey)) { + jointOut.name = jointNameMapKey; } jointIndices.insert(jointOut.name, (int)jointsOut.size()); @@ -75,11 +76,11 @@ void PrepareJointsTask::run(const baker::BakeContextPointer& context, const Inpu auto offsets = getJointRotationOffsets(mapping); for (auto itr = offsets.begin(); itr != offsets.end(); itr++) { QString jointName = itr.key(); - glm::quat rotationOffset = itr.value(); int jointIndex = jointIndices.value(jointName) - 1; if (jointIndex != -1) { + glm::quat rotationOffset = itr.value(); jointRotationOffsets.insert(jointIndex, rotationOffset); + qCDebug(model_baker) << "Joint Rotation Offset added to Rig._jointRotationOffsets : " << " jointName: " << jointName << " jointIndex: " << jointIndex << " rotation offset: " << rotationOffset; } - qCDebug(model_baker) << "Joint Rotation Offset added to Rig._jointRotationOffsets : " << " jointName: " << jointName << " jointIndex: " << jointIndex << " rotation offset: " << rotationOffset; } }