Editor Utility Blueprint/Scripted Action - Filter actors via key and replace based on value

I’m trying to create a blueprint I can run in the editor to replace static mesh actors (imported via datasmith) that contain a specific key and value with a corresponding blueprint asset.

Other things to consider:

  • This BP will have a lot of values and different assets spawned so making it clean and legible will be important (use macros?).
  • The static mesh actor instance locations will be regularly updated (spawn new assets and don’t destroy static mesh actors?)

I’ve attached one of my many BP attempts. It seems simple but am having a lot of difficulty as a newbie. It worked with dataprep (see graphics below) but dataprep is having some issues and wouldn’t allow my next step which would be to drop them on a surface below in the editor with a line trace.


In theory this should work. I unfortunately don’t have any datasmith compatible app (Maya user here) so I can’t test it without any assets.

In the blueprint editor widget change “/Game/Blueprints/” to the place with the path to the blueprints that are supposed to be spawned.

DatasmithReplaceWithBP.uasset (185.8 KB)

1 Like

@3dRaven thanks for your quick feedback! I think I needed to give a little more background. I’m wanting to input the different values and spawned assets in the blueprint and not in the widget each time so I can apply the same list of substitutions for numerous projects with a click of a button. I made an attempt to translate your BP to use in a utility editor BP with asset action utility as the parent which didn’t have all of the same nodes available. I got a little lost with the variables so I’m sure I did some things wrong.

The purpose of this BP is to replace imported plant locations with blueprint vegetation assets. Each imported plant species has a unique value for the “key” definition that can be isolated or the overall instanced geometry name can be used. My test example below has 12 species but this blueprint will contain well over a hundred key values for potential plant species used. Instead of clicking on the Datasmith scene one could easily select all the geometries for the species, right click, and go to the scripted action. (Those different colored upside down triangles in the graphic below are the instanced species geometry)


Notes:

  • The key in the user data/metadata will always be “definition”
  • The key value will always be “LAFX-Node (space and then 3-4 digits to represent the species)”
  • Datasmith saves each geometry file as “LAFX-Node_(and then 3-4 digits to represent the species)”
  • The vegetation BP assets can be saved in my Unreal template file so not sure if the node “Get assets by Path” is necessary.