Non-blocking Callback
I haven't figured out how to make this work. The callback is set to a user-defined function:
importerContext.itsFbxImporter->SetProgressCallback(pFbxCallback, this);
The import is started in non-blocking mode:
importerContext.itsFbxImporter->Import(pFbxScene, bNonBlocking)
My callback is called repeatedly and reaches 100%:
bool ImportCallback(void* pArgs, float percentage, const char* pStatus)
{
FbxSceneImporter* pThis = reinterpret_cast<FbxSceneImporter*>(pArgs);
if (pThis == nullptr) return false;
if (!pThis->GetIsNonBlocking())
return true;
FbxImporter* pImporter = pThis->GetImporterContext().itsFbxImporter;
if (pImporter == nullptr)
{
pThis->SetThreadState(FileIOCommon::ThreadState::ImportFailed);
return false;
}
bool bImportStatus = false;
bool bImporting = pImporter->IsImporting(bImportStatus);
//if (!bImporting || percentage >= 100.0)
if (bImportStatus)
{
fbxsdk::FbxStatus fbxStatus = pImporter->GetStatus();
string errorString = fbxStatus.GetErrorString();
pThis->GetErrorList().push_back(errorString);
if (fbxStatus != FbxStatus::eSuccess)
{
pThis->SetThreadState(FileIOCommon::ThreadState::ImportFailed);
return false;
}
pThis->SetThreadState(FileIOCommon::ThreadState::ImportComplete);
}
return true;
}
bImportStatus is never true. Percentage does reach 100% and I can check the status thereafter. But when I return from my function an exception is thrown.
Access violation (0c00..5) in FbxGlobalLightSettings::RestoreDefaultSettings()
Apparently code is accessing a nullptr
I can import without any problems using blocking. Non-blocking is causing me a problem.
Btw, do you have an example that shows how to use FbxProgress? I really didn't find much information on it.
Thank you in advance for your help.
Link copied