Editor Blueprint - Replace mesh of StaticMeshActor with new mesh from content browser

Hi,

I’m a blueprint novice so go easy on me. I’m trying to figure out to replace the Static Mesh of a StaticMeshActor I have placed in the editor with a corresponding Static Mesh I have in my content browser.

Workflow currently is to use a script to export FBX from 3DSMax, moving each object to 0,0,0 automatically, exporting, then moving back into position. I then copy the names and transforms of each exported object and paste this into the editor, again via a script that does this for all selected objects. This creates an empty StaticMeshActor at the exact world position the mesh had in 3DSMax. I then replace the empty mesh with the FBX from the content browser. This allows me to export scenes from Max via FBX and keep the transforms and relative locations exactly as they are in 3DSMax - this is essential for our workflow.

Currently replacing each mesh is a manual process, I’m wanting to find a way to automate this via an in editor BP. Can someone point me in the right direction or even let me know if this is possiblle?

Thanks,

hi @ThomasCoote
you can use a Editor Widget Blueprint to automate such changes. Your BP can look like something like this.

Luckyly your assets and your actors have the same name so you’ll be able to resolve the right staticmesh asset for each actor using the actor label

Thanks for your reply!

I may be misunderstanding something here but this doesn’t seem to work - I plugged the array into a Print to a For Each Loop and used Print String to see what was going on - the name the string puts out is almost correct, but has an added number on the end, could this be the cause?

Apologies if I’m missing somethiong obvious.

You can use the GetActorLabel Function to get the name as it exists in the Outliner.
The “name” you are printing adds the instance number after the name (you can also remove the suffix using string manipulation functions)

What I seem to be struggling with is getting “new mesh” in that blueprint to be the mesh selected in the content browser. I can select all my actors, set “new mesh” to be one of the Static Mesh from my content browser and they will all become that 1 mesh, but having each actor take the Static Mesh of the corresponding name is what I can’t figure out

After a lot of trial and error I’ve found that this BP works

I need to have all the Actors and Static Mesh assets selected, but this seems to work. Would be nice if I could find a way to SET the “new mesh” to be the exact name of the Static Mesh in my content browser, but for now this will do.

Thanks for your help

Yes you’ll have to tinker some more in order to get this tool to work correctly in all situations. I the current case it will work only if the assets and the actors appear in the same order in the arrays. Otherwise, there’s going to be swapping.
You should look into the asset registry functions in order to find the right package for the right actor.

I will do that tomorrow, thank you for the suggestion!