From 35ed188b0268d8ab38532f5aaaf278513bc44427 Mon Sep 17 00:00:00 2001 From: Riccardo Corsi Date: Fri, 13 Sep 2019 12:50:29 +0200 Subject: [PATCH] Fbx Plugin: added plugin option to set the target axis system. Default left to OpenGL. --- src/osgPlugins/fbx/ReaderWriterFBX.cpp | 29 +++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/osgPlugins/fbx/ReaderWriterFBX.cpp b/src/osgPlugins/fbx/ReaderWriterFBX.cpp index f5cd257ea..db385c410 100644 --- a/src/osgPlugins/fbx/ReaderWriterFBX.cpp +++ b/src/osgPlugins/fbx/ReaderWriterFBX.cpp @@ -572,7 +572,34 @@ osgDB::ReaderWriter::WriteResult ReaderWriterFBX::writeNode( } FbxExporter* lExporter = FbxExporter::Create(pSdkManager, ""); - pScene->GetGlobalSettings().SetAxisSystem(FbxAxisSystem::eOpenGL); + + // default axis system is openGL + FbxAxisSystem::EPreDefinedAxisSystem axisSystem = FbxAxisSystem::eOpenGL; + + // check options + if (options) + { + std::string axisOption = options->getPluginStringData("FBX-AxisSystem"); + if (!axisOption.empty()) + { + if (axisOption == "MayaZUp") + axisSystem = FbxAxisSystem::eMayaZUp; + else if (axisOption == "MayaYUp") + axisSystem = FbxAxisSystem::eMayaYUp; + else if (axisOption == "Max") + axisSystem = FbxAxisSystem::eMax; + else if (axisOption == "MotionBuilder") + axisSystem = FbxAxisSystem::eMotionBuilder; + else if (axisOption == "OpenGL") + axisSystem = FbxAxisSystem::eOpenGL; + else if (axisOption == "DirectX") + axisSystem = FbxAxisSystem::eDirectX; + else if (axisOption == "Lightwave") + axisSystem = FbxAxisSystem::eLightwave; + } + } + + pScene->GetGlobalSettings().SetAxisSystem(axisSystem); // Ensure the directory exists or else the FBX SDK will fail if (!osgDB::makeDirectoryForFile(filename)) {