Hi!
I´m using in my Custom Camera actor in every tick a call to a Slate function called
OnBackBufferReadyToPresent = FSlateApplication::Get().GetRenderer()->OnBackBufferReadyToPresent().AddUObject(this, &UIVR_CameraComponent::OnBackBufferReady);
The function works really nice where i have it:
void UIVR_CameraComponent::OnBackBufferReady(SWindow& SlateWindow, const FTexture2DRHIRef& BackBuffer)
{
if (IsInRenderingThread())
{
//We want just one Image since many of them are redundant
if (IVR_LockedRendering == false)return;
if (!IVR_RenderTarget)return;
if (!IVR_RenderTarget->GetResource())return;
TArray< TSharedRef< SWidget >> slateScreens;
auto allChilds = SlateWindow.GetAllChildren();
for (int i = 0; i < allChilds->Num(); i++)
{
auto child = allChilds->GetChildAt(i);
if (child.Get().IsEnabled() &&
child.Get().IsVolatile())
{
slateScreens.Add(child);
}
}
for (auto screen : slateScreens)
{
TArray<FColor> IVR_WidgetBuffer;
FIntVector IVR_WidgetBufferSizes;
const bool result = FSlateApplication::Get().TakeScreenshot(screen, IVR_WidgetBuffer, IVR_WidgetBufferSizes);
}
//Lock the next rendering
IVR_LockedRendering = false;
}
}
Everything is working and i get many images with all the Slate screens.
My doubt is:
How can i select only the Slate Screens that are active in the render screen? when i run this i receive the Editor screens too…
Kind Regards.