Update check_children() and check_orphan_nodes()

I made them no longer be a single line.
check_children() now prints all children of /root too.
This commit is contained in:
JeremyStar™ 2024-04-06 12:56:55 +02:00
parent a58bfb23dc
commit 7b9c84b805
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -166,6 +166,13 @@ func terminate(exit_code: int = 0) -> void:
get_tree().quit(exit_code)
# Checks
func check_children() -> void: if get_tree().root.get_child_count() != 1: lwarn("There are still '" + str(get_tree().root.get_child_count()-1) + "' children active in the scene tree. Please make sure to call 'remove_child' on them in your tests.")
func check_children() -> void:
if get_tree().root.get_child_count() != 1:
lwarn("There are still '" + str(get_tree().root.get_child_count()-1) + "' children active in the scene tree. Please make sure to call 'remove_child' on them in your tests.")
lwarn("Here's a tree of /root:")
get_tree().root.print_tree_pretty()
func check_orphan_nodes() -> void: if config_print_orphan_nodes: if Performance.get_monitor(Performance.OBJECT_ORPHAN_NODE_COUNT) != 4: lwarn("There are still '" + str(Performance.get_monitor(Performance.OBJECT_ORPHAN_NODE_COUNT)-4) + "' orphan nodes loaded. Please make sure to call 'queue_free' or 'free' on them in your tests.")
func check_orphan_nodes() -> void:
if config_print_orphan_nodes:
if Performance.get_monitor(Performance.OBJECT_ORPHAN_NODE_COUNT) != 4:
lwarn("There are still '" + str(Performance.get_monitor(Performance.OBJECT_ORPHAN_NODE_COUNT)-4) + "' orphan nodes loaded. Please make sure to call 'queue_free' or 'free' on them in your tests.")