UPBGE: Allow asynchronous mesh libload. #897
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously only scene supported asynchronous libloading.
But the loading of meshes and scenes are similar in the point
that they both use a scene converter but with a different
procedure on the data to convert and register to this scene
converter.
This commit introduce a more flexible KX_LibLoadStatus
with the usage of a lambda function which receive as argument
one of the scene converted listed in KX_LibLoadStatus and
process the conversion.
This lambda is created in BL_Converter::LinkBlendFile
in the same time than a list of scenes used to create the
scene converters is built. KX_LibLoadStatus is constructed
passing the function and the scene list.
BL_Converter also replaced the usage of blender task scheduler
by TBB. A tbb::task_group and a std::mutex is now hold.
The function BL_Converter::ConvertLibraryTask is in charge to
call the conversion function and this function can be called
by a task group or manually which help to reuse code.
As before BL_Converter::LinkBlendFile, is reponsible to
do a direct conversion or launch a conversion asynchronous task.
Fix issue: #533.