Prefab Tool - Prefab Support for Unreal Engine

Well, I’ve taken a couple stabs at this, and both involved changes to the engine to work (we’re on UE 4.19 at the moment). If anyone reading this is also willing to alter the engine to get this working, here’s the summary:

  1. In [FONT=courier new]FPrefabToolEditorUtil::ReplacePrefabInstances, as we iterate over [FONT=courier new]ActorsToReplace, I find the [FONT=courier new]AInstancedFoliageActor* for the Actor’s Level, and I tell it to temporarily early out in [FONT=courier new]OnLevelActorMoved and [FONT=courier new]OnLevelActorDeleted (first engine change).

  2. At the end of that same for loop, I turn [FONT=courier new]OnLevelActorMoved and [FONT=courier new]OnLevelActorDeleted back on, and I add the [FONT=courier new]AInstancedFoliageActor* to a TSet.

  3. Immediately after the for loop, I iterate through the TSet of [FONT=courier new]AInstancedFoliageActors and call a new function [FONT=courier new]ReplaceMissingBases (second engine change). [FONT=courier new]ReplaceMissingBases is based off [FONT=courier new]AInstancedFoliateActor::MapRebuild, but instead of looking for bases with [FONT=courier new]UModelComponents, I’m looking for bases with null component. Also, [FONT=courier new]MapRebuild uses [FONT=courier new]LineTraceSingleByObjectType, which unfortunately collides with LODs, which is not at all what I want, so I use [FONT=courier new]LineTraceMultiByObjectType instead, and then cull out anything I don’t want to collide with (see [FONT=courier new]AInstancedFoliageActor::FoliageTrace for the example I pulled from).