Draw on a certain "path"?

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

Hello everyone!

I have the following structure:
-Panel
–TextureFrame
–Control1 (All controls have children)
–Control2
–Control3
–Control4

I use draw_line() in the Panel’s script to draw some figures in the screen. My problem is that they are drawn under everything so if I want to see the figures, I have to hide the TextureFrame.

My drawing function needs to use Controls’ positions, so that’s why I use it in the Panel.

What can I do to draw on top of the TextureFrame?

Any help is greatly appreciated, greetings!

:bust_in_silhouette: Reply From: Not_a_Robot

StraToN @#godotengine gave the solution:

Create a new control that will have the drawing code and place it on top of the TextureFrame (or on below in the editor) like so:

-Panel
--TextureFrame
--DrawingControl
--Control1 (All controls have children)
--Control2
--Control3
--Control4

And then attach the code of the drawing (the code Panel used) to the DrawingControl.

Replace the part that gets Control’s position using

 get_node("../brother_control")

Enjoy!