Tutorial: Maya to Unreal instanced static mesh importer tool

Unreal has made a lot of improvements to level design tools. Packed level actors and level instances are pretty great. But if you are a power maya user like me, it still feels really painful to do much model placement in the engine.

You might be interested in the “import into level tool”, however this seems to be designed around importing an entire maya scene all at once. Not practical for a large scene that is being updated constantly - too slow.

The reason it seems to be designed for entire scene uploads is because if you try to reimport same file, it creates duplicates of the static meshes with same name. There is no proper way to reimport. At least not as far as I can tell. In fact the whole thing seems very buggy.

So here is a tool you can use to send your maya models to unreal, maintaining instances, and finding linked static mesh within the content browser.

I am still developing workflow around this tool and will update as I flesh it out further. Right now only basic functionality is confirmed.

Here is the maya side python script:

import maya.cmds as cmds

import csv



selection = cmds.ls(sl=True)



col = ['','actorName','tx', 'ty', 'tz', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz']



with open("C:\ISMExporter\data.csv", 'w', newline='') as f:

writer = csv.writer(f)

writer.writerow(col)



for idx, obj in enumerate(selection):

data = []

data.append(idx)

actorName = obj.split("_")[0]

data.append(actorName)

data.append(cmds.getAttr(obj + '.translateX'))

data.append(cmds.getAttr(obj + '.translateY'))

data.append(cmds.getAttr(obj + '.translateZ'))



data.append(cmds.getAttr(obj + '.rotateX'))

data.append(cmds.getAttr(obj + '.rotateY'))

data.append(cmds.getAttr(obj + '.rotateZ'))



data.append(cmds.getAttr(obj + '.scaleX'))

data.append(cmds.getAttr(obj + '.scaleY'))

data.append(cmds.getAttr(obj + '.scaleZ'))



writer.writerow(data)

del data

This creates a csv file at the specified directory. Be sure to enter the actual name for the csv file, not just the folder.
Also be sure to select a group of instances for export - no support for selecting a group.

In unreal, you need to setup a struct that matches the csv columns, like this:

Then make an actor and this is the code for its construction script:


You must match the static mesh names to the name that goes into the csv rows. You can parse at either maya end and/or unreal end, but there has to be some naming convention to ensure you can find the right assets.

You also must have the static meshes available in the content browser directory to begin with. This will not import those initial static meshes, it just reads position data and creates instanced static meshes for each entry.

Results: