Hi,
I’m trying to write an editor plugin that can resimulate all the ProceduralFoliageVolumes in the world context. To do this I’m using the following code, patterned after the implementation of FProceduralFoliageComponentDetails::OnResimulateClicked() in Editor/FoliageEdit/Private/ProceduralFoliageComponentDetails.h:
for (TActorIterator<AProceduralFoliageVolume> FoliageVolumeItr(World); FoliageVolumeItr; ++FoliageVolumeItr)
{
bool bGenerageSucceeded = false;
if (FoliageVolumeItr->ProceduralComponent->FoliageSpawner == nullptr)
{
UE_LOG(LogTemp, Warning, TEXT("Unable to resimulate %s: FoliageSpawner is nullptr"), *FoliageVolumeItr->GetName());
continue;
}
bGenerateSucceeded = FoliageVolumeItr->ProceduralComponent->GenerateProceduralContent(OutFoliageInstances);
if (bGenerateSucceeded)
{
UE_LOG(LogTemp, Warning, TEXT("GenerateProceduralContent succeeded for %s"), *FoliageVolumeItr->GetName());
FEdModeFoliage::AddInstances(World, OutFoliageInstances);
}
}
However, I keep getting the following error: error LNK2019: unresolved external symbol “public: static void __cdecl FEdModeFoliage::AddInstances(class UWorld *,class TArray const &)” (?AddInstances@FEdModeFoliage@@SAXPEAVUWorld@@AEBV?$TArray@UFDesiredFoliageInstance@@VFDefaultAllocator@@@@@Z) referenced in function “public: void __cdecl USpawnTool::ResimulateAll(void)” (?ResimulateAll@USpawnTool@@QEAAXXZ)
As far as I can tell, AddInstances isn’t accessible for some reason, maybe because its header file (Editor/FoliageEdit/Private/FoliageEdMode.h) isn’t part of the normal API. Is there a way I can make it accessible? I’d really like to use this function, and I’m not sure I can resimulate any volumes without it.
Here’s a list of my includes if they’d be helpful:
“Engine.h”, “Editor.h”, “SlateBasics.h”
“ProceduralFoliageSpawner.h”, “ProceduralFoliageVolume.h”, “ProceduralFoliageComponent.h”, “FoliageType.h”, “InstancedFoliage.h”
“Editor/UnrealEd/Public/EditorModes.h”, “Editor/UnrealEd/Public/EditorComponents.h”, “Editor/UnrealEd/Public/EdMode.h”, “Editor/FoliageEdit/Private/FoliageEdMode.h”, “Editor/PropertyEditor/Public/IDetailCustomization.h”, “Editor/FoliageEdit/Private/ProceduralFoliageComponentDetails.h”
“Editor/UnrealEd/Classes/Builders/EditorBrushBuilder.h”, “Editor/UnrealEd/Classes/Builders/CubeBuilder.h”