From 5373b67e2aa1bb21555b320e255d97e733e4e3f3 Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Sun, 18 Jun 2023 20:44:22 +0200 Subject: [PATCH] Respect returned bool from virtual process methods in SceneTree SceneTree overrides the virtual `process` and `physics_process` methods that it inherits from MainLoop. These methods return a boolean that determines if the main loop should end. The SceneTree was ignoring the returned boolean, so scripts inheriting from SceneTree that override these methods and return true didn't exit the main loop. Now the boolean is checked. --- scene/main/scene_tree.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 9d7e40db576..6eec6b83713 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -456,7 +456,9 @@ bool SceneTree::physics_process(double p_time) { flush_transform_notifications(); - MainLoop::physics_process(p_time); + if (MainLoop::physics_process(p_time)) { + _quit = true; + } physics_process_time = p_time; emit_signal(SNAME("physics_frame")); @@ -484,7 +486,9 @@ bool SceneTree::physics_process(double p_time) { bool SceneTree::process(double p_time) { root_lock++; - MainLoop::process(p_time); + if (MainLoop::process(p_time)) { + _quit = true; + } process_time = p_time;