Function updated.

This commit is contained in:
Antonio Mata 2024-06-06 12:29:31 +02:00 committed by Blyron
parent 8a8e1cb7cc
commit 4628ae28ec
2 changed files with 5 additions and 3 deletions

View File

@ -215,7 +215,7 @@ void AProceduralBuildingUtilities::CookProceduralMeshToMesh(
SaveArgs);
}
void AProceduralBuildingUtilities::PlaceBuilding(AActor* Parent, TArray<UHierarchicalInstancedStaticMeshComponent*> Components, const FString& Name)
void AProceduralBuildingUtilities::PlaceBuilding(AActor* Parent, TArray<UHierarchicalInstancedStaticMeshComponent*> Components)
{
//Security wall.
if(Parent == nullptr) return;
@ -231,7 +231,7 @@ void AProceduralBuildingUtilities::PlaceBuilding(AActor* Parent, TArray<UHierarc
//Creates the component. The index is needed so every component has a unique name, if not, each iteration
//will just override the previous one.
UHierarchicalInstancedStaticMeshComponent* NewComponent =
NewObject<UHierarchicalInstancedStaticMeshComponent>(Parent, HSMClass, FName(Name + FString::FromInt(i)));
NewObject<UHierarchicalInstancedStaticMeshComponent>(Parent, HSMClass, FName(Components[i]->GetStaticMesh().GetName() + FString::FromInt(i)));
//Sets static mesh
NewComponent->SetStaticMesh(Components[i]->GetStaticMesh());

View File

@ -43,8 +43,10 @@ public:
UFUNCTION(BlueprintCallable, Category="Procedural Building Utilities")
void CookProceduralBuildingToMesh(const FString& DestinationPath, const FString& FileName);
//Creates an actor with the current settings of the bp procedural building. Copying
//the hierarchical mesh components.
UFUNCTION(BlueprintCallable, Category="Procedural Building Utilities")
void PlaceBuilding(AActor* Parent, TArray<UHierarchicalInstancedStaticMeshComponent*> Components, const FString& Name);
void PlaceBuilding(AActor* Parent, TArray<UHierarchicalInstancedStaticMeshComponent*> Components);
UFUNCTION(BlueprintCallable, Category="Procedural Building Utilities")
void CookProceduralMeshToMesh(class UProceduralMeshComponent* Mesh, const FString& DestinationPath, const FString& FileName);