20tab / UnrealEnginePython

Embed Python in Unreal Engine 4
MIT License
2.74k stars 743 forks source link

Force FBX/Asset Import #79

Closed LarsGroh closed 7 years ago

LarsGroh commented 7 years ago

Is there away to force the asset import even though the respective static mesh already existst?

I need to do this as the re-import process is inconsistent when there is a change in the material assignment in the original maya file. For a single import this would not be a problem - but I need to run several hundreds of imports. And having the user to accept each import is not really an option.

rdeioris commented 7 years ago

We have a custom factory for fbx here: https://github.com/20tab/UnrealEnginePython/blob/master/Source/PythonConsole/Public/PyFbxFactory.h

if you use it instead of the classic FBXFactory you will shut-down the dialog window

LarsGroh commented 7 years ago

Hi, I am actually already using that factory:

factory = ue.find_class('PyFbxFactory')
asset = ue.import_asset(filename, asset_path, factory)

But the UI still pops up if there is an already imported asset under the "asset_path". Note: Im not using asset.reimport() on purpose as that approach causses issues with changing material assignments - as noted above.

sinokgr commented 7 years ago

I assume you mean this window right? image I was planning to use asset.reimport() myself but you've raised a very valid point.. hm

LarsGroh commented 7 years ago

Yes! I mean exaclty that window ;-)

rdeioris commented 7 years ago

Check here for an update example: https://github.com/20tab/UnrealEnginePython/blob/master/examples/kaiju_builder.py#L20