Prefab Tool - Prefab Support for Unreal Engine

After doing some digging on performance, I found that most of the time was spent on repeated calls to StaticFindObject deep inside FPrefabGEditorAdapter::LevelFactory_FactoryCreateText::Local::ImportProperties. By caching the results of calls to StaticFindObject, I was able to bring down Apply times by an order of magnitude (from minutes to seconds). I’d be happy to send you a diff, if you want, or if you have a github repo, I can submit a PR. Cheers!

The Pivot Tool and this Mesh Tool is amazing!! a few questions:

  1. The Mesh Tool has a pivot tool, does it do all the things that the Mesh Tool’s pivot tools does, is one better that the other?

  2. I have 2 big blocks and when they are put together the light shines through the gap. I though that I was able to fix it doing something in the Mesh Tool but I cannot remember what I did. Is there an option in the Mesh Tool that fixes these types of issues?

  3. If a static mesh has 6 material slots can you remove all of them except o1?

  4. Can you create Collision with the Mesh Tool?

  5. Can you combine all materials into one material?

Thank you,
John

Prefab 1.1.1 with 4.20 support is now live on both itch.io and unreal marketplace.

Great job , glad you are back and well :slight_smile:

  • hi, this buy can be to a group or it’s can be to a minigroup?.I buy it, but when i comit in proyect of git, my team cant be used.

JohnADaniels Thanks! :slight_smile:

SbstnDC Preab is a custom asset, if it’s used in a map, the plugin need to be installed locally to open the map properly. You can convert prefab actors to normal actors so the map can be opened without installing the plugin.

Prefab Tool 1.1.2 is now live on both itch.io and Unreal Marketplace.

Thanks [USER=“2026763”]Dan Brakeley[/USER] for reporting the performance issue and kindly providing code solution to improve the performance.

In a test map of applying prefab changes to 1,000 instances, the process time go from 15,520.371 ms down to 1,196.326 ms.

Change Log:

@ , LUV prefab tool, it’s what UE should do anyway I think… Although UE4 is a great achievement, there are some limitations to do with combining and instancing various types of objects, and PFT gets around all that.

One question: can I leave the project in a ‘prefabbed’ state, or is it best to convert everything to meshes / BPs before packaging?..

Thanks!

We downloaded the latest version of the Prefab tool from the Marketplace but we cannot manage to get its plugin to compile with our project which is on 4.20. Anybody else is seeing this?

@tib_hou you can leave project in prefab state since prefab actor is essentially an empty actor in runtime (while has “prefab” behavior in editor).

@WES_Julien Have you downloaded 4.20 version of Prefab Tool from Marketplace? Unreal marketplace servers corresponding version of plugin for different engine version. So if you have to use 4.20 engine in the launcher to download 4.20 version of the plugin.

@

I am using custom engine build and I am wondering if it’s possible to use your tools with it (and how?!). Thanks beforehand

@motorsep here’re the steps to integrate code plugins from marketplace to your own custom build:

  1. Download the closest engine version (which your custom build base on) of plugin from marketplace. e.g. your custom engine build is fork from 4.20, then download 4.20 version of the plugin
  2. Copy the plugin folder from launcher build’s plugins folder to your custom build’s plugins folder
    e.g. copy “C:\Program Files\Epic Games\UE_4.20\Engine\Plugins\Marketplace\PrefabTool” folder into “E:\CUSTOM_UE_BUILD\Engine\Plugins\SOME_FOLDER\PrefabTool”
  3. Run “GenerateProjectFiles.bat” in your custom engine build folder to re-generate UE4.sln
  4. Build UE4.sln in visual stuidio

And you might also want to alter the .uplugin file to include/exclude the targeting platforms:

e.g. one of my client are using PrefabTool in a Switch project which is not enabled by default, you can open “PrefabTool.uplugin”, find the “WhitelistPlatforms” line:


{
      "Name": "PrefabAsset",
      "Type": "Runtime",
      "LoadingPhase": "Default",
      "WhitelistPlatforms":  "Win64", "Win32", "Mac", "Android", "Linux" ]
    },

Append “Switch” to the “WhitelistPlatforms” field


{
      "Name": "PrefabAsset",
      "Type": "Runtime",
      "LoadingPhase": "Default",
      "WhitelistPlatforms":  "Win64", "Win32", "Mac", "Android", "Linux", "Switch" ]
    },

Then rebuild the engine.

1.2.1 Changelog

1.2.0 Changelog

Hey , I’ve got a new issue for you, this time with painted foliage. I was able to repro it in UE 4.20.3 with PrefabTool version 1.2.1.1.

Repro:

  1. In a new scene, create a new prefab with some meshes (I just used the table and chairs from the Starter Content).
  2. Switch to the Foliage Painter mode (shift+4)
  3. Add some foliage and then paint it on to the meshes in your prefab.
  4. Return to normal mode (shift+1)
  5. “UnLock” the prefab.
  6. “Apply and Lock” the prefab.

Result:
Any foliage that was painted on to the prefab’s meshes disappear (foliage painted to non-prefab meshes remain).

Expected:
Foliage painted to a prefab remain after an “Apply and Lock” operation.

Hi Dan, foliage support was purposedly disabled as I ran into some issues in the implementation. I’ll re-eval the problem and see if can come up with proper solution this time. Will keep you updated. Thanks for bringing it up.

I’m going to be taking a look at the code this week as well, as our artists really want this. I’ll let you know what I find!

What did you mean by “foliage support was purposely disabled”? Are you doing something in your code to ensure foliage gets destroyed cleanly?

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).

Hey ! Firstly thanks for the excellent plugin. :slight_smile:

I’m in the process of updating from 4.19 to 4.21, and one problem we’re having is that all/most of our prefabs crash when FPrefabToolEditorUtil::RevertPrefabActor() runs on map load. Ultimately, the crash happens in FPrefabGEditorAdapter::LevelFactory_FactoryCreateText() while trying to parse all the objects stored in the prefab actor.

We believe this is due to some physics classes that were moved and renamed as part of 4.21, and so since the tool works by using the copy/paste functionality, those references can’t be correctly fixed up (and therefore can’t be parsed!). I’ve tested and confirmed that I can fix individual prefabs by disabling the revert on map load, and then going to a map that has the prefab placed within it and hitting Apply to push the properly fixed-up version back to the uasset.

My question is: has this ever come up in previous engine version upgrades? Based on my limited understanding of the problem, this seems like it would be an issue anytime Epic made significant changes to class names in an engine update. Is there some existing functionality or commandlet I can use to re-serialize all of our prefabs so that they’ll get properly fixed up? Thank you for your time!

Obligatory question: is a 4.22 version on the way? :slight_smile:

EXCELENT!
Feature request :slight_smile: : an option to import an .fbx as a prefab (or create a prefab during import), maintaining the original object hierarchy and the original pivot points. It would be awesome!