When I am writing procedural drawing code (implementing _draw()), I always have the problem how to preview things quickly and easily in the editor while I am writing and tweaking the code.
What I have tried:
run the current scene with F6 (Wait a second for the window to open, close the window. A hundred times.)
close and re-open the current scene (Ctrl-S, Ctrl-Shift-W, Ctrl-Shift-T)
add @tool, and put queue_redraw() in the _process() function: instant updates, but hazardous (danger of slowing down or crashing the editor)
That’s all really clunky. So I was wondering if anyone has a nice workflow when working on procedural drawing code.
Do you mean, calling queue_redraw() from within _draw(), so it would endlessly trigger redraws? I just tried that, and it seems to have no effect. I guess you can only trigger a redraw from outside _draw().
Even so, how would that be safer than putting it in _process()?
I’m assuming you are taking some sort of input, running a function to transform some data, and your _draw call is then using that data. If the queue redraw goes in the function that transforms the data, then it only redraws when it is getting input that necessitates a redraw. I’m making an assumption about how your project is structured, so I might be completely off base.
Ah, yes, that‘s how it would eventually work when running the game. Right now I am just looking for a way to quickly preview changes to my drawing code in the editor, before adding interaction. But I guess I could add some temporary input handling to trigger a redraw on keypress. That‘s an idea I will try out. Thanks!