Loading FBX in Qt

Lately, I’ve been mostly using Qt3D in Qt, but I wanted to try loading FBX files directly, so I set it up.

Here are the notes.

Installing FBX SDK

Download the SDK from the Autodesk download page.

FBX Software Developer Kit 2019.0 | Autodesk Developer Network

The latest SDK is for Visual Studio 2015; there isn’t one for 2017. However, since VC++ 2015 and 2017 are said to be compatible, I’ll try using the 2015 version.

Information about VC++ 2015 and 2017 compatibility can be found here:

C++ Binary Compatibility between Visual Studio 2015 and Visual Studio 2017 | Microsoft Docs

First, Try Using it in Visual Studio

Referring to this site, I tried using it in a Visual Studio 2017 C++ project.

FBX SDK Preparation – Get Data from File – Code Labo

However, building resulted in an error!!

This article described the exact issue:

Story about FbxSdk failing to build in VisualStudio2017 - Qiita

Apparently, it’s because FBX SDK uses non-standard C++ syntax from Visual Studio. Hmm.

Setting up in Qt Creator

Looking at the directory where FBX SDK was installed, it seems there are dynamically linked versions (libfbxsdk.lib) and statically linked versions (libfbxsdk-md.lib, libfbxsdk-mt.lib) based on size.

This time, I’ll try static linking (libfbxsdk-md.lib).

The environment is Windows 10, and the compiler specified is Visual Studio 2017 64-bit.

  • In the Qt Creator project, select "Add Library" and choose "External Library".
  • Enter the path to libfbxsdk-md.lib in "Library file".
  • Enter the path to the fbxsdk "include" folder in "Include path".
  • For platform, select Windows Only for now.
  • Select "Static" for the linking method.

Pressing “Next” and proceeding writes the link information for FBX SDK into the ~.pro file.

Then, write the following code in main.cpp, build, and run. If no errors occur, it’s OK.

#include <fbxsdk.h>

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    FbxManager* manager = FbxManager::Create();
    if (manager)
    {
        qDebug() << "FBX Manager created successfully.";
        manager->Destroy();
        qDebug() << "FBX Manager destroyed.";
    }
    else
    {
        qDebug() << "Failed to create FBX Manager.";
    }

    // ... rest of your Qt application setup ...

    return app.exec();
}

Running it worked normally. The errors seen in Visual Studio 2017 did not occur in Qt Creator.

Summary

I was able to set up the FBX SDK in Qt Creator. I’ll use this to play around with FBX files.

Bonus

It seems that FBX SDK is used internally within Qt3D in Qt Creator. (Source code confirmed)

So, even without performing the steps in this article, FBX loading is possible with the default functionality.

This time, I specifically wanted to try using the FBX SDK directly myself, which is why I tried the steps in this article.