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

Method Boot

Source/PCGExtendedToolkit/Private/PCGExPointsProcessor.cpp:356–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

354}
355
356bool FPCGExPointsProcessorElement::Boot(FPCGExContext* InContext) const
357{
358 FPCGExPointsProcessorContext* Context = static_cast<FPCGExPointsProcessorContext*>(InContext);
359 PCGEX_SETTINGS(PointsProcessor)
360
361 Context->bCleanupConsumableAttributes = Settings->bCleanupConsumableAttributes;
362 if (Settings->bCleanupConsumableAttributes)
363 {
364 for (const TArray<FString> Names = PCGExHelpers::GetStringArrayFromCommaSeparatedList(Settings->CommaSeparatedProtectedAttributesName);
365 const FString& Name : Names)
366 {
367 Context->AddProtectedAttributeName(FName(Name));
368 }
369
370 for (const FName& Name : Settings->ProtectedAttributes)
371 {
372 Context->AddProtectedAttributeName(FName(Name));
373 }
374 }
375
376 if (Context->InputData.GetInputs().IsEmpty() && !Settings->IsInputless()) { return false; } //Get rid of errors and warning when there is no input
377
378 Context->MainPoints = MakeShared<PCGExData::FPointIOCollection>(Context, Settings->GetIsMainTransactional());
379 Context->MainPoints->OutputPin = Settings->GetMainOutputPin();
380
381 if (Settings->GetMainAcceptMultipleData())
382 {
383 TArray<FPCGTaggedData> Sources = Context->InputData.GetInputsByPin(Settings->GetMainInputPin());
384 Context->MainPoints->Initialize(Sources, Settings->GetMainOutputInitMode());
385 }
386 else
387 {
388 const TSharedPtr<PCGExData::FPointIO> SingleInput = PCGExData::TryGetSingleInput(Context, Settings->GetMainInputPin(), false, false);
389 if (SingleInput) { Context->MainPoints->Add_Unsafe(SingleInput); }
390 }
391
392 if (Context->MainPoints->IsEmpty() && !Settings->IsInputless())
393 {
394 if (!Settings->bQuietMissingInputError)
395 {
396 PCGE_LOG(Error, GraphAndLog, FText::Format(FText::FromString(TEXT("Missing {0} inputs (either no data or no points)")), FText::FromName(Settings->GetMainInputPin())));
397 }
398 return false;
399 }
400
401 if (Settings->SupportsPointFilters())
402 {
403 GetInputFactories(Context, Settings->GetPointFilterPin(), Context->FilterFactories, Settings->GetPointFilterTypes(), false);
404 if (Settings->RequiresPointFilters() && Context->FilterFactories.IsEmpty())
405 {
406 PCGE_LOG(Error, GraphAndLog, FText::Format(FTEXT("Missing {0}."), FText::FromName(Settings->GetPointFilterPin())));
407 return false;
408 }
409 }
410
411 return true;
412}
413

Callers

nothing calls this directly

Calls 15

TryGetSingleInputFunction · 0.85
TEXTFunction · 0.85
GetInputFactoriesFunction · 0.85
IsInputlessMethod · 0.80
GetPointFilterPinMethod · 0.80
IsEmptyMethod · 0.45
GetMainOutputPinMethod · 0.45
GetMainInputPinMethod · 0.45

Tested by

no test coverage detected