What does redraw do?

Previous topic - Next topic

Truman

I'm checking out scripts and often a standard I see has to do with redraw.

The only thing I know is that it is disabled for speed.

What does this command do exactly? How does enabling vs disabling it change anything?

RobSay

It literally determines whether or not the items being manipulated in the script will be drawn on the screen.

You can see this in the scripter console. Open a new document and then open scripter and run the following:

createText(10,10,100,100,"newTextFrame")

This will appear immediately.

Now run:

setRedraw(False)
createText(10,50,100,100,"anotherNewTextFrame")


Nothing appears on the screen - but the console reports the name of the item - this means it has been created.

Now run:

setRedraw(True)
[code]
The second frame now appears.

Basically redrawing the screen takes processing power - especially if what is being drawn is graphical such as an image. In large scripts setting redraw to false or explicitly controlling when to redraw can significantly reduce the overall time taken to execute the script the script.