I still don't see why you can't simply call show()
on your node, if you want to find out where it is. Seems like reinventing the wheel to me... Anyways: there is no option for that. But if you really want this, you can write some _draw
-code to do it for you.
Because parent-nodes are drawn before their children, you cannot put that code to the parent node though. And because _draw
-calls are ignored when the node they belong to isn't visible, you also cannot attach it to the node in question itself.
So if your tree looks like this:
- Root-Node
- "Node1" (any Control-Node, this is the hidden one)
You want to add a second child in the end:
- Root-Node
- "Node1" (any Control-Node, this is the hidden one)
- "Node2" (any CanvasItem-Node, this is our drawing helper)
And then you can attach the following script to "Node2":
extends Control
func _draw():
draw_rect(get_node("../Node1").get_rect(), "#FF0000", false)
If "Node1" is not a Control-node, there won't be a get_rect()
-function and you have to derive the dimensions yourself using the position
- and size
-properties. "Node2" has to be a CanvasItem or there won't be a _draw
-function to override. If "Node1" is moving during runtime, you have to call the update()
-function on "Node2".