Execute a code before drawing

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By rinart73
:warning: Old Version Published before Godot 3 was released.

Is there a way to execute some code (for example adjust font ascending or draw a square) before drawing?
I tried to use:

_draw():

and

func _notification(what):
    if what==NOTIFICATION_DRAW:

But it seems that both of them are actually called after widget self-drawing. So is there any pre-draw event?

:bust_in_silhouette: Reply From: indicainkwell

edit: previous post did not answer your question at all. whoops!

There’s no pre-draw event. The thing is the draw commands are cached and then any calls to update() will update the draw commands. So in your process method or wherever set whatever data you need and then call update when you want to update your draw commands.