Story in short
I have a big level and 400 procedural foliage spawn volumes. I need to select 10 volumes, resimulate, save and repeat with the next 10 volumes. This takes days when done manually.
Ful story (optional to read )
Possible solution
My plan is to automate the process. I thought I might use the Editor Utility Blueprint, describe all my sets in some array once, and then iterate through them, making a delay for stability and save the project every 10 volumes. This will not crash and can go on automatically.
Problem
I’ve been experimenting with the Editor Utility Blueprint the whole week.
I have created my script in the context menu of level actors, I can select and iterate through my volumes, read their names. Blueprint is here
But I just cannot access that RESIMULATE button\function from the Details View.
I found only the SIMULATE function that runs on a Procedural Foliage Spawner. But I need to run it on my volume in the World Outliner.
I even found that button in the Editor source code (ProceduralFoliageComponentDetails.cpp), but lack experience with C++ and don’t know what to do with this code.
FReply FProceduralFoliageComponentDetails::OnResimulateClicked()
{
for (TWeakObjectPtr<UProceduralFoliageComponent>& Component : SelectedComponents)
{
if (Component.IsValid() && Component->FoliageSpawner)
{
FScopedTransaction Transaction(LOCTEXT("Resimulate_Transaction", "Procedural Foliage Simulation"));
TArray <FDesiredFoliageInstance> DesiredFoliageInstances;
if (Component->GenerateProceduralContent(DesiredFoliageInstances))
{
if (DesiredFoliageInstances.Num() > 0)
{
Component->RemoveProceduralContent(false);
FFoliagePaintingGeometryFilter OverrideGeometryFilter;
OverrideGeometryFilter.bAllowLandscape = Component->bAllowLandscape;
OverrideGeometryFilter.bAllowStaticMesh = Component->bAllowStaticMesh;
OverrideGeometryFilter.bAllowBSP = Component->bAllowBSP;
OverrideGeometryFilter.bAllowFoliage = Component->bAllowFoliage;
OverrideGeometryFilter.bAllowTranslucent = Component->bAllowTranslucent;
FEdModeFoliage::AddInstances(Component->GetWorld(), DesiredFoliageInstances, OverrideGeometryFilter, true);
}
// If no instances were spawned, inform the user
if (!Component->HasSpawnedAnyInstances())
{
FNotificationInfo Info(LOCTEXT("NothingSpawned_Notification", "Unable to spawn instances. Ensure a large enough surface exists within the volume."));
Info.bUseLargeFont = false;
Info.bFireAndForget = true;
Info.bUseThrobber = false;
Info.bUseSuccessFailIcons = true;
FSlateNotificationManager::Get().AddNotification(Info);
}
}
}
}
return FReply::Handled();
}
**Any help is appreciated. **