I am currently writing a python script and call a modal operator of an external addon like this:
bpy.ops.uvpackmaster2.uv_pack("INVOKE_DEFAULT")
My problem now is, that this call only returns {'RUNNING_MODAL'} but I need to wait till this is finished before I run other tasks. Furthermore this operator can also fail - or let's not say fail, it can require further action and a further run.
I am looking for something like the 'addEventListerner' known from JavaScript or anything like that. I am very known to programming but kind of new to python. Is there something similar I can use?
Also, the second part of the question: I use the addon UVPackmaster2. If I invoke the uv_pack function the addon at first checks if there are some problems with the uv_map, if so the problematic faces get selected. If there are no problems the packing process starts and ends after a few seconds/minutes.
It looks like there is no specific output I can use to determine if the process requires further investigation or if it run properly. I only thing I saw, was that the plugin puts output on the report via self.report(...). But I really don't like the idea to parse the report output to get the information in which state the process is. Do you have any better ideas? Or how I could patch the addon to support me with useful output? But I don't know how a modal operator should communicate with my script.
I allready found this Running code after a modal operator finished its job but I really don't understand how the example works. And how I could adapt this to my problem.
thanks and best regards!
for ob in obs: bpy.ops.object.select_all(action='DESELECT') # Deselect all objects
bpy.context.view_layer.objects.active = ob if ob: ob.select_set(True)
but my loop is not waiting the remesher op to finish.
– ttsesm Apr 09 '21 at 00:51