Upgrading to UE4.17: Possible change needed in camera recording code
Looks like starting in 4.17, FImageUtils::CompressImageArray needs to be called from the game thread: I couldn't find a reference to this in the changelog, so it's probably something underlying that's changed. In 4.17, RenderRequest.cpp throws a IsInGameThread()=false exception when compressing the image. I guess this part needs to be wrapped inside a CreateandDispatchWhenReady lambda so that it will be queued up to the game thread.
FGraphEventRef Task = FFunctionGraphTask::CreateAndDispatchWhenReady([this, &image_data]() {
FImageUtils::CompressImageArray(data->width, data->height, data->bmp, image_data);
}, TStatId(), NULL, ENamedThreads::GameThread);
// Wait for the code above to complete:
FTaskGraphInterface::Get().WaitUntilTaskCompletes(Task);
If the plan is to make 4.17 the official version, perhaps this addition will be needed..
Thanks for pointing this out. I noticed that 4.16 is showing warning instead (on Windows):
[2017.08.23-11.12.44:597][822]LogModuleManager:Warning: ModuleManager: Attempting to load 'ImageWrapper' outside the main thread. This module was already loaded - so we didn't crash but this isn't safe. Please call LoadModule on the main/game thread only. You can use GetModule or GetModuleChecked instead, those are safe to call outside the game thread.
So made this one line change. This still doesn't get rid of above warning. I'll test out above code soon.
I cannot get 4.16 now. can u tell me how could I get the 4.16 version from Epic?
Closing this issue, as we are now supporting builds 4.18-4.22