Hello, I'm having trouble handling FBX files using FBX SDK 2020.2.
I've created a C++ program that utilizes the libraries of FBX SDK 2020.2. This program imports an FBX file, removes some unwanted objects and parameters, and finally exports the file in FBX format. This program works well for small FBX files; however, for larger FBX files, like 1.5 GB, for instance, the process that used to take seconds now takes an hour and a half. I've also noticed a high consumption of RAM during program execution. Some of the tests I've conducted lead me to believe that the factors increasing the time cost are the import and export processes of the FBX file.
Does anyone know if this is standard for FBX files? Is there a way to optimize this process? Does any other version of the SDK offer better performance?
Solved! Go to Solution.
Solved by regalir. Go to Solution.
One well known cause of the long processing time is happening when destroying the whole scene after you have finished working with it. This is due to the fact that we have to go through every connection to "cleanly" detach everything before deleting. Therefore, if your scene have a lot of objects you can quickly end up with a lot of connections and long times to delete everything.
If you know for a fact, after you have processed a file, that you do not need the FBX SDK anymore, you can use the following undocumented function in the FbxScene object to delete it:
// This function will destroy the scene (and all the objects directly connected to it) without sending
// the Connect notifications nor trying to disconnect the objects first. This is a bypass of the intended
// workflow and should be used with care.
void ForceKill();
as mentioned in the comment, this function can leave internal data in an undefined state therefore, if you decide to use it, you have to completely kill the process that ran the Import (or Export) and start a brand new one for the next conversion. In the context of you C++ program, this means that you probably have to create a subprocess for reading/processing/saving one FBX file to avoid quitting the main program every single time.
Hope this helped!
Cheers
Can't find what you're looking for? Ask the community or share your knowledge.