Unreal - How to change the source file or source data path in an AssetImportData object

View in #engine_unreal on Slack

@speuzer: Is there any way to change or clear the “Source file” string on imported assets, using blueprint? We want to do this in bulk. Bulk editor doesn’t seem to work for this, and we can’t find a straightforward way to do it in editor script.

spencer luebbert: After further investigation, that source file path is under a sub object assigned to “AssetImportData” for a static mesh, and this can be set to any number of things. Looks like you can set it in python but I haven’t found the blueprint path for setting it, seems like there is some missing functionality around this part of the assets.

Jan Kaluza: Afaik yes, this should be possible with editor utility blueprints

Jan Kaluza: Not sure how exactly

spencer luebbert: To circle back on this, you have to use the GetEditorProperty on the AssetImportData, that gives you an object you can modify

spencer luebbert: The thing that was screwing me up, getEditorProperty returns a wildcard, and its the only way to get an AssetImportData object.So when you drag off the functions that act on AssetImportData objects, to see what auto complete thinks you can plug into them, nothing shows up

spencer luebbert: GetEditorProperty must be the only function that returns a wildcard, i can’t think of any other time I’ve seen that

Jan Kaluza: Hmm, maybe that was the only convenient way to deal with different kinds of non-related structs from different asset types

@speuzer you probably ended up finding this but since I came across it - you can uncheck “context sensitive” in the BP right click menu and search for the “Scripted Add Filename” node - this should be able to edit or add the source path for the asset (index 0 I think), and takes an input type of Asset Import Data Object, which you can directly connect to the wildcard on your “Get Editor Property (AssetImportData)”. There are a couple of other functions on the AssetImportData object too that are potentially useful like GetFirstFileName (which gets the source path of the asset, though it seems to have issues if you don’t have the source, when it tries to convert the path from relative to absolute).