summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Korpipaa <tomi.korpipaa@qt.io>2019-09-02 11:14:53 +0300
committerTomi Korpipaa <tomi.korpipaa@qt.io>2019-09-02 11:59:09 +0300
commit5b1373a189bbdc17fdb7fd51b051bc9e7dc791f2 (patch)
tree32726f7ef53729e42bcbeceef113ceddd8d9dc78
parent5449c65bd84b3bd9d1bd9905c4aad8287eb4a572 (diff)
Fix camera clip plane import from Blender FBX
Task-number: QT3DS-3361 Change-Id: Ieee2386972e4036a6f2bcb49882ff8b33bfbd08a Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
-rw-r--r--src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportFbxSGTranslation.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportFbxSGTranslation.cpp b/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportFbxSGTranslation.cpp
index 200584d2..56bd7407 100644
--- a/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportFbxSGTranslation.cpp
+++ b/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportFbxSGTranslation.cpp
@@ -513,7 +513,14 @@ void FbxDomWalker::ProcessCamera(FbxNode *inFbxNode)
// Maya does not export FOV, but focal length. We need to convert it to FOV.
FbxDouble fov = (m_AuthoringToolType == EAuthoringToolType_FBX_Maya)
? camera->ComputeFieldOfView(camera->FocalLength.Get()) : camera->FieldOfView.Get();
- m_Translator->SetCameraProperties(camera->GetNearPlane(), camera->GetFarPlane(),
+ FbxDouble nearPlane = camera->GetNearPlane();
+ FbxDouble farPlane = camera->GetFarPlane();
+ // Near and far planes are exported at 100-fold values from Blender.
+ nearPlane = (m_AuthoringToolType == EAuthoringToolType_FBX_Blender)
+ ? nearPlane / 100. : nearPlane;
+ farPlane = (m_AuthoringToolType == EAuthoringToolType_FBX_Blender)
+ ? farPlane / 100. : farPlane;
+ m_Translator->SetCameraProperties(nearPlane, farPlane,
camera->ProjectionType.Get() == FbxCamera::eOrthogonal,
fov);
ProcessNodeChildren(inFbxNode);