Last active
October 28, 2018 17:07
-
-
Save olegknyazev/8c692bb06f018942a51a2c91f684afb9 to your computer and use it in GitHub Desktop.
About Formatting: A highly 'professional' style
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void AActor::GetAttachedActors(TArray<class AActor*>& OutActors) const | |
{ | |
OutActors.Reset(); | |
if (RootComponent != nullptr) | |
{ | |
// Current set of components to check | |
TInlineComponentArray<USceneComponent*> CompsToCheck; | |
// Set of all components we have checked | |
TInlineComponentArray<USceneComponent*> CheckedComps; | |
CompsToCheck.Push(RootComponent); | |
// While still work left to do | |
while(CompsToCheck.Num() > 0) | |
{ | |
// Get the next off the queue | |
const bool bAllowShrinking = false; | |
USceneComponent* SceneComp = CompsToCheck.Pop(bAllowShrinking); | |
// Add it to the 'checked' set, should not already be there! | |
if (!CheckedComps.Contains(SceneComp)) | |
{ | |
CheckedComps.Add(SceneComp); | |
AActor* CompOwner = SceneComp->GetOwner(); | |
if (CompOwner != nullptr) | |
{ | |
... | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment