0
$\begingroup$

I'm wondering if there's a way to programmatically open Blender (2.79)'s FBX exporter UI with Python script.

Basically, what I'm trying to make is a script which, when ran:

  • Modifies all the UVs for each selected mesh.
  • Opens the existing FBX exporter and allows the user to export the modified mesh.
  • Once the user closes the FBX exporter window, for the mesh to revert back to its original state prior to running the script.

I know there's a way to export FBX in script using bpy.ops.export_scene.fbx, but I was wondering if it was possible to open the UI's FBX exporter instead.

Thank you so much in advance!

$\endgroup$
2
$\begingroup$

Use bpy.ops.export_scene.fbx('INVOKE_DEFAULT').

More info about "Execution Contexts": https://docs.blender.org/api/2.79/bpy.ops.html?highlight=invoke#execution-context

I'm not sure what the best way to run something after the operator is complete is though. Maybe try: Running code after a modal operator finished its job

$\endgroup$
2
  • $\begingroup$ Ooh thanks! The 'INVOKE_DEFAULT' did exactly what I wanted! I'll look into the post modal operator execution this weekend and report my findings. $\endgroup$
    – Milun
    Sep 3 '20 at 14:50
  • $\begingroup$ Hm... I tried your suggestion of running things after the modal operator, but what happened was it would fire directly after the export_scene.fbx (so basically, the UI to export the FBX appears, and then the next step (which needs to happen after the user exports) fires while they're still typing in a filename). Basically what I wanted was for my temporary dupes to get removed after they were exported. I'm not so good with Blender Python, so my "quick fix" for the meantime is to just make any temporary dupes get placed in a different layer. $\endgroup$
    – Milun
    Sep 5 '20 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.