Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
VTui22 committed Apr 25, 2024
1 parent cb17bf7 commit 0dd74ad
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions private/Producers/FbxProducer/FbxProducerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ cd::Vec3f ConvertFbxScale(const fbxsdk::FbxVector4& scale)
return cd::Vec3f(static_cast<float>(scale[0]), static_cast<float>(scale[1]), static_cast<float>(scale[2]));
}

cd::Transform ConvertFbxTransform(const fbxsdk::FbxVector4& position, const fbxsdk::FbxQuaternion& rotation, const fbxsdk::FbxVector4& scale)
cd::Transform ConvertFbxTransform(fbxsdk::FbxAMatrix Matrix)
{
return cd::Transform(ConvertFbxPosition(position), ConvertFbxRotation(rotation), ConvertFbxScale(scale));
cd::Matrix4x4 transformMatrix = ConvertFbxMatrixToCDMatrix(Matrix);

return cd::Transform(
cd::Vec3f(transformMatrix.GetTranslation()),
cd::Quaternion(cd::Quaternion::FromMatrix(transformMatrix.GetRotation())),
cd::Vec3f(transformMatrix.GetScale()));
}

fbxsdk::FbxAMatrix GetGeometryTransformation(fbxsdk::FbxNode* pNode)
Expand Down Expand Up @@ -1392,26 +1397,20 @@ void FbxProducerImpl::ImportSkeletonBones(fbxsdk::FbxScene* pScene, const std::v
}

// Get local transform materix for link bone.
fbxsdk::FbxVector4 localLinkT;
fbxsdk::FbxQuaternion localLinkQ;
fbxsdk::FbxVector4 localLinkS;
fbxsdk::FbxAMatrix transform;
if (boneIndex != rootBoneIndex)
{
fbxsdk::FbxAMatrix transform = globalTransformPerLinkBone[cdBoneParentID].Inverse() * globalTransformPerLinkBone[cdBoneID];
localLinkT = transform.GetT();
localLinkQ = transform.GetQ();
localLinkS = transform.GetS();

}
else
{
// RootBone is already in global coordinate system.
const auto& rootTransform = globalTransformPerLinkBone[cdBoneID];
localLinkT = rootTransform.GetT();
localLinkQ = rootTransform.GetQ();
localLinkS = rootTransform.GetS();
const auto& transform = globalTransformPerLinkBone[cdBoneID];

}

cdBone.SetTransform(details::ConvertFbxTransform(localLinkT, localLinkQ, localLinkS));
cdBone.SetTransform(details::ConvertFbxTransform(transform));
cdBone.SetOffset(details::ConvertFbxMatrixToCDMatrix(globalTransformPerLinkBone[cdBoneID].Inverse()));
}

Expand Down

0 comments on commit 0dd74ad

Please sign in to comment.