From 62c89eaf7d60df820bc1e799150366ed21dbd17c Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Mon, 19 Oct 2015 10:53:00 -0700 Subject: [PATCH] Joint rotation fix for FBX files exported from Blender. This isn't a great fix. But it will at least allow people to export avatars from Blender. --- libraries/fbx/src/FBXReader.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libraries/fbx/src/FBXReader.cpp b/libraries/fbx/src/FBXReader.cpp index ca9f126cba..1eda5304e4 100644 --- a/libraries/fbx/src/FBXReader.cpp +++ b/libraries/fbx/src/FBXReader.cpp @@ -745,10 +745,18 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS // see FBX documentation, http://download.autodesk.com/us/fbx/20112/FBX_SDK_HELP/index.html model.translation = translation; + model.preTransform = glm::translate(rotationOffset) * glm::translate(rotationPivot); model.preRotation = glm::quat(glm::radians(preRotation)); model.rotation = glm::quat(glm::radians(rotation)); model.postRotation = glm::quat(glm::radians(postRotation)); + + if (geometry.applicationName.startsWith("Blender")) { + // blender puts the jointOffset in the wrong place. + model.preRotation = model.rotation; + model.rotation = glm::quat(); + } + model.postTransform = glm::translate(-rotationPivot) * glm::translate(scaleOffset) * glm::translate(scalePivot) * glm::scale(scale) * glm::translate(-scalePivot); // NOTE: angles from the FBX file are in degrees