From ef9738005aae82e3e633c41c924279e5c5021700 Mon Sep 17 00:00:00 2001
From: Break <80194912+Break-Ben@users.noreply.github.com>
Date: Sat, 8 Nov 2025 12:22:34 +0800
Subject: [PATCH] Separate Node editor dock
---
doc/classes/EditorFeatureProfile.xml | 10 +-
doc/classes/EditorSettings.xml | 4 +-
doc/classes/Node.xml | 2 +-
doc/classes/Object.xml | 2 +-
doc/classes/Timer.xml | 2 +-
editor/docks/groups_dock.cpp | 57 ++++++++
editor/docks/groups_dock.h | 50 +++++++
editor/docks/node_dock.cpp | 137 -------------------
editor/docks/scene_tree_dock.cpp | 9 +-
editor/docks/signals_dock.cpp | 62 +++++++++
editor/docks/{node_dock.h => signals_dock.h} | 35 ++---
editor/editor_node.cpp | 45 +++---
editor/scene/connections_dialog.cpp | 31 ++---
editor/scene/connections_dialog.h | 4 +-
editor/scene/scene_tree_editor.cpp | 9 +-
editor/script/script_editor_plugin.cpp | 6 +-
editor/settings/editor_feature_profile.cpp | 18 ++-
editor/settings/editor_feature_profile.h | 4 +
modules/mono/csharp_script.cpp | 4 +-
19 files changed, 268 insertions(+), 223 deletions(-)
create mode 100644 editor/docks/groups_dock.cpp
create mode 100644 editor/docks/groups_dock.h
delete mode 100644 editor/docks/node_dock.cpp
create mode 100644 editor/docks/signals_dock.cpp
rename editor/docks/{node_dock.h => signals_dock.h} (73%)
diff --git a/doc/classes/EditorFeatureProfile.xml b/doc/classes/EditorFeatureProfile.xml
index c125c923efb..33d9d4cf96a 100644
--- a/doc/classes/EditorFeatureProfile.xml
+++ b/doc/classes/EditorFeatureProfile.xml
@@ -109,7 +109,7 @@
Scene tree editing. If this feature is disabled, the Scene tree dock will still be visible but will be read-only.
-
+
The Node dock. If this feature is disabled, signals and groups won't be visible and modifiable from the editor.
@@ -124,7 +124,13 @@
The Game tab, which allows embedding the game window and selecting nodes by clicking inside of it. If this feature is disabled, the Game tab won't display.
-
+
+ The Signals dock. If this feature is disabled, signals won't be visible and modifiable from the editor.
+
+
+ The Groups dock. If this feature is disabled, groups won't be visible and modifiable from the editor.
+
+
Represents the size of the [enum Feature] enum.
diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml
index eb9b0d8516b..57b0ed7d61d 100644
--- a/doc/classes/EditorSettings.xml
+++ b/doc/classes/EditorSettings.xml
@@ -1453,7 +1453,7 @@
If [code]true[/code], the caret will be moved when right-clicking somewhere in the script editor (like when left-clicking or middle-clicking). If [code]false[/code], the caret will only be moved when left-clicking or middle-clicking somewhere.
- If [code]true[/code], opens the script editor when connecting a signal to an existing script method from the Node dock.
+ If [code]true[/code], opens the script editor when connecting a signal to an existing script method from the Signals dock.
If [code]true[/code], allows scrolling past the end of the file.
@@ -1485,7 +1485,7 @@
If [code]true[/code], automatically adds [url=$DOCS_URL/tutorials/scripting/gdscript/static_typing.html]GDScript static typing[/url] (such as [code]-> void[/code] and [code]: int[/code]) in many situations where it's possible to, including when:
- Accepting a suggestion from code autocompletion;
- Creating a new script from a template;
- - Connecting signals from the Node dock;
+ - Connecting signals from the Signals dock;
- Creating variables prefixed with [annotation @GDScript.@onready], by dropping nodes from the Scene dock into the script editor while holding [kbd]Ctrl[/kbd].
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index 902c9fd5267..17fb8172b46 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -196,7 +196,7 @@
Adds the node to the [param group]. Groups can be helpful to organize a subset of nodes, for example [code]"enemies"[/code] or [code]"collectables"[/code]. See notes in the description, and the group methods in [SceneTree].
- If [param persistent] is [code]true[/code], the group will be stored when saved inside a [PackedScene]. All groups created and displayed in the Node dock are persistent.
+ If [param persistent] is [code]true[/code], the group will be stored when saved inside a [PackedScene]. All groups created and displayed in the Groups dock are persistent.
[b]Note:[/b] To improve performance, the order of group names is [i]not[/i] guaranteed and may vary between project runs. Therefore, do not rely on the group order.
[b]Note:[/b] [SceneTree]'s group methods will [i]not[/i] work on this node if not inside the tree (see [method is_inside_tree]).
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index d6ce0419f40..42c9cca8d4e 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -1040,7 +1040,7 @@
Deferred connections trigger their [Callable]s on idle time (at the end of the frame), rather than instantly.
- Persisting connections are stored when the object is serialized (such as when using [method PackedScene.pack]). In the editor, connections created through the Node dock are always persisting.
+ Persisting connections are stored when the object is serialized (such as when using [method PackedScene.pack]). In the editor, connections created through the Signals dock are always persisting.
One-shot connections disconnect themselves after emission.
diff --git a/doc/classes/Timer.xml b/doc/classes/Timer.xml
index b425b29bfe7..e6562523c4d 100644
--- a/doc/classes/Timer.xml
+++ b/doc/classes/Timer.xml
@@ -6,7 +6,7 @@
The [Timer] node is a countdown timer and is the simplest way to handle time-based logic in the engine. When a timer reaches the end of its [member wait_time], it will emit the [signal timeout] signal.
After a timer enters the scene tree, it can be manually started with [method start]. A timer node is also started automatically if [member autostart] is [code]true[/code].
- Without requiring much code, a timer node can be added and configured in the editor. The [signal timeout] signal it emits can also be connected through the Node dock in the editor:
+ Without requiring much code, a timer node can be added and configured in the editor. The [signal timeout] signal it emits can also be connected through the Signals dock in the editor:
[codeblock]
func _on_timer_timeout():
print("Time to attack!")
diff --git a/editor/docks/groups_dock.cpp b/editor/docks/groups_dock.cpp
new file mode 100644
index 00000000000..d82e5be7cf9
--- /dev/null
+++ b/editor/docks/groups_dock.cpp
@@ -0,0 +1,57 @@
+/**************************************************************************/
+/* groups_dock.cpp */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/**************************************************************************/
+
+#include "groups_dock.h"
+
+#include "editor/settings/editor_command_palette.h"
+#include "editor/themes/editor_scale.h"
+
+void GroupsDock::set_selection(const Vector &p_nodes) {
+ groups->set_selection(p_nodes);
+}
+
+GroupsDock::GroupsDock() {
+ singleton = this;
+ set_name(TTRC("Groups"));
+ set_icon_name("Groups");
+ set_dock_shortcut(ED_SHORTCUT_AND_COMMAND("docks/open_groups", TTRC("Open Groups Dock")));
+ set_default_slot(DockConstants::DOCK_SLOT_RIGHT_UL);
+
+ VBoxContainer *main_vb = memnew(VBoxContainer);
+ add_child(main_vb);
+
+ groups = memnew(GroupsEditor);
+ main_vb->add_child(groups);
+ groups->set_v_size_flags(SIZE_EXPAND_FILL);
+}
+
+GroupsDock::~GroupsDock() {
+ singleton = nullptr;
+}
diff --git a/editor/docks/groups_dock.h b/editor/docks/groups_dock.h
new file mode 100644
index 00000000000..80188c8eb5d
--- /dev/null
+++ b/editor/docks/groups_dock.h
@@ -0,0 +1,50 @@
+/**************************************************************************/
+/* groups_dock.h */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/**************************************************************************/
+
+#pragma once
+
+#include "editor/docks/editor_dock.h"
+#include "editor/docks/groups_editor.h"
+
+class GroupsDock : public EditorDock {
+ GDCLASS(GroupsDock, EditorDock);
+
+ GroupsEditor *groups = nullptr;
+
+ static inline GroupsDock *singleton = nullptr;
+
+public:
+ static GroupsDock *get_singleton() { return singleton; }
+
+ void set_selection(const Vector &p_nodes);
+
+ GroupsDock();
+ ~GroupsDock();
+};
diff --git a/editor/docks/node_dock.cpp b/editor/docks/node_dock.cpp
deleted file mode 100644
index d70fb701e22..00000000000
--- a/editor/docks/node_dock.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/**************************************************************************/
-/* node_dock.cpp */
-/**************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/**************************************************************************/
-/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/**************************************************************************/
-
-#include "node_dock.h"
-
-#include "core/io/config_file.h"
-#include "editor/scene/connections_dialog.h"
-#include "editor/settings/editor_command_palette.h"
-#include "editor/themes/editor_scale.h"
-
-void NodeDock::show_groups() {
- groups_button->set_pressed(true);
- connections_button->set_pressed(false);
- groups->show();
- connections->hide();
-}
-
-void NodeDock::show_connections() {
- groups_button->set_pressed(false);
- connections_button->set_pressed(true);
- groups->hide();
- connections->show();
-}
-
-void NodeDock::save_layout_to_config(Ref &p_layout, const String &p_section) const {
- p_layout->set_value(p_section, "current_tab", int(groups_button->is_pressed()));
-}
-
-void NodeDock::load_layout_from_config(const Ref &p_layout, const String &p_section) {
- const int current_tab = p_layout->get_value(p_section, "current_tab", 0);
- if (current_tab == 0) {
- show_connections();
- } else if (current_tab == 1) {
- show_groups();
- }
-}
-
-void NodeDock::_notification(int p_what) {
- switch (p_what) {
- case NOTIFICATION_THEME_CHANGED: {
- connections_button->set_button_icon(get_editor_theme_icon(SNAME("Signals")));
- groups_button->set_button_icon(get_editor_theme_icon(SNAME("Groups")));
- } break;
- }
-}
-
-void NodeDock::update_lists() {
- connections->update_tree();
-}
-
-void NodeDock::set_selection(const Vector