68 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			68 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
---
 | 
						|
title: Untitled
 | 
						|
date: 2024-07-19 22:09:12
 | 
						|
excerpt: 
 | 
						|
tags: 
 | 
						|
rating: ⭐
 | 
						|
---
 | 
						|
 | 
						|
```c++
 | 
						|
for (auto It = SceneCaptureComponent->HiddenActors.CreateConstIterator(); It; ++It)
 | 
						|
{
 | 
						|
	AActor* Actor = *It;
 | 
						|
 | 
						|
	if (Actor)
 | 
						|
	{
 | 
						|
		for (UActorComponent* Component : Actor->GetComponents())
 | 
						|
		{
 | 
						|
			if (UPrimitiveComponent* PrimComp = Cast<UPrimitiveComponent>(Component))
 | 
						|
			{
 | 
						|
				View->HiddenPrimitives.Add(PrimComp->ComponentId);
 | 
						|
			}
 | 
						|
		}
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
if (SceneCaptureComponent->PrimitiveRenderMode == ESceneCapturePrimitiveRenderMode::PRM_UseShowOnlyList)
 | 
						|
{
 | 
						|
		View->ShowOnlyPrimitives.Emplace();
 | 
						|
 | 
						|
	for (auto It = SceneCaptureComponent->ShowOnlyComponents.CreateConstIterator(); It; ++It)
 | 
						|
	{
 | 
						|
		// If the primitive component was destroyed, the weak pointer will return NULL.
 | 
						|
		UPrimitiveComponent* PrimitiveComponent = It->Get();
 | 
						|
		if (PrimitiveComponent)
 | 
						|
		{
 | 
						|
			View->ShowOnlyPrimitives->Add(PrimitiveComponent->ComponentId);
 | 
						|
		}
 | 
						|
	}
 | 
						|
 | 
						|
	for (auto It = SceneCaptureComponent->ShowOnlyActors.CreateConstIterator(); It; ++It)
 | 
						|
	{
 | 
						|
		AActor* Actor = *It;
 | 
						|
 | 
						|
		if (Actor)
 | 
						|
		{
 | 
						|
			for (UActorComponent* Component : Actor->GetComponents())
 | 
						|
			{
 | 
						|
				if (UPrimitiveComponent* PrimComp = Cast<UPrimitiveComponent>(Component))
 | 
						|
				{
 | 
						|
					View->ShowOnlyPrimitives->Add(PrimComp->ComponentId);
 | 
						|
				}
 | 
						|
			}
 | 
						|
		}
 | 
						|
	}
 | 
						|
}
 | 
						|
else if (SceneCaptureComponent->ShowOnlyComponents.Num() > 0 || SceneCaptureComponent->ShowOnlyActors.Num() > 0)
 | 
						|
{
 | 
						|
	static bool bWarned = false;
 | 
						|
 | 
						|
	if (!bWarned)
 | 
						|
	{
 | 
						|
		UE_LOG(LogRenderer, Log, TEXT("Scene Capture has ShowOnlyComponents or ShowOnlyActors ignored by the PrimitiveRenderMode setting! %s"), *SceneCaptureComponent->GetPathName());
 | 
						|
		bWarned = true;
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
ViewFamily.Views.Add(View);
 | 
						|
``` |