RenderEffects Progress Callback Mechanism

You can control the main RenderEffects dialog progress bar using an on apply handler with progressCB, the progress callback interface object. The following syntax lets you do this:

on apply <bitmap> progressCB: do <fn>

The first argument is the bitmap value to be modified by the effect, and progressCB is a progress callback interface object. This interface has several methods you can call during the course of processing the bitmap that control the progress bar and check for user cancellation.

Methods

progressCB.setTitle <string>

Sets the title on the progress bar.

progressCB.progress <done> <total>

Indicates the progress of the rendering. Both arguments are integers; done indicates how much of the rendering has been completed, and total indicates how much there is to do.

When this is called, the main render effects progress bar is updated to reflect this progress. This function also returns a boolean, which if true indicates that the user has hit the escape key to cancel the effect rendering.

progressCB.check()

Indicates whether the user has hit the escape key to cancel the effect rendering. This function returns a boolean; false if processing should continue, and true if the user has cancelled the rendering.

Example:

on apply bm progressCB: do

(

à

progressCB.setTitle "My Effect Pass1"

à

escapeEnable = false -- turn on scripter escape processing

for i in à

(

<the effect rendering loop>

à

if progressCB.progress completed total then exit

)

à

escapeEnable = true

à

)

The progress bar update is done inside the main processing loop and the check for user cancel is done on the same call, causing the loop to exit prematurely in this example.

See also