Added method to hide all child actors

This commit is contained in:
doterop 2020-11-20 16:09:33 +01:00
parent f229b0c899
commit 127823b6d0
2 changed files with 19 additions and 2 deletions

View File

@ -109,6 +109,20 @@ void AProceduralBuilding::ConvertOldBP_ToNativeCodeObject(AActor* BP_Building)
}
}
void AProceduralBuilding::HideAllChildren()
{
for(UChildActorComponent* ChildActorComp : ChildActorComps)
{
AActor* ChildActor = ChildActorComp->GetChildActor();
TArray<UStaticMeshComponent*> SMComps;
ChildActor->GetComponents<UStaticMeshComponent>(SMComps);
if(SMComps.Num() > 0)
{
SMComps[0]->SetVisibility(false, false);
}
}
}
void AProceduralBuilding::SetBaseParameters(
const TSet<int>& InDoorsIndexPosition,
const TArray<bool>& InUseWallMesh,

View File

@ -40,6 +40,9 @@ public:
UFUNCTION(BlueprintCallable, CallInEditor, Category="Procedural Building")
void ConvertOldBP_ToNativeCodeObject(AActor* BP_Building);
UFUNCTION(BlueprintCallable, CallInEditor, Category="Procedural Building")
void HideAllChildren();
UFUNCTION(BlueprintCallable, Category="Procedural Building|Conversion")
void SetBaseParameters(
const TSet<int>& InDoorsIndexPosition,
@ -93,11 +96,11 @@ protected:
// TODO: AdvancedDisplay
// Map containing the pair with the name of the mesh and the component that uses it
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category="Procedural Building|Debug")
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="Procedural Building|Debug")
TMap<FString, UHierarchicalInstancedStaticMeshComponent*> HISMComps;
// Contains all the ChildActorComps spawned for this Actor
UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category="Procedural Building|Debug")
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category="Procedural Building|Debug")
TArray<UChildActorComponent*> ChildActorComps;
/**