Community
FBX Forum
Welcome to Autodesk’s FBX Forums. Share your knowledge, ask questions, and explore popular FBX topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FBX SDK import fails with "Uninitialized filename" (in Release config)

1 REPLY 1
Reply
Message 1 of 2
xdevapps0
286 Views, 1 Reply

FBX SDK import fails with "Uninitialized filename" (in Release config)

I am using the FBX SDK (2020.2, vs2019) for loading models in my game engine. In Debug config, everything works as expected. When building in Release config, the FbxImporter::Import(FbxScene*) function returns false with the status code: eFailure and error string: "Uninitialized filename"
My code for loading a scene:

FbxScene* fbx::ParseScene(const std::filesystem::path& filepath)
{
    auto filenameStr = filepath.filename().string();
    auto filepathStr = filepath.string();
    ::FbxImporter* fbxImporter = ::FbxImporter::Create(s_Data.fbxManager, filenameStr.c_str());
    APEX_CORE_ASSERT(fbxImporter->Initialize(filepathStr.c_str(), -1, s_Data.fbxManager->GetIOSettings()),
        fmt::format("FbxImporter Initialize failed for '{0}'! Error: {1}", filepath, fbxImporter->GetStatus().GetErrorString()));

    FbxScene* fbxScene = FbxScene::Create(s_Data.fbxManager, filenameStr.c_str());
    if (!fbxImporter->Import(fbxScene)) { // <-- fails to import
        FbxStatus importStatus = fbxImporter->GetStatus();
        APEX_CORE_ERROR("Could not load FBX scene! Error: {}", importStatus.GetErrorString());
        // Could not load FBX scene! Error: Uninitialized filename
    }
    fbxImporter->Destroy();

    if(fbxScene->GetGlobalSettings().GetSystemUnit() != FbxSystemUnit::m)
    {
        // Convert the scene to meters using the defined options.
        FbxSystemUnit::m.ConvertScene(fbxScene);
    }

    return fbxScene;
}

The FbxManager was initialized as follows:

s_Data.fbxManager = FbxManager::Create();
APEX_CORE_ASSERT(s_Data.fbxManager, "FBX Manager could not be initialized!");
s_Data.fbxManager->SetIOSettings(FbxIOSettings::Create(s_Data.fbxManager, IOSROOT));

I'm using static linking with the following settings in Visual Studio:
Debug config:

  • Additional Library Directories: %FBX_SDK_PATH%\2020.2\lib\vs2019\x64\debug\
  • Additional Dependencies: libfbxsdk-md.lib;libxml2-md.lib;zlib-md.lib

Release config:

  • Additional Library Directories: %FBX_SDK_PATH%\2020.2\lib\vs2019\x64\release\
  • Additional Dependencies: libfbxsdk-md.lib;libxml2-md.lib;zlib-md.lib

P.S. I tried the test with multiple different fbx models and got the same output.

Am I missing something?

Tags (3)
Labels (4)
1 REPLY 1
Message 2 of 2
regalir
in reply to: xdevapps0

Hi,

 

I find it very strange that your code would work with a debug build and fail with a release one. The only thing I can think of is that the string used for the 'filenameStr' is not a properly terminated UTF8 string and, in a debug build, some padding is added making it "work" while, in a release build, the memory is not padded and the string simply does not terminate properly.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report