Announcement

Collapse
No announcement yet.

Importing assets into Unreal 4.20 using python

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Originally posted by addisonbath View Post
    has anyone else found that when importing an animation with this method, even if "import_mesh" is set to False, the mesh is still imported (if there was a mesh in the FBX of course)? I'm seeing this consistently.
    I'm having the same (or a very similar) issue where every time I import animation it brings with it a skeletal mesh. I have set both "import_mesh" and "import_as_skeletal" to False in the import options, but it still happens. For the time being I've got around it by writing some extra code that deletes the new skeletal mesh after import. It's not ideal but it's the best I've been able to come up with so far.

    Also, my code specifies I want to apply my imported animation to a particular skeletal mesh in my project. Yet on import the animation is instead connected to the new skeletal mesh that gets brought in with the animation. But as soon as the imported skeletal mesh gets deleted (with code or manually) the animation then connects to the "correct" skeletal mesh.
    Last edited by Code_Goblin; 03-07-2019, 06:19 AM.

    Leave a comment:


  • Guest's Avatar
    Guest replied
    has anyone else found that when importing an animation with this method, even if "import_mesh" is set to False, the mesh is still imported (if there was a mesh in the FBX of course)? I'm seeing this consistently.

    Leave a comment:


  • replied
    I thought I would give an update...I managed to suppress the import dialog when importing into scene by modifying the FbxSceneImportFactory.cpp by basically not showing the window and adding the import options in the same cpp (for now).

    My changes are currently hard coded (setting import parameters in code instead of an external JSON) and not fancy at all, but it does the job for me, at the moment, having an automatic import without user interaction.

    Leave a comment:


  • replied
    All my tests were in 4.21, but everything looks the same as 4.20 to me

    Leave a comment:


  • replied
    If it helps I gave up on this specific problem and just accepted that I had to click through some menus. I also had the same problem with a some other processes I am trying to automate, such as importing JSON files and assigning them for use, there are some menus that at present don't seem possible to automate. I haven't tried 4.21 yet but looking through the release notes I could not see anything Python specific but was just wondering if anyone has tried this stuff in that? I am hoping that at some point Epic will fix all these bugs as using Python is potentially a great feature but at the moment I find it is just too inconsistent to regularly use for automation.

    Leave a comment:


  • replied
    Originally posted by AlexQuevillon View Post
    After a little bit of research on UDN I found this: https://udn.unrealengine.com/questions/401847/view.html
    Doesnt sound too promising as dropping parts into a blueprint manually will make us lose the scene hierarchy as it was stored in the fbx to be loaded.

    But thanks for digging into that, Alex.

    Leave a comment:


  • replied
    Originally posted by AlexQuevillon View Post
    For now, I'm able to call the function with this code:

    Code:
    import unreal
    data = unreal.AutomatedAssetImportData()
    data.set_editor_property('destination_path', '/Game/MyNewFolder')
    data.set_editor_property('filenames', ['C:/Assets/SM_ColorCalibrator.FBX'])
    data.set_editor_property('level_to_load', '/Game/MyNewLevel')
    data.set_editor_property('replace_existing', True)
    factory = unreal.FbxSceneImportFactory()
    data.set_editor_property('factory', factory)
    unreal.AssetToolsHelpers.get_asset_tools().import_assets_automated(data)

    But I'm not able to prevent Unreal from showing the pop-up asking for the import settings.
    It does not seem to have a way to avoid GetFbxSceneImportOptions() from UFbxSceneImportFactory
    That's some progress right there. I tested and can confirm your findings. Unfortunately, when I run the code again, the replace_existing flag doesnt seem to have an effect resulting in duplicated static meshes as well the blue print class.

    Leave a comment:


  • replied
    After a little bit of research on UDN I found this: https://udn.unrealengine.com/questions/401847/view.html

    Hi Andy,

    Normally, I'd suggest using the ImportAssets commandlet as described in this thread. However, it looks like we haven't fully set up the FbxSceneImportFactory class for use through the commandlet. If you're able to make some code changes, you may be able to add that functionality in. You'd need to wrap the creation of the FBX Scene Import Options window in a conditional so that a window isn't created when UFactory::IsAutomatedImport is true, and you may want to implement UFactory::GetImportSettingsParser to parse json containing your settings and apply that to the import since you'll no longer be able to use the dialog. All of this is already working for the normal FbxFactory class, so you could look there to get an idea of how to set things up. It looks like this factory makes use of the ActorFactory as well, so that would need to be adjusted to handle automated imports.

    Otherwise, there isn't a quick workflow right now for doing batch imports of FBX files to individual blueprints. The closest thing currently supported would be to batch import the FBX files, drop all of the parts of one desired blueprint into the world, and then click Blueprints->Convert Selected Components to Blueprint Class. This will give you a generated blueprint with a component for each of the meshes you had selected, at which point you can safely delete that instance from the level.

    Best,

    Cody

    Leave a comment:


  • replied
    For now, I'm able to call the function with this code:

    Code:
    import unreal
    data = unreal.AutomatedAssetImportData()
    data.set_editor_property('destination_path', '/Game/MyNewFolder')
    data.set_editor_property('filenames', ['C:/Assets/SM_ColorCalibrator.FBX'])
    data.set_editor_property('level_to_load', '/Game/MyNewLevel')
    data.set_editor_property('replace_existing', True)
    factory = unreal.FbxSceneImportFactory()
    data.set_editor_property('factory', factory)
    unreal.AssetToolsHelpers.get_asset_tools().import_assets_automated(data)

    But I'm not able to prevent Unreal from showing the pop-up asking for the import settings.
    It does not seem to have a way to avoid GetFbxSceneImportOptions() from UFbxSceneImportFactory

    Leave a comment:


  • replied
    Originally posted by AlexQuevillon View Post
    Good Morning,

    This is the way I'm importing assets from Fbx at the moment. But, it doesn't use the 'Import Into Level' feature.
    https://www.youtube.com/watch?v=SEjOZJ-IHro
    Hope it still helps

    I'm currently working to find how to make the 'Import Into Level' work.
    I'll let you know if I manage to do something useful with it.


    Have a nice day,
    Alex
    Alex,
    Thanks for the Video. Interesting stuff.

    Let me know what you find out with the import into level. Looking forward to your update.

    Cheers.

    Leave a comment:


  • replied
    Good Morning,

    This is the way I'm importing assets from Fbx at the moment. But, it doesn't use the 'Import Into Level' feature.
    https://www.youtube.com/watch?v=SEjOZJ-IHro
    Hope it still helps

    I'm currently working to find how to make the 'Import Into Level' work.
    I'll let you know if I manage to do something useful with it.


    Have a nice day,
    Alex

    Leave a comment:


  • replied
    Hi Ro-Su-,

    Do you have any more input on how to rebuild the 'import into level' functionality in python without an UI popping up? I can also confirm that task.options = unreal.FbxSceneImportOptions() does not do what you would expect as it just does a static mesh import without building a blueprint and retaining the scene hierarchy.

    Maybe we are just using it wrong?

    There seems to be no proper example out there and the documentation doesnt help, really to understand how that feature is supposed to be used. I am not an engine programmer, so it is pretty hard to get a grip on that topic.

    Some more help and direction would be much appreciated. Thank you.

    Leave a comment:


  • replied
    you can go to through this link for more information about it <ahref="https://github.com/20tab/UnrealEnginePython/blob/master/Source/UnrealEnginePython/UnrealEnginePython.Build.cs#L10"</a>
    and also visit:<a href="https://samtechnology.org/download-adobe-photoshop-cs6-free-windows/"></a>

    Leave a comment:


  • replied
    I can confirm that using task.options = unreal.FbxSceneImportOptions() does not work as expected. It seems to do a standard static mesh import. This would be great to have working in Python.

    Leave a comment:


  • replied
    you were right the issue was with the drive permission setting, now I have to edit the setting and after changing the access permission I am able to access my hard drive. To get the solution go here https://www.hptechsupportnumbers.com...-disk-problem/

    Leave a comment:

Working...
X