本文整理汇总了C++中TSet::Num方法的典型用法代码示例。如果您正苦于以下问题:C++ TSet::Num方法的具体用法?C++ TSet::Num怎么用?C++ TSet::Num使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSet
的用法示例。
在下文中一共展示了TSet::Num方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GenerateStubs
void FBlueprintNativeCodeGenModule::GenerateStubs()
{
TSet<TAssetPtr<UBlueprint>> AlreadyGenerated;
while (AlreadyGenerated.Num() < StubsRequiredByGeneratedCode.Num())
{
const int32 OldGeneratedNum = AlreadyGenerated.Num();
for (TAssetPtr<UBlueprint>& BPPtr : StubsRequiredByGeneratedCode)
{
bool bAlreadyGenerated = false;
AlreadyGenerated.Add(BPPtr, &bAlreadyGenerated);
if (bAlreadyGenerated)
{
continue;
}
ensureMsgf(AllPotentialStubs.Contains(BPPtr), TEXT("A required blueprint doesn't generate stub: %s"), *BPPtr.ToString());
for (auto& PlatformName : TargetPlatformNames)
{
GenerateSingleStub(BPPtr.LoadSynchronous(), *PlatformName);
}
}
if (!ensure(OldGeneratedNum != AlreadyGenerated.Num()))
{
break;
}
}
UE_LOG(LogBlueprintCodeGen, Log, TEXT("GenerateStubs - all unconverted bp: %d, generated wrapers: %d"), AllPotentialStubs.Num(), StubsRequiredByGeneratedCode.Num());
}
示例2: GetEnumForByteTrack
UEnum* GetEnumForByteTrack(TSharedPtr<ISequencer> Sequencer, const FGuid& OwnerObjectHandle, FName PropertyName, UMovieSceneByteTrack* ByteTrack)
{
UObject* RuntimeObject = Sequencer->GetFocusedMovieSceneSequence()->FindObject(OwnerObjectHandle);
TSet<UEnum*> PropertyEnums;
if (RuntimeObject != nullptr)
{
UProperty* Property = RuntimeObject->GetClass()->FindPropertyByName(PropertyName);
if (Property != nullptr)
{
UByteProperty* ByteProperty = Cast<UByteProperty>(Property);
if (ByteProperty != nullptr && ByteProperty->Enum != nullptr)
{
PropertyEnums.Add(ByteProperty->Enum);
}
}
}
UEnum* TrackEnum;
if (PropertyEnums.Num() == 1)
{
TrackEnum = PropertyEnums.Array()[0];
}
else
{
TrackEnum = nullptr;
}
return TrackEnum;
}
示例3: HandleGraphBeingDeleted
void UAnimationGraphSchema::HandleGraphBeingDeleted(UEdGraph& GraphBeingRemoved) const
{
if (UBlueprint* Blueprint = FBlueprintEditorUtils::FindBlueprintForGraph(&GraphBeingRemoved))
{
// Look for state nodes that reference this graph
TArray<UAnimStateNode*> StateNodes;
FBlueprintEditorUtils::GetAllNodesOfClass<UAnimStateNode>(Blueprint, /*out*/ StateNodes);
TSet<UAnimStateNode*> NodesToDelete;
for (int32 i = 0; i < StateNodes.Num(); ++i)
{
UAnimStateNode* StateNode = StateNodes[i];
if (StateNode->BoundGraph == &GraphBeingRemoved)
{
NodesToDelete.Add(StateNode);
}
}
// Delete the node that owns us
ensure(NodesToDelete.Num() <= 1);
for (TSet<UAnimStateNode*>::TIterator It(NodesToDelete); It; ++It)
{
UAnimStateNode* NodeToDelete = *It;
// Prevent re-entrancy here
NodeToDelete->BoundGraph = NULL;
NodeToDelete->Modify();
NodeToDelete->DestroyNode();
}
}
}
示例4: DumpSimpleSet
bool UParticleSystemAuditCommandlet::DumpSimpleSet(TSet<FString>& InSet, const TCHAR* InShortFilename, const TCHAR* InObjectClassName)
{
if (InSet.Num() > 0)
{
check(InShortFilename != NULL);
check(InObjectClassName != NULL);
FArchive* OutputStream = GetOutputFile(InShortFilename);
if (OutputStream != NULL)
{
UE_LOG(LogParticleSystemAuditCommandlet, Log, TEXT("Dumping '%s' results..."), InShortFilename);
OutputStream->Logf(TEXT("%s,..."), InObjectClassName);
for (TSet<FString>::TIterator DumpIt(InSet); DumpIt; ++DumpIt)
{
FString ObjName = *DumpIt;
OutputStream->Logf(TEXT("%s"), *ObjName);
}
OutputStream->Close();
delete OutputStream;
}
else
{
return false;
}
}
return true;
}
示例5: FindChildGeometries_Helper
void SWidget::FindChildGeometries_Helper( const FGeometry& MyGeometry, const TSet< TSharedRef<SWidget> >& WidgetsToFind, TMap<TSharedRef<SWidget>, FArrangedWidget>& OutResult ) const
{
// Perform a breadth first search!
FArrangedChildren ArrangedChildren(EVisibility::Visible);
this->ArrangeChildren( MyGeometry, ArrangedChildren );
const int32 NumChildren = ArrangedChildren.Num();
// See if we found any of the widgets on this level.
for(int32 ChildIndex=0; ChildIndex < NumChildren; ++ChildIndex )
{
const FArrangedWidget& CurChild = ArrangedChildren[ ChildIndex ];
if ( WidgetsToFind.Contains(CurChild.Widget) )
{
// We found one of the widgets for which we need geometry!
OutResult.Add( CurChild.Widget, CurChild );
}
}
// If we have not found all the widgets that we were looking for, descend.
if ( OutResult.Num() != WidgetsToFind.Num() )
{
// Look for widgets among the children.
for( int32 ChildIndex=0; ChildIndex < NumChildren; ++ChildIndex )
{
const FArrangedWidget& CurChild = ArrangedChildren[ ChildIndex ];
CurChild.Widget->FindChildGeometries_Helper( CurChild.Geometry, WidgetsToFind, OutResult );
}
}
}
示例6: OnSelectedNodesChanged
void FSoundCueEditor::OnSelectedNodesChanged(const TSet<class UObject*>& NewSelection)
{
TArray<UObject*> Selection;
if(NewSelection.Num())
{
for(TSet<class UObject*>::TConstIterator SetIt(NewSelection);SetIt;++SetIt)
{
if (Cast<USoundCueGraphNode_Root>(*SetIt))
{
Selection.Add(GetSoundCue());
}
else if (USoundCueGraphNode* GraphNode = Cast<USoundCueGraphNode>(*SetIt))
{
Selection.Add(GraphNode->SoundNode);
}
else
{
Selection.Add(*SetIt);
}
}
//Selection = NewSelection.Array();
}
else
{
Selection.Add(GetSoundCue());
}
SetSelection(Selection);
}
示例7: Finalize
void FStatsWriteFile::Finalize()
{
FArchive& Ar = *File;
// Write dummy compression size, so we can detect the end of the file.
FCompressedStatsData::WriteEndOfCompressedData( Ar );
// Real header, written at start of the file, but written out right before we close the file.
// Write out frame table and update header with offset and count.
Header.FrameTableOffset = Ar.Tell();
Ar << FramesInfo;
const FStatsThreadState& Stats = FStatsThreadState::GetLocalState();
// Add FNames from the stats metadata.
for( const auto& It : Stats.ShortNameToLongName )
{
const FStatMessage& StatMessage = It.Value;
FNamesSent.Add( StatMessage.NameAndInfo.GetRawName().GetComparisonIndex() );
}
// Create a copy of names.
TSet<int32> FNamesToSent = FNamesSent;
FNamesSent.Empty( FNamesSent.Num() );
// Serialize FNames.
Header.FNameTableOffset = Ar.Tell();
Header.NumFNames = FNamesToSent.Num();
for( const int32 It : FNamesToSent )
{
WriteFName( Ar, FStatNameAndInfo(FName(It, It, 0),false) );
}
// Serialize metadata messages.
Header.MetadataMessagesOffset = Ar.Tell();
Header.NumMetadataMessages = Stats.ShortNameToLongName.Num();
WriteMetadata( Ar );
// Verify data.
TSet<int32> BMinA = FNamesSent.Difference( FNamesToSent );
struct FLocal
{
static TArray<FName> GetFNameArray( const TSet<int32>& NameIndices )
{
TArray<FName> Result;
for( const int32 NameIndex : NameIndices )
{
new(Result) FName( NameIndex, NameIndex, 0 );
}
return Result;
}
};
auto BMinANames = FLocal::GetFNameArray( BMinA );
// Seek to the position just after a magic value of the file and write out proper header.
Ar.Seek( sizeof(uint32) );
Ar << Header;
}
示例8: AppendCollectionToArray
static void AppendCollectionToArray(const TSet<FName>& InObjectSet, TArray<FName>& OutObjectArray)
{
OutObjectArray.Reserve(OutObjectArray.Num() + InObjectSet.Num());
for (const FName& ObjectName : InObjectSet)
{
OutObjectArray.Add(ObjectName);
}
}
示例9: PasteWidgets
void FWidgetBlueprintEditor::PasteWidgets()
{
TSet<FWidgetReference> Widgets = GetSelectedWidgets();
FWidgetReference Target = Widgets.Num() > 0 ? *Widgets.CreateIterator() : FWidgetReference();
FWidgetBlueprintEditorUtils::PasteWidgets(SharedThis(this), GetWidgetBlueprintObj(), Target, PasteDropLocation);
//TODO UMG - Select the newly selected pasted widgets.
}
示例10: CanPasteWidgets
bool FWidgetBlueprintEditor::CanPasteWidgets()
{
TSet<FWidgetReference> Widgets = GetSelectedWidgets();
if ( Widgets.Num() == 1 )
{
FWidgetReference Target = *Widgets.CreateIterator();
const bool bIsPanel = Cast<UPanelWidget>(Target.GetTemplate()) != nullptr;
return bIsPanel;
}
else if ( Widgets.Num() == 0 )
{
if ( GetWidgetBlueprintObj()->WidgetTree->RootWidget == nullptr )
{
return true;
}
}
return false;
}
示例11: ShiftCurve
void FRichCurve::ShiftCurve(float DeltaTime, TSet<FKeyHandle>& KeyHandles)
{
for (auto It = KeyHandlesToIndices.CreateIterator(); It; ++It)
{
const FKeyHandle& KeyHandle = It.Key();
if (KeyHandles.Num() != 0 && KeyHandles.Contains(KeyHandle))
{
SetKeyTime(KeyHandle, GetKeyTime(KeyHandle)+DeltaTime);
}
}
}
示例12: ScaleCurve
void FRichCurve::ScaleCurve(float ScaleOrigin, float ScaleFactor, TSet<FKeyHandle>& KeyHandles)
{
for (auto It = KeyHandlesToIndices.CreateIterator(); It; ++It)
{
const FKeyHandle& KeyHandle = It.Key();
if (KeyHandles.Num() != 0 && KeyHandles.Contains(KeyHandle))
{
SetKeyTime(KeyHandle, (GetKeyTime(KeyHandle) - ScaleOrigin) * ScaleFactor + ScaleOrigin);
}
}
}
示例13: UpdateAvailableBlueprintClasses
void FGraphNodeClassHelper::UpdateAvailableBlueprintClasses()
{
if (FModuleManager::Get().IsModuleLoaded(TEXT("AssetRegistry")))
{
FAssetRegistryModule& AssetRegistryModule = FModuleManager::GetModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
const bool bSearchSubClasses = true;
TArray<FName> ClassNames;
TSet<FName> DerivedClassNames;
for (TMap<UClass*, int32>::TIterator It(BlueprintClassCount); It; ++It)
{
ClassNames.Reset();
ClassNames.Add(It.Key()->GetFName());
DerivedClassNames.Empty(DerivedClassNames.Num());
AssetRegistryModule.Get().GetDerivedClassNames(ClassNames, TSet<FName>(), DerivedClassNames);
int32& Count = It.Value();
Count = DerivedClassNames.Num();
}
}
}
示例14: world
/*Function which retrieves an arranged list of assets with the same nature (coresponding tags: Item, Stackable, ItemType)
which are placed on top of one another in the world (eg: a stack of plates)
The list is used for picking up multiple items at once in the GrabWithTwoHands() method.
@param AActor* ContainedItem --> Actor contained within the stack needed
*/
TSet<AActor*> AMyCharacter::GetStack(AActor* ContainedItem)
{
//Create an empty array to be populated with proper values
TSet<AActor*> StackList;
StackList.Empty();
//Make sure that the function parameter is logicaly valid and if not return an empty stack and exit the function call
if (!ContainedItem->ActorHasTag(FName(TEXT("Stackable"))))
{
return StackList;
}
/*Loop through the list of stackable items created in BeginPlay() and check for matching tags, as well as world positioning,
and populate the array with elements which are found to have the center on the same Z axis as the recieved parameter (+/- a small offset)
*/
for (const auto Iterator : AllStackableItems)
{
if (Iterator->Tags == ContainedItem->Tags)
{
if ((ContainedItem->GetActorLocation().X - 2 < Iterator->GetActorLocation().X) &&
(Iterator->GetActorLocation().X < ContainedItem->GetActorLocation().X + 2) &&
(ContainedItem->GetActorLocation().Y - 2 < Iterator->GetActorLocation().Y) &&
(Iterator->GetActorLocation().Y< ContainedItem->GetActorLocation().Y + 2))
{
StackList.Add(Iterator);
}
}
}
//Bubble sort algorithm
bool swapped = true;
int j = 0;
AActor* tmp;
while (swapped) {
swapped = false;
j++;
for (int i = 0; i < StackList.Num() - j; i++) {
if (StackList[FSetElementId::FromInteger(i)]->GetActorLocation().Z > StackList[FSetElementId::FromInteger(i + 1)]->GetActorLocation().Z)
{
tmp = StackList[FSetElementId::FromInteger(i)];
StackList[FSetElementId::FromInteger(i)] = StackList[FSetElementId::FromInteger(i + 1)];
StackList[FSetElementId::FromInteger(i + 1)] = tmp;
swapped = true;
}
}
}
return StackList;
}
示例15: GatherUserDefinedDependencies
void GatherUserDefinedDependencies(UBlueprint& InBlueprint)
{
FGatherConvertedClassDependencies ClassDependencies(InBlueprint.GeneratedClass);
for (auto Iter : ClassDependencies.ConvertedClasses)
{
DependentObjects.Add(Iter);
}
for (auto Iter : ClassDependencies.ConvertedStructs)
{
DependentObjects.Add(Iter);
}
for (auto Iter : ClassDependencies.ConvertedEnum)
{
DependentObjects.Add(Iter);
}
if (DependentObjects.Num())
{
TypeDependencies = LOCTEXT("ConvertedDependencies", "Converted Dependencies:\n").ToString();
}
else
{
TypeDependencies = LOCTEXT("NoConvertedAssets", "No Converted Dependencies was found.\n").ToString();
}
for (auto Obj : DependentObjects)
{
TypeDependencies += FString::Printf(TEXT("%s \t%s\n"), *Obj->GetClass()->GetName(), *Obj->GetPathName());
}
DependentObjects.Add(InBlueprint.GeneratedClass);
bool bUnconvertedHeader = false;
for (auto Asset : ClassDependencies.Assets)
{
if (auto BPGC = Cast<UBlueprintGeneratedClass>(Asset))
{
UnconvertedNeededClasses.Add(BPGC);
if (!bUnconvertedHeader)
{
bUnconvertedHeader = true;
TypeDependencies += LOCTEXT("NoConvertedDependencies", "\nUnconverted Dependencies, that require a warpper struct:\n").ToString();
}
TypeDependencies += FString::Printf(TEXT("%s \t%s\n"), *BPGC->GetClass()->GetName(), *BPGC->GetPathName());
}
}
}