How to import FBX/GLTF/OBJ via extension API?

I want to import some FBX files with my Omniverse Create extension, but could not find any documentation on it. I am using the Python API. Any suggestions?

Hello @user64437! Here is a link to our Kit Python Programming Manual. Let me know if this helps!

Hello @user64437 ,

Sorry this is coming a little late. I was able to import OBJ files by adding the kit asset_converter as a dependency in my extension.toml file:

[dependencies]
"omni.kit.asset_converter" = {}

which then let me import that module.

I then used snippets from the automated tests in the Omniverse codebase to run the converter. I am not really happy to post the code I wrote to achieve this, as I’m aware that it breaks something in the event loop of the Omniverse! (something I will be fixing when I get time).

However, on my travels I found this snippet, which I have added details to in bold (edit: bold ** notation appears not to work in code blocks - my additions are between pairs of stars):

async def convert(**test_data_path, output_path**):
    task_manger = converter.get_instance()
    **context = omni.kit.asset_converter.AssetConverterContext()**
    task = task_manger.create_converter_task(**test_data_path, output_path, None, context**)
    success = await task.wait_until_finished()
    if not success:
        detailed_status_code = task.get_status()
        detailed_status_error_string = task.get_detailed_error()

I’ve not tried that code, but it is similar to my approach (which works well enough for me, for now).

If you have trouble, feel free to send me a PM and I will share the code that I am not fully happy with.

All the best,

Oliver