Fbx Plugin: added plugin option to set the target axis system. Default left to OpenGL.

This commit is contained in:
Riccardo Corsi 2019-09-13 12:50:29 +02:00
parent bd50af117b
commit 35ed188b02

View File

@ -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)) {