Merge pull request #839 from rickyviking/fbxAxisSystem

Fbx Plugin: added plugin option to set the target axis system.
This commit is contained in:
OpenSceneGraph git repository 2019-12-12 09:18:40 +00:00 committed by GitHub
commit dfc092c894
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -572,7 +572,34 @@ osgDB::ReaderWriter::WriteResult ReaderWriterFBX::writeNode(
} }
FbxExporter* lExporter = FbxExporter::Create(pSdkManager, ""); 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 // Ensure the directory exists or else the FBX SDK will fail
if (!osgDB::makeDirectoryForFile(filename)) { if (!osgDB::makeDirectoryForFile(filename)) {