Merge pull request #15159 from dback2/jointOffset2RenamingFix

Case 21669: Fix joint renaming with jointRotationOffset2
This commit is contained in:
John Conklin II 2019-03-12 10:32:02 -07:00 committed by GitHub
commit 2cf7462fbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -101,23 +101,24 @@ void PrepareJointsTask::run(const baker::BakeContextPointer& context, const Inpu
}
if (newJointRot) {
for (const auto& jointIn : jointsIn) {
for (auto& jointOut : jointsOut) {
auto jointNameMapKey = jointNameMapping.key(jointIn.name);
int mappedIndex = jointIndices.value(jointIn.name);
auto jointNameMapKey = jointNameMapping.key(jointOut.name);
int mappedIndex = jointIndices.value(jointOut.name);
if (jointNameMapping.contains(jointNameMapKey)) {
// delete and replace with hifi name
jointIndices.remove(jointIn.name);
jointIndices.insert(jointNameMapKey, mappedIndex);
jointIndices.remove(jointOut.name);
jointOut.name = jointNameMapKey;
jointIndices.insert(jointOut.name, mappedIndex);
} else {
// nothing mapped to this fbx joint name
if (jointNameMapping.contains(jointIn.name)) {
if (jointNameMapping.contains(jointOut.name)) {
// but the name is in the list of hifi names is mapped to a different joint
int extraIndex = jointIndices.value(jointIn.name);
jointIndices.remove(jointIn.name);
jointIndices.insert("", extraIndex);
int extraIndex = jointIndices.value(jointOut.name);
jointIndices.remove(jointOut.name);
jointOut.name = "";
jointIndices.insert(jointOut.name, extraIndex);
}
}
}