Reimport With New File - Python

First time posting here, so I will do my best to describe my issue.

In Unreal you can right-click an asset in the content browser and select “Reimport With New File”, which reimports the asset pointing to a different source I believe?

I am trying to replicate that behaviour using Python and on an fbx asset. For example a rock fbx where I can change the source to the most recent version e.g. rock_0002 and so on.

I have already managed to import the fbx, but haven’t managed to reimport pointing to a new source. I have googled every query I can think of but I haven’t found anything. In the python api there seems to be a factory here.

Any help would be appreciated and code examples would be even better.

I don’t know python, so I’m answer generally. The simplest solution is just to change the source file variable to something else, then run a regular reimport. So if you know how to change that variable and do a reimport from python, then that’s all you need.

@midgunner66 thanks for your response!

That is my current implementation, the problem if that it imports it as a new asset and doesn’t overwrite the previous version fbx. At which point I can do a script or manual delete of that fbx, not ideal but it works for now.

Have you tried this?

I’ve imported assets using blueprints before, and this was one of those options (and it worked).

I have indeed tried that. The problem is the filename, as soon as that is changed from say rock_001 to rock_002 it imports it as a separate fbx.

Have you set the destination_name to to the exact same name as the asset you’re trying to overwrite? E.g. if the asset is called rock_001, your reimport should also import as rock_001, even though the new file is rock_002.

@midgunner66 sorry for the late response, been off work for a few days.

I believe you have solved it for me! Thank you ever so much. Next I am going to tackle importing of an FBX scene, wish me luck!

1 Like