The Goal
I'm writing a Blender add-on that extracts a point cloud from multiple photos. This operation is implemented as an Operator that is invoked from a Panel button. This Operator, once started takes a lot of time to finish.
I would like to inform the user about the progress of the operation, via some kind of status text. What is the best way to script this?
What I've Tried Already
Currently, I have a status message label in the Panel which invokes the "Start SFM" Operator. This displays the text stored in a Scene Property called currentStatus.
In my Operator's Execute method, I do this:
def execute(self, context):
thr = threading.Thread(target=self.foo, args=(context,))
thr.start()
return {'FINISHED'}
And in the time-consuming method foo, I update currentStatus:
def foo(self, context):
context.scene.currentStatus = "Starting..."
# Time consuming operation 1
context.scene.currentStatus = "Operation 1 Completed"
# Time consuming operation 2
context.scene.currentStatus = "Operation 2 Completed"
...
The problem with this is that the label only updates when it is moused over or if the user clicks on the scene. It does not redraw automatically. I have failed at several attempts to force a redraw through python. I have tried polling, but it behaves similarly.
Am I missing something, or is this a completely wrong way to approach the problem?