Datasmith-imported materials - Most efficient way to replace with UE5 ones?

I am using the Direct Link plugin from Sketchup 2021 to the latest version of Unreal Engine 5. It works well, but the best way that I’ve found to replace Sketchup’s materials with UE5 ones is to select a mesh, “Select All with Same Material”, then click in the Details pane to replace one material at a time.

Is there a better way in UE5 please? A Python script? A plugin (paid is fine with me)? There used to be an (expensive) plugin called Optim; what else is similar in UE5 that works well? The less time that I have to spend replacing materials, the better :).

Thank you in advance.

1 Like

You can use the attached Editor Utility Widget. Or look at the code to make a python version.

  1. create a substitution datatable as you would do in visual dataprep
  2. use one of the button to replace on selected actors or selected assets or assets in a folder
    image
    ApplyMaterial.uasset (190.7 KB)
3 Likes

Thank you.

I got DataPrep working, thank you FlavienP.

I will post a short tutorial this weekend with screenshots, once you get it working it’s convenient.

To auto-replace Materials with the Dataprep feature, right-click in Context Browser and add a Dataprep object:

Do this BEFORE you import a Datasmith file into your project. This does not work with Direct Link.

Create a Substitution Table like this:

Fill out the table rows. The critical parts are the second column; here, it matches the Sketchup materials in my model, and the last column matches the name and file path of the UE5 Material to replace each one with.

Click Import to load your Datasmith file in the Preview window; click Execute to preview-replace materials, then click Commit. It will load the Datasmith file into your project, replacing (Sketchup / modeling software’s) materials with the UE5 ones!

1 Like

Good news, there is also a function to convert Static Meshes on import to Nanite! I added this to my Dataprep workflow, too.

There is no way to use both Dataprep and Direct Link from Revit or Sketchup, correct?

Dataprep only works with Datasmith imports (ie .udatasmith and CAD files), no planned support for Direct Link for now.

Cheers,
Antoine

1 Like

Thank you Antoine.

@Antoine_Guillo A related question - suggestion for the following scenario?

  1. A (SketchUp) datasmith file is imported using dataprep
  2. Several materials are switched in dataprep using a data table
  3. The scene is committed.
  4. Work continues on the CAD model. The data table is expanded so more materials are added to be converted in dataprep.
  5. When right-clikcking on the scene in the UE editor and choosing ‘update datasmith scene(s)’ the newly added materials in the data table are not processed.

Any way to make that update also process the newly added lines in the data table? Or should we use the widget that’s posted above? Or just delete the streaming layer and re-do the import process using Dataprep?

You’ll need to reimport using Dataprep, as the “update datasmith scene” button in your Datasmith Scene Actor is to update the hierarchy/respawn deleted objects only (it does NOT reimport your datasmith scene, nor re executes your Dataprep, where your material substitution data table is used).

Cheers !
Antoine

2 Likes