MCPcopy Create free account
hub / github.com/PCGEx/PCGExtendedToolkit / StartLoading

Method StartLoading

Source/PCGExtendedToolkit/Private/Data/PCGExData.cpp:293–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291 }
292
293 void FFacadePreloader::StartLoading(
294 const TSharedPtr<PCGExMT::FTaskManager>& AsyncManager,
295 const TSharedRef<FFacade>& InDataFacade,
296 const TSharedPtr<PCGExMT::FAsyncMultiHandle>& InParentHandle)
297 {
298 InternalDataFacadePtr = InDataFacade;
299
300 if (!IsEmpty())
301 {
302 if (!Validate(AsyncManager->GetContext(), InDataFacade))
303 {
304 InternalDataFacadePtr.Reset();
305 OnLoadingEnd();
306 return;
307 }
308
309 PCGEX_ASYNC_GROUP_CHKD_VOID(AsyncManager, PrefetchAttributesTask)
310 PrefetchAttributesTask->SetParent(InParentHandle);
311
312 PrefetchAttributesTask->OnCompleteCallback =
313 [PCGEX_ASYNC_THIS_CAPTURE]()
314 {
315 PCGEX_ASYNC_THIS
316 This->OnLoadingEnd();
317 };
318
319 if (InDataFacade->bSupportsScopedGet)
320 {
321 PrefetchAttributesTask->OnSubLoopStartCallback =
322 [PCGEX_ASYNC_THIS_CAPTURE](const PCGExMT::FScope& Scope)
323 {
324 PCGEX_ASYNC_THIS
325 if (const TSharedPtr<FFacade> InternalFacade = This->InternalDataFacadePtr.Pin())
326 {
327 This->Fetch(InternalFacade.ToSharedRef(), Scope);
328 }
329 };
330
331 PrefetchAttributesTask->StartSubLoops(InDataFacade->GetNum(), GetDefault<UPCGExGlobalSettings>()->GetPointsBatchChunkSize());
332 }
333 else
334 {
335 PrefetchAttributesTask->OnSubLoopStartCallback =
336 [PCGEX_ASYNC_THIS_CAPTURE](const PCGExMT::FScope& Scope)
337 {
338 PCGEX_ASYNC_THIS
339 if (const TSharedPtr<FFacade> InternalFacade = This->InternalDataFacadePtr.Pin())
340 {
341 This->Read(InternalFacade.ToSharedRef(), Scope.Start);
342 }
343 };
344
345 PrefetchAttributesTask->StartSubLoops(Num(), 1);
346 }
347 }
348 else
349 {
350 OnLoadingEnd();

Callers 5

PrefetchDataMethod · 0.80
ExecuteInternalMethod · 0.80
ExecuteInternalMethod · 0.80
ExecuteInternalMethod · 0.80

Calls 8

SetParentMethod · 0.80
StartSubLoopsMethod · 0.80
GetNumMethod · 0.80
IsEmptyFunction · 0.50
ValidateFunction · 0.50
NumFunction · 0.50
GetContextMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected