Skip to content

Commit a8aa562

Browse files
committed
Added quiet option on broadcaster to respect filter initialization policy
1 parent 2cb8dcd commit a8aa562

File tree

5 files changed

+33
-26
lines changed

5 files changed

+33
-26
lines changed
10.5 KB
Binary file not shown.
1.96 KB
Binary file not shown.

Source/PCGExtendedToolkit/Private/Data/PCGExData.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ template PCGEXTENDEDTOOLKIT_API bool IBuffer::IsA<_TYPE>() const;
238238
}
239239

240240
template <typename T>
241-
bool TArrayBuffer<T>::InitForBroadcast(const FPCGAttributePropertyInputSelector& InSelector, const bool bCaptureMinMax, const bool bScoped)
241+
bool TArrayBuffer<T>::InitForBroadcast(const FPCGAttributePropertyInputSelector& InSelector, const bool bCaptureMinMax, const bool bScoped, const bool bQuiet)
242242
{
243243
FWriteScopeLock WriteScopeLock(BufferLock);
244244

@@ -509,7 +509,7 @@ template PCGEXTENDEDTOOLKIT_API bool IBuffer::IsA<_TYPE>() const;
509509
}
510510

511511
template <typename T>
512-
bool TSingleValueBuffer<T>::InitForBroadcast(const FPCGAttributePropertyInputSelector& InSelector, const bool bCaptureMinMax, const bool bScoped)
512+
bool TSingleValueBuffer<T>::InitForBroadcast(const FPCGAttributePropertyInputSelector& InSelector, const bool bCaptureMinMax, const bool bScoped, const bool bQuiet)
513513
{
514514
FWriteScopeLock WriteScopeLock(BufferLock);
515515

@@ -527,7 +527,7 @@ template PCGEXTENDEDTOOLKIT_API bool IBuffer::IsA<_TYPE>() const;
527527
}
528528

529529
PCGEX_SHARED_CONTEXT(Source->GetContextHandle())
530-
bReadInitialized = PCGExDataHelpers::TryReadDataValue(SharedContext.Get(), Source->GetIn(), InSelector, InValue);
530+
bReadInitialized = PCGExDataHelpers::TryReadDataValue(SharedContext.Get(), Source->GetIn(), InSelector, InValue, bQuiet);
531531

532532
return bReadInitialized;
533533
}
@@ -789,7 +789,7 @@ template PCGEXTENDEDTOOLKIT_API bool IBuffer::IsA<_TYPE>() const;
789789
}
790790

791791
template <typename T>
792-
TSharedPtr<TBuffer<T>> FFacade::GetBroadcaster(const FPCGAttributePropertyInputSelector& InSelector, const bool bSupportScoped, const bool bCaptureMinMax)
792+
TSharedPtr<TBuffer<T>> FFacade::GetBroadcaster(const FPCGAttributePropertyInputSelector& InSelector, const bool bSupportScoped, const bool bCaptureMinMax, const bool bQuiet)
793793
{
794794
// Build a proper identifier from the selector
795795
// We'll use it to get a unique buffer ID as well as domain, which is conditional to finding the right buffer class to use
@@ -802,7 +802,7 @@ template PCGEXTENDEDTOOLKIT_API bool IBuffer::IsA<_TYPE>() const;
802802
}
803803

804804
TSharedPtr<TBuffer<T>> Buffer = GetBuffer<T>(Identifier);
805-
if (!Buffer || !Buffer->InitForBroadcast(InSelector, bCaptureMinMax, bCaptureMinMax || !bSupportsScopedGet ? false : bSupportScoped))
805+
if (!Buffer || !Buffer->InitForBroadcast(InSelector, bCaptureMinMax, bCaptureMinMax || !bSupportsScopedGet ? false : bSupportScoped, bQuiet))
806806
{
807807
Flush(Buffer);
808808
return nullptr;
@@ -812,14 +812,14 @@ template PCGEXTENDEDTOOLKIT_API bool IBuffer::IsA<_TYPE>() const;
812812
}
813813

814814
template <typename T>
815-
TSharedPtr<TBuffer<T>> FFacade::GetBroadcaster(const FName InName, const bool bSupportScoped, const bool bCaptureMinMax)
815+
TSharedPtr<TBuffer<T>> FFacade::GetBroadcaster(const FName InName, const bool bSupportScoped, const bool bCaptureMinMax, const bool bQuiet)
816816
{
817817
// Create a selector from the identifier.
818818
// This is a bit backward but the user may have added domain prefixes to the name such as @Data.
819819
FPCGAttributePropertyInputSelector Selector = FPCGAttributePropertyInputSelector();
820820
Selector.Update(InName.ToString());
821821

822-
return GetBroadcaster<T>(Selector, bSupportScoped, bCaptureMinMax);
822+
return GetBroadcaster<T>(Selector, bSupportScoped, bCaptureMinMax, bQuiet);
823823
}
824824

825825
template <typename T>
@@ -842,8 +842,8 @@ template PCGEXTENDEDTOOLKIT_API TSharedPtr<TBuffer<_TYPE>> FFacade::GetWritable<
842842
template PCGEXTENDEDTOOLKIT_API TSharedPtr<TBuffer<_TYPE>> FFacade::GetWritable<_TYPE>(const FPCGMetadataAttribute<_TYPE>* InAttribute, EBufferInit Init); \
843843
template PCGEXTENDEDTOOLKIT_API TSharedPtr<TBuffer<_TYPE>> FFacade::GetWritable<_TYPE>(const FPCGAttributeIdentifier& InIdentifier, EBufferInit Init); \
844844
template PCGEXTENDEDTOOLKIT_API TSharedPtr<TBuffer<_TYPE>> FFacade::GetReadable<_TYPE>(const FPCGAttributeIdentifier& InIdentifier, const EIOSide InSide, const bool bSupportScoped); \
845-
template PCGEXTENDEDTOOLKIT_API TSharedPtr<TBuffer<_TYPE>> FFacade::GetBroadcaster<_TYPE>(const FPCGAttributePropertyInputSelector& InSelector, const bool bSupportScoped, const bool bCaptureMinMax); \
846-
template PCGEXTENDEDTOOLKIT_API TSharedPtr<TBuffer<_TYPE>> FFacade::GetBroadcaster<_TYPE>(const FName InName, const bool bSupportScoped, const bool bCaptureMinMax); \
845+
template PCGEXTENDEDTOOLKIT_API TSharedPtr<TBuffer<_TYPE>> FFacade::GetBroadcaster<_TYPE>(const FPCGAttributePropertyInputSelector& InSelector, const bool bSupportScoped, const bool bCaptureMinMax, const bool bQuiet); \
846+
template PCGEXTENDEDTOOLKIT_API TSharedPtr<TBuffer<_TYPE>> FFacade::GetBroadcaster<_TYPE>(const FName InName, const bool bSupportScoped, const bool bCaptureMinMax, const bool bQuiet); \
847847
template PCGEXTENDEDTOOLKIT_API FPCGMetadataAttribute<_TYPE>* FFacade::FindMutableAttribute<_TYPE>(const FPCGAttributeIdentifier& InIdentifier, const EIOSide InSide) const; \
848848
template PCGEXTENDEDTOOLKIT_API const FPCGMetadataAttribute<_TYPE>* FFacade::FindConstAttribute<_TYPE>(const FPCGAttributeIdentifier& InIdentifier, const EIOSide InSide) const;
849849
PCGEX_FOREACH_SUPPORTEDTYPES(PCGEX_TPL)

Source/PCGExtendedToolkit/Private/Misc/PCGExRecursionTracker.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,14 @@ bool FPCGExRecursionTrackerElement::ExecuteInternal(FPCGContext* InContext) cons
225225
Context->StageOutput(NewParamData, PCGExRecursionTracker::OutputTrackerLabel, Tags->Flatten(), false, true, false);
226226
};
227227

228+
#define PCGEX_OUTPUT_EXTRA(_NAME, _TYPE, _VALUE)\
229+
if (Settings->bOutput##_NAME){\
230+
UPCGParamData* Extra = FPCGContext::NewObject_AnyThread<UPCGParamData>(Context);\
231+
UPCGMetadata* Metadata = Extra->MutableMetadata();\
232+
Metadata->CreateAttribute<_TYPE>(FPCGAttributeIdentifier(PCGExRecursionTracker::Output##_NAME##Label, PCGMetadataDomainID::Default), _VALUE, true, true);\
233+
Metadata->AddEntry();\
234+
Context->StageOutput(Extra, PCGExRecursionTracker::Output##_NAME##Label, FlattenedTags, false, true, false);}
235+
228236
if (SafeMode == EPCGExRecursionTrackerMode::Create)
229237
{
230238
if (ValidInputs.IsEmpty())
@@ -245,14 +253,21 @@ bool FPCGExRecursionTrackerElement::ExecuteInternal(FPCGContext* InContext) cons
245253
IO->Tags->Remove(RemoveTags);
246254
IO->Tags->Set<int32>(TAG_MAX_COUNT_STR, SafeMax);
247255
IO->Tags->Set<int32>(TAG_REMAINDER_STR, SafeMax);
256+
257+
const TSet<FString> FlattenedTags = IO->Tags->Flatten();
248258

249259
UPCGMetadata* Metadata = NewParamData->MutableMetadata();
250260
Metadata->DeleteAttribute(ContinueAttribute);
251261
Metadata->CreateAttribute<bool>(ContinueAttribute, true, true, true);
252262

253263
if (Settings->bAddEntryWhenCreatingFromExistingData) { Metadata->AddEntry(); }
254264

255-
Context->StageOutput(NewParamData, PCGExRecursionTracker::OutputTrackerLabel, IO->Tags->Flatten(), false, true, false);
265+
Context->StageOutput(NewParamData, PCGExRecursionTracker::OutputTrackerLabel, FlattenedTags, false, true, false);
266+
267+
PCGEX_OUTPUT_EXTRA(Progress, float, Settings->bOneMinus ? 1 : 0)
268+
PCGEX_OUTPUT_EXTRA(Index, int32, 0)
269+
PCGEX_OUTPUT_EXTRA(Remainder, int32, SafeMax)
270+
256271
}
257272
}
258273
}
@@ -347,19 +362,10 @@ bool FPCGExRecursionTrackerElement::ExecuteInternal(FPCGContext* InContext) cons
347362

348363
Context->StageOutput(OutputParamData, PCGExRecursionTracker::OutputTrackerLabel, FlattenedTags, false, false, false);
349364

350-
#define PCGEX_OUTPUT_EXTRA(_NAME, _TYPE, _VALUE)\
351-
if (Settings->bOutput##_NAME){\
352-
UPCGParamData* Extra = FPCGContext::NewObject_AnyThread<UPCGParamData>(Context);\
353-
UPCGMetadata* Metadata = Extra->MutableMetadata();\
354-
Metadata->CreateAttribute<_TYPE>(FPCGAttributeIdentifier(PCGExRecursionTracker::Output##_NAME##Label, PCGMetadataDomainID::Default), _VALUE, true, true);\
355-
Metadata->AddEntry();\
356-
Context->StageOutput(Extra, PCGExRecursionTracker::Output##_NAME##Label, FlattenedTags, false, true, false);}
357-
358365
PCGEX_OUTPUT_EXTRA(Progress, float, Settings->bOneMinus ? 1 - Progress : Progress)
359366
PCGEX_OUTPUT_EXTRA(Index, int32, FMath::Clamp(MaxCount - ClampedRemainder, 0, MaxCount))
360367
PCGEX_OUTPUT_EXTRA(Remainder, int32, Remainder)
361368

362-
#undef PCGEX_OUTPUT_EXTRA
363369
}
364370

365371
if (NumTrackers == 0) { StageResult(false); }
@@ -372,6 +378,7 @@ bool FPCGExRecursionTrackerElement::ExecuteInternal(FPCGContext* InContext) cons
372378
return Context->TryComplete();
373379
}
374380

381+
#undef PCGEX_OUTPUT_EXTRA
375382

376383
#undef LOCTEXT_NAMESPACE
377384
#undef PCGEX_NAMESPACE

Source/PCGExtendedToolkit/Public/Data/PCGExData.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ extern template bool IBuffer::IsA<_TYPE>() const;
172172
virtual void SetValue(const int32 Index, const T& Value) = 0;
173173

174174
virtual bool InitForRead(const EIOSide InSide = EIOSide::In, const bool bScoped = false) = 0;
175-
virtual bool InitForBroadcast(const FPCGAttributePropertyInputSelector& InSelector, const bool bCaptureMinMax = false, const bool bScoped = false) = 0;
175+
virtual bool InitForBroadcast(const FPCGAttributePropertyInputSelector& InSelector, const bool bCaptureMinMax = false, const bool bScoped = false, const bool bQuiet = false) = 0;
176176
virtual bool InitForWrite(const T& DefaultValue, bool bAllowInterpolation, EBufferInit Init = EBufferInit::Inherit) = 0;
177177
virtual bool InitForWrite(const EBufferInit Init = EBufferInit::Inherit) = 0;
178178

@@ -231,7 +231,7 @@ extern template bool IBuffer::IsA<_TYPE>() const;
231231
virtual bool EnsureReadable() override;
232232

233233
virtual bool InitForRead(const EIOSide InSide = EIOSide::In, const bool bScoped = false) override;
234-
virtual bool InitForBroadcast(const FPCGAttributePropertyInputSelector& InSelector, const bool bCaptureMinMax = false, const bool bScoped = false) override;
234+
virtual bool InitForBroadcast(const FPCGAttributePropertyInputSelector& InSelector, const bool bCaptureMinMax = false, const bool bScoped = false, const bool bQuiet = false) override;
235235

236236
virtual bool InitForWrite(const T& DefaultValue, bool bAllowInterpolation, EBufferInit Init = EBufferInit::Inherit) override;
237237
virtual bool InitForWrite(const EBufferInit Init = EBufferInit::Inherit) override;
@@ -271,7 +271,7 @@ extern template bool IBuffer::IsA<_TYPE>() const;
271271
virtual void SetValue(const int32 Index, const T& Value) override;
272272

273273
virtual bool InitForRead(const EIOSide InSide = EIOSide::In, const bool bScoped = false) override;
274-
virtual bool InitForBroadcast(const FPCGAttributePropertyInputSelector& InSelector, const bool bCaptureMinMax = false, const bool bScoped = false) override;
274+
virtual bool InitForBroadcast(const FPCGAttributePropertyInputSelector& InSelector, const bool bCaptureMinMax = false, const bool bScoped = false, const bool bQuiet = false) override;
275275

276276
virtual bool InitForWrite(const T& DefaultValue, bool bAllowInterpolation, EBufferInit Init = EBufferInit::Inherit) override;
277277
virtual bool InitForWrite(const EBufferInit Init = EBufferInit::Inherit) override;
@@ -365,10 +365,10 @@ extern template class TSingleValueBuffer<_TYPE>;
365365
#pragma region Broadcasters
366366

367367
template <typename T>
368-
TSharedPtr<TBuffer<T>> GetBroadcaster(const FPCGAttributePropertyInputSelector& InSelector, const bool bSupportScoped = false, const bool bCaptureMinMax = false);
368+
TSharedPtr<TBuffer<T>> GetBroadcaster(const FPCGAttributePropertyInputSelector& InSelector, const bool bSupportScoped = false, const bool bCaptureMinMax = false, const bool bQuiet = false);
369369

370370
template <typename T>
371-
TSharedPtr<TBuffer<T>> GetBroadcaster(const FName InName, const bool bSupportScoped = false, const bool bCaptureMinMax = false);
371+
TSharedPtr<TBuffer<T>> GetBroadcaster(const FName InName, const bool bSupportScoped = false, const bool bCaptureMinMax = false, const bool bQuiet = false);
372372

373373
#pragma endregion
374374

@@ -438,8 +438,8 @@ extern template TSharedPtr<TBuffer<_TYPE>> FFacade::GetWritable<_TYPE>(const FPC
438438
extern template TSharedPtr<TBuffer<_TYPE>> FFacade::GetWritable<_TYPE>(const FPCGMetadataAttribute<_TYPE>* InAttribute, EBufferInit Init); \
439439
extern template TSharedPtr<TBuffer<_TYPE>> FFacade::GetWritable<_TYPE>(const FPCGAttributeIdentifier& InIdentifier, EBufferInit Init); \
440440
extern template TSharedPtr<TBuffer<_TYPE>> FFacade::GetReadable<_TYPE>(const FPCGAttributeIdentifier& InIdentifier, const EIOSide InSide, const bool bSupportScoped); \
441-
extern template TSharedPtr<TBuffer<_TYPE>> FFacade::GetBroadcaster<_TYPE>(const FPCGAttributePropertyInputSelector& InSelector, const bool bSupportScoped, const bool bCaptureMinMax); \
442-
extern template TSharedPtr<TBuffer<_TYPE>> FFacade::GetBroadcaster<_TYPE>(const FName InName, const bool bSupportScoped, const bool bCaptureMinMax); \
441+
extern template TSharedPtr<TBuffer<_TYPE>> FFacade::GetBroadcaster<_TYPE>(const FPCGAttributePropertyInputSelector& InSelector, const bool bSupportScoped, const bool bCaptureMinMax, const bool bQuiet); \
442+
extern template TSharedPtr<TBuffer<_TYPE>> FFacade::GetBroadcaster<_TYPE>(const FName InName, const bool bSupportScoped, const bool bCaptureMinMax, const bool bQuiet); \
443443
extern template FPCGMetadataAttribute<_TYPE>* FFacade::FindMutableAttribute<_TYPE>(const FPCGAttributeIdentifier& InIdentifier, const EIOSide InSide) const; \
444444
extern template const FPCGMetadataAttribute<_TYPE>* FFacade::FindConstAttribute<_TYPE>(const FPCGAttributeIdentifier& InIdentifier, const EIOSide InSide) const;
445445
PCGEX_FOREACH_SUPPORTEDTYPES(PCGEX_TPL)

0 commit comments

Comments
 (0)