3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-26 21:15:28 +02:00

Fix not calculating joint freeLineage list properly

This commit is contained in:
sabrina-shanman 2019-01-29 10:29:12 -08:00
parent 3e7a80ac4c
commit eace901278
2 changed files with 12 additions and 11 deletions
libraries
fbx/src
model-baker/src/model-baker

View file

@ -1252,18 +1252,8 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr
const FBXModel& fbxModel = fbxModels[modelID];
HFMJoint joint;
joint.parentIndex = fbxModel.parentIndex;
// get the indices of all ancestors starting with the first free one (if any)
int jointIndex = hfmModel.joints.size();
joint.freeLineage.append(jointIndex);
int lastFreeIndex = joint.isFree ? 0 : -1;
for (int index = joint.parentIndex; index != -1; index = hfmModel.joints.at(index).parentIndex) {
if (hfmModel.joints.at(index).isFree) {
lastFreeIndex = joint.freeLineage.size();
}
joint.freeLineage.append(index);
}
joint.freeLineage.remove(lastFreeIndex + 1, joint.freeLineage.size() - lastFreeIndex - 1);
joint.translation = fbxModel.translation; // these are usually in centimeters
joint.preTransform = fbxModel.preTransform;
joint.preRotation = fbxModel.preRotation;

View file

@ -67,6 +67,17 @@ void PrepareJointsTask::run(const baker::BakeContextPointer& context, const Inpu
auto& jointOut = jointsOut[jointsOut.size()-1];
jointOut.isFree = freeJoints.contains(jointIn.name);
// Get the indices of all ancestors starting with the first free one (if any)
int jointIndex = jointsOut.size() - 1;
jointOut.freeLineage.append(jointIndex);
int lastFreeIndex = jointOut.isFree ? 0 : -1;
for (int index = jointOut.parentIndex; index != -1; index = jointsOut.at(index).parentIndex) {
if (jointsOut.at(index).isFree) {
lastFreeIndex = jointOut.freeLineage.size();
}
jointOut.freeLineage.append(index);
}
jointOut.freeLineage.remove(lastFreeIndex + 1, jointOut.freeLineage.size() - lastFreeIndex - 1);
if (jointNameMapping.contains(jointNameMapping.key(jointIn.name))) {
jointOut.name = jointNameMapping.key(jointIn.name);