From 92d962ab75c4399f45e4beadf21bdb198c57e94a Mon Sep 17 00:00:00 2001 From: br1trs <88297220+br1trs@users.noreply.github.com> Date: Mon, 29 May 2023 23:17:31 -0600 Subject: [PATCH] delete get_root() handling quit requests multiple resolutions change scenes manually scene tree --- tutorials/inputs/handling_quit_requests.rst | 2 +- tutorials/rendering/multiple_resolutions.rst | 2 +- tutorials/scripting/change_scenes_manually.rst | 8 ++++---- tutorials/scripting/scene_tree.rst | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tutorials/inputs/handling_quit_requests.rst b/tutorials/inputs/handling_quit_requests.rst index 2ce7a77ec..73aff7137 100644 --- a/tutorials/inputs/handling_quit_requests.rst +++ b/tutorials/inputs/handling_quit_requests.rst @@ -78,7 +78,7 @@ program termination, you should send the notification yourself: .. tabs:: .. code-tab:: gdscript GDScript - get_tree().get_root().propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST) + get_tree().root.propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST) .. code-tab:: csharp diff --git a/tutorials/rendering/multiple_resolutions.rst b/tutorials/rendering/multiple_resolutions.rst index b5c859096..7e125ca7d 100644 --- a/tutorials/rendering/multiple_resolutions.rst +++ b/tutorials/rendering/multiple_resolutions.rst @@ -109,7 +109,7 @@ little easier. The :ref:`Viewport ` node has several functions to handle resizing, and the root node of the scene tree is always a viewport (scenes loaded are instanced as a child of it, and it can always be accessed by calling -``get_tree().get_root()`` or ``get_node("/root")``). +``get_tree().root`` or ``get_node("/root")``). In any case, while changing the root Viewport params is probably the most flexible way to deal with the problem, it can be a lot of work, diff --git a/tutorials/scripting/change_scenes_manually.rst b/tutorials/scripting/change_scenes_manually.rst index f2d6ccd11..a41b2dcc8 100644 --- a/tutorials/scripting/change_scenes_manually.rst +++ b/tutorials/scripting/change_scenes_manually.rst @@ -17,7 +17,7 @@ scenes which one instances and adds to the tree at runtime: func _add_a_scene_manually(): # This is like autoloading the scene, only # it happens after already loading the main scene. - get_tree().get_root().add_child(simultaneous_scene) + get_tree().root.add_child(simultaneous_scene) .. code-tab:: csharp @@ -32,7 +32,7 @@ scenes which one instances and adds to the tree at runtime: { // This is like autoloading the scene, only // it happens after already loading the main scene. - GetTree().GetRoot().AddChild(simultaneousScene); + GetTree().Root.AddChild(simultaneousScene); } To complete the cycle and swap out the new scene with the old one, @@ -124,11 +124,11 @@ a scene's data between scene changes (adding the scene to the root node). .. tabs:: .. code-tab:: gdscript GDScript - get_tree().get_root().add_child(scene) + get_tree().root.add_child(scene) .. code-tab:: csharp - GetTree().GetRoot().AddChild(scene); + GetTree().Root.AddChild(scene); Perhaps instead they wish to display multiple scenes at the same time using :ref:`SubViewportContainers `. This is optimal in diff --git a/tutorials/scripting/scene_tree.rst b/tutorials/scripting/scene_tree.rst index 943230efc..6a30f0503 100644 --- a/tutorials/scripting/scene_tree.rst +++ b/tutorials/scripting/scene_tree.rst @@ -69,12 +69,12 @@ two different ways: .. tabs:: .. code-tab:: gdscript GDScript - get_tree().get_root() # Access via scene main loop. + get_tree().root # Access via scene main loop. get_node("/root") # Access via absolute path. .. code-tab:: csharp - GetTree().GetRoot(); // Access via scene main loop. + GetTree().Root // Access via scene main loop. GetNode("/root"); // Access via absolute path. This node contains the main viewport. Anything that is a child of a