godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.96k stars 21.07k forks source link

draw() signal is emitted twice on Control Nodes but not Node2d #97507

Open gitsomebit opened 1 week ago

gitsomebit commented 1 week ago

Tested versions

System information

Windows 10 - Godot 4.3

Issue description

The draw signal is emitted twice instead of once for Control nodes. For Node2d it is still emitted once (like in previous version 4.2 stable).

Steps to reproduce

create a new scene with a Control node and bind the draw signal to a function. it will emitt twice

extends Control

func _ready() -> void:
    $".".draw.connect(control_is_drawn)

func control_is_drawn() -> void:
    print("control_is_drawn")

Minimal reproduction project (MRP)

MRP: double_draw_4.3.zip

gitsomebit commented 1 week ago

I did some more investigating and found that the behaviour of the sorting signal changed as well from 4.2 to 4.3 with less sorting taking place in 4.3 (maybe to the detrement of more drawing)

MRP: node_sorting.zip

running the MRP will result in diffrent output for 4.2 and 4.3: 4 2 4 3

AThousandShips commented 1 week ago

The double draw is fixed by:

Please open a separate issue for the sorting part