I need to programmatically export the UVs of a lot of .objs. I am using the bpy.ops.uv.export_layout() fn.
Since this step is part of a more complex pipeline, I am launching Python from the command line passing the script as a -P parameter.
I run into a pretty important issue: if I launch Blender manually and run the script, or from a terminal as explained above, I obtain two different images. I am using the same parameters while exporting.
I run some tests on Suzanne. Here are the images:
The difference is especially clear if you check their alpha channels:
You will see that in the command line one the wire is visible in the alpha, and this breaks the rest of the workflow that I need to perform on the image.
Any idea on what's going on? Thank you!
Ps: here's a minimal example script to replicate the issue.
Set the export path. On Macos, launch with "blender_path -P script_path". Comment last line when launching from Blender!
import bpy output_path = "YOUR_EXPORT_PATH_HERE" if __name__ == "__main__": for o in bpy.data.objects: bpy.data.objects.remove(o, do_unlink=True) bpy.ops.mesh.primitive_monkey_add(enter_editmode=True, location=(0, 0, 0)) bpy.ops.uv.export_layout(filepath=str(output_path), export_all=False, modified=False, mode='PNG', size=(1024, 1024), opacity=1) print ("Done") bpy.ops.wm.quit_blender()