I'm making an add-on for AO baking which among other things joins multiple objects into one, bake the AO, and then delete the joined object that is only used for baking:
#BAKE
bpy.ops.object.bake('INVOKE_DEFAULT', type='AO')
#DELETE JOINED OBJECTS IF NECESSARY
if multiple_obj == True:
bpy.data.objects.remove(joined_object)
I'm able to do just that without using INVOKE_DEFAULT
but I don't get a progress bar.
If I do use INVOKE_DEFAULT
I run into a problem where what comes after this line bpy.ops.object.bake('INVOKE_DEFAULT', type='AO')
is being run while the baking is still in progress.
How do I keep the progress bar (or create my own) and stop the script for running until the baking operator has finished it's job?
Alternatively how could I use INVOKE_DEFAULT
and have some kind of loop next in the code that would check if baking is over until running the rest of the script?
Both those solutions would work fine for me.