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 &p_objects) { - connections->set_selection(p_objects); - - Vector nodes; - for (Object *obj : p_objects) { - Node *n = Object::cast_to(obj); - if (n) { - nodes.append(n); - } - } - groups->set_selection(nodes); -} - -NodeDock::NodeDock() { - singleton = this; - set_name(TTRC("Node")); - set_icon_name("Object"); - set_dock_shortcut(ED_SHORTCUT_AND_COMMAND("docks/open_node", TTRC("Open Node Dock"))); - set_default_slot(DockConstants::DOCK_SLOT_RIGHT_UL); - - VBoxContainer *main_vb = memnew(VBoxContainer); - add_child(main_vb); - - mode_hb = memnew(HBoxContainer); - main_vb->add_child(mode_hb); - - connections_button = memnew(Button); - connections_button->set_theme_type_variation(SceneStringName(FlatButton)); - connections_button->set_text(TTRC("Signals")); - connections_button->set_toggle_mode(true); - connections_button->set_h_size_flags(SIZE_EXPAND_FILL); - connections_button->set_clip_text(true); - mode_hb->add_child(connections_button); - connections_button->connect(SceneStringName(pressed), callable_mp(this, &NodeDock::show_connections)); - - groups_button = memnew(Button); - groups_button->set_theme_type_variation(SceneStringName(FlatButton)); - groups_button->set_text(TTRC("Groups")); - groups_button->set_toggle_mode(true); - groups_button->set_h_size_flags(SIZE_EXPAND_FILL); - groups_button->set_clip_text(true); - mode_hb->add_child(groups_button); - groups_button->connect(SceneStringName(pressed), callable_mp(this, &NodeDock::show_groups)); - - connections = memnew(ConnectionsDock); - main_vb->add_child(connections); - connections->set_v_size_flags(SIZE_EXPAND_FILL); - connections->hide(); - - groups = memnew(GroupsEditor); - main_vb->add_child(groups); - groups->set_v_size_flags(SIZE_EXPAND_FILL); - groups->hide(); - - show_connections(); -} - -NodeDock::~NodeDock() { - singleton = nullptr; -} diff --git a/editor/docks/scene_tree_dock.cpp b/editor/docks/scene_tree_dock.cpp index 5c1ec869ad7..c2713a1f5da 100644 --- a/editor/docks/scene_tree_dock.cpp +++ b/editor/docks/scene_tree_dock.cpp @@ -38,8 +38,9 @@ #include "editor/animation/animation_player_editor_plugin.h" #include "editor/debugger/editor_debugger_node.h" #include "editor/docks/filesystem_dock.h" +#include "editor/docks/groups_dock.h" #include "editor/docks/inspector_dock.h" -#include "editor/docks/node_dock.h" +#include "editor/docks/signals_dock.h" #include "editor/editor_main_screen.h" #include "editor/editor_node.h" #include "editor/editor_string_names.h" @@ -1351,7 +1352,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { undo_redo->add_undo_method(node, "set_scene_file_path", node->get_scene_file_path()); _node_replace_owner(node, node, root); _node_strip_signal_inheritance(node); - NodeDock::get_singleton()->set_selection(Vector{ node }); // Refresh. + SignalsDock::get_singleton()->set_object(node); // Refresh. + GroupsDock::get_singleton()->set_selection(Vector{ node }); // Refresh. undo_redo->add_do_method(scene_tree, "update_tree"); undo_redo->add_undo_method(scene_tree, "update_tree"); undo_redo->commit_action(); @@ -2855,7 +2857,8 @@ void SceneTreeDock::_delete_confirm(bool p_cut) { editor_history->cleanup_history(); InspectorDock::get_singleton()->call("_prepare_history"); InspectorDock::get_singleton()->update(nullptr); - NodeDock::get_singleton()->set_selection(Vector{}); + SignalsDock::get_singleton()->set_object(nullptr); + GroupsDock::get_singleton()->set_selection(Vector()); } void SceneTreeDock::_update_script_button() { diff --git a/editor/docks/signals_dock.cpp b/editor/docks/signals_dock.cpp new file mode 100644 index 00000000000..28fb078f9f2 --- /dev/null +++ b/editor/docks/signals_dock.cpp @@ -0,0 +1,62 @@ +/**************************************************************************/ +/* signals_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 "signals_dock.h" + +#include "editor/scene/connections_dialog.h" +#include "editor/settings/editor_command_palette.h" +#include "editor/themes/editor_scale.h" + +void SignalsDock::update_lists() { + connections->update_tree(); +} + +void SignalsDock::set_object(Object *p_object) { + connections->set_object(p_object); +} + +SignalsDock::SignalsDock() { + singleton = this; + set_name(TTRC("Signals")); + set_icon_name("Signals"); + set_dock_shortcut(ED_SHORTCUT_AND_COMMAND("docks/open_signals", TTRC("Open Signals Dock"))); + set_default_slot(DockConstants::DOCK_SLOT_RIGHT_UL); + + VBoxContainer *main_vb = memnew(VBoxContainer); + add_child(main_vb); + + connections = memnew(ConnectionsDock); + main_vb->add_child(connections); + connections->set_v_size_flags(SIZE_EXPAND_FILL); +} + +SignalsDock::~SignalsDock() { + singleton = nullptr; +} diff --git a/editor/docks/node_dock.h b/editor/docks/signals_dock.h similarity index 73% rename from editor/docks/node_dock.h rename to editor/docks/signals_dock.h index aca2705f327..77004eaec49 100644 --- a/editor/docks/node_dock.h +++ b/editor/docks/signals_dock.h @@ -1,5 +1,5 @@ /**************************************************************************/ -/* node_dock.h */ +/* signals_dock.h */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -31,42 +31,23 @@ #pragma once #include "editor/docks/editor_dock.h" -#include "groups_editor.h" -class ConfigFile; class ConnectionsDock; -class NodeDock : public EditorDock { - GDCLASS(NodeDock, EditorDock); - - Button *connections_button = nullptr; - Button *groups_button = nullptr; +class SignalsDock : public EditorDock { + GDCLASS(SignalsDock, EditorDock); ConnectionsDock *connections = nullptr; - GroupsEditor *groups = nullptr; - HBoxContainer *mode_hb = nullptr; - -private: - inline static NodeDock *singleton = nullptr; + static inline SignalsDock *singleton = nullptr; public: - static NodeDock *get_singleton() { return singleton; } + static SignalsDock *get_singleton() { return singleton; } -protected: - void _notification(int p_what); - - virtual void save_layout_to_config(Ref &p_layout, const String &p_section) const override; - virtual void load_layout_from_config(const Ref &p_layout, const String &p_section) override; - -public: - void set_selection(const Vector &p_objects); - - void show_groups(); - void show_connections(); + void set_object(Object *p_object); void update_lists(); - NodeDock(); - ~NodeDock(); + SignalsDock(); + ~SignalsDock(); }; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index f7f2d6e38e9..32013db9b0c 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -84,11 +84,12 @@ #include "editor/doc/editor_help.h" #include "editor/docks/editor_dock_manager.h" #include "editor/docks/filesystem_dock.h" +#include "editor/docks/groups_dock.h" #include "editor/docks/history_dock.h" #include "editor/docks/import_dock.h" #include "editor/docks/inspector_dock.h" -#include "editor/docks/node_dock.h" #include "editor/docks/scene_tree_dock.h" +#include "editor/docks/signals_dock.h" #include "editor/editor_data.h" #include "editor/editor_interface.h" #include "editor/editor_log.h" @@ -2896,7 +2897,8 @@ void EditorNode::push_node_item(Node *p_node) { void EditorNode::push_item(Object *p_object, const String &p_property, bool p_inspector_only) { if (!p_object) { InspectorDock::get_inspector_singleton()->edit(nullptr); - NodeDock::get_singleton()->set_selection(Vector()); + SignalsDock::get_singleton()->set_object(nullptr); + GroupsDock::get_singleton()->set_selection(Vector()); SceneTreeDock::get_singleton()->set_selected(nullptr); InspectorDock::get_singleton()->update(nullptr); hide_unused_editors(); @@ -3007,7 +3009,8 @@ void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update if (!current_obj) { SceneTreeDock::get_singleton()->set_selected(nullptr); InspectorDock::get_inspector_singleton()->edit(nullptr); - NodeDock::get_singleton()->set_selection(Vector()); + SignalsDock::get_singleton()->set_object(nullptr); + GroupsDock::get_singleton()->set_selection(Vector()); InspectorDock::get_singleton()->update(nullptr); EditorDebuggerNode::get_singleton()->clear_remote_tree_selection(); hide_unused_editors(); @@ -3041,7 +3044,8 @@ void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update if (!p_skip_inspector_update) { InspectorDock::get_inspector_singleton()->edit(current_res); SceneTreeDock::get_singleton()->set_selected(nullptr); - NodeDock::get_singleton()->set_selection(Vector{ current_res }); + SignalsDock::get_singleton()->set_object(current_res); + GroupsDock::get_singleton()->set_selection(Vector()); InspectorDock::get_singleton()->update(nullptr); EditorDebuggerNode::get_singleton()->clear_remote_tree_selection(); ImportDock::get_singleton()->set_edit_path(current_res->get_path()); @@ -3071,7 +3075,8 @@ void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update InspectorDock::get_inspector_singleton()->edit(current_node); if (current_node->is_inside_tree()) { - NodeDock::get_singleton()->set_selection(Vector{ current_node }); + SignalsDock::get_singleton()->set_object(current_node); + GroupsDock::get_singleton()->set_selection(Vector{ current_node }); SceneTreeDock::get_singleton()->set_selected(current_node); SceneTreeDock::get_singleton()->set_selection({ current_node }); InspectorDock::get_singleton()->update(current_node); @@ -3083,7 +3088,8 @@ void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update } } } else { - NodeDock::get_singleton()->set_selection(Vector()); + SignalsDock::get_singleton()->set_object(nullptr); + GroupsDock::get_singleton()->set_selection(Vector()); SceneTreeDock::get_singleton()->set_selected(nullptr); InspectorDock::get_singleton()->update(nullptr); } @@ -3130,15 +3136,9 @@ void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update EditorDebuggerNode::get_singleton()->clear_remote_tree_selection(); } - // TODO: This can be replaced by some casting operator. - Vector nodes_as_objects; - nodes_as_objects.reserve_exact(multi_nodes.size()); - for (Node *n : multi_nodes) { - nodes_as_objects.append(n); - } - InspectorDock::get_inspector_singleton()->edit(current_obj); - NodeDock::get_singleton()->set_selection(nodes_as_objects); + SignalsDock::get_singleton()->set_object(nullptr); + GroupsDock::get_singleton()->set_selection(multi_nodes); SceneTreeDock::get_singleton()->set_selected(selected_node); SceneTreeDock::get_singleton()->set_selection(multi_nodes); InspectorDock::get_singleton()->update(nullptr); @@ -7574,7 +7574,8 @@ void EditorNode::_resource_loaded(Ref p_resource, const String &p_path void EditorNode::_feature_profile_changed() { Ref profile = feature_profile_manager->get_current_profile(); if (profile.is_valid()) { - editor_dock_manager->set_dock_enabled(NodeDock::get_singleton(), !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_NODE_DOCK)); + editor_dock_manager->set_dock_enabled(SignalsDock::get_singleton(), !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SIGNALS_DOCK)); + editor_dock_manager->set_dock_enabled(GroupsDock::get_singleton(), !profile->is_feature_disabled(EditorFeatureProfile::FEATURE_GROUPS_DOCK)); // The Import dock is useless without the FileSystem dock. Ensure the configuration is valid. bool fs_dock_disabled = profile->is_feature_disabled(EditorFeatureProfile::FEATURE_FILESYSTEM_DOCK); editor_dock_manager->set_dock_enabled(FileSystemDock::get_singleton(), !fs_dock_disabled); @@ -7591,7 +7592,8 @@ void EditorNode::_feature_profile_changed() { } } else { editor_dock_manager->set_dock_enabled(ImportDock::get_singleton(), true); - editor_dock_manager->set_dock_enabled(NodeDock::get_singleton(), true); + editor_dock_manager->set_dock_enabled(SignalsDock::get_singleton(), true); + editor_dock_manager->set_dock_enabled(GroupsDock::get_singleton(), true); editor_dock_manager->set_dock_enabled(FileSystemDock::get_singleton(), true); editor_dock_manager->set_dock_enabled(history_dock, true); editor_main_screen->set_button_enabled(EditorMainScreen::EDITOR_3D, true); @@ -8749,15 +8751,18 @@ EditorNode::EditorNode() { memnew(InspectorDock(editor_data)); editor_dock_manager->add_dock(InspectorDock::get_singleton()); - memnew(NodeDock); - editor_dock_manager->add_dock(NodeDock::get_singleton()); + memnew(SignalsDock); + editor_dock_manager->add_dock(SignalsDock::get_singleton()); + + memnew(GroupsDock); + editor_dock_manager->add_dock(GroupsDock::get_singleton()); history_dock = memnew(HistoryDock); editor_dock_manager->add_dock(history_dock); // Add some offsets to left_r and main hsplits to make LEFT_R and RIGHT_L docks wider than minsize. left_r_hsplit->set_split_offset(270 * EDSCALE); - main_hsplit->set_split_offset(-270 * EDSCALE); + main_hsplit->set_split_offset(-360 * EDSCALE); // Define corresponding default layout. @@ -8766,7 +8771,7 @@ EditorNode::EditorNode() { // Dock numbers are based on DockSlot enum value + 1. default_layout->set_value(docks_section, "dock_3", "Scene,Import"); default_layout->set_value(docks_section, "dock_4", "FileSystem"); - default_layout->set_value(docks_section, "dock_5", "Inspector,Node,History"); + default_layout->set_value(docks_section, "dock_5", "Inspector,Signals,Groups,History"); int hsplits[] = { 0, 270, -270, 0 }; DEV_ASSERT((int)std_size(hsplits) == editor_dock_manager->get_hsplit_count()); diff --git a/editor/scene/connections_dialog.cpp b/editor/scene/connections_dialog.cpp index aa84a2619d7..e4a8d6c3fce 100644 --- a/editor/scene/connections_dialog.cpp +++ b/editor/scene/connections_dialog.cpp @@ -33,8 +33,8 @@ #include "core/config/project_settings.h" #include "core/templates/hash_set.h" #include "editor/doc/editor_help.h" -#include "editor/docks/node_dock.h" #include "editor/docks/scene_tree_dock.h" +#include "editor/docks/signals_dock.h" #include "editor/editor_main_screen.h" #include "editor/editor_node.h" #include "editor/editor_string_names.h" @@ -1503,16 +1503,15 @@ void ConnectionsDock::_bind_methods() { ClassDB::bind_method("update_tree", &ConnectionsDock::update_tree); } -void ConnectionsDock::set_selection(const Vector &p_objects) { - if (p_objects.size() != 1) { - select_a_node->show(); +void ConnectionsDock::set_object(Object *p_object) { + if (p_object == nullptr) { + select_an_object->show(); holder->hide(); - selected_object = nullptr; } else { - select_a_node->hide(); + select_an_object->hide(); holder->show(); - selected_object = p_objects[0]; } + selected_object = p_object; is_editing_resource = (Object::cast_to(selected_object) != nullptr); update_tree(); } @@ -1779,13 +1778,13 @@ ConnectionsDock::ConnectionsDock() { add_theme_constant_override("separation", 3 * EDSCALE); - select_a_node = memnew(Label); - select_a_node->set_focus_mode(FOCUS_ACCESSIBILITY); - select_a_node->set_text(TTRC("Select a single node or resource to edit its signals.")); - select_a_node->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); - select_a_node->set_v_size_flags(SIZE_EXPAND_FILL); - select_a_node->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER); - select_a_node->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER); - select_a_node->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART); - add_child(select_a_node); + select_an_object = memnew(Label); + select_an_object->set_focus_mode(FOCUS_ACCESSIBILITY); + select_an_object->set_text(TTRC("Select a single node or resource to edit its signals.")); + select_an_object->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); + select_an_object->set_v_size_flags(SIZE_EXPAND_FILL); + select_an_object->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER); + select_an_object->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER); + select_an_object->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART); + add_child(select_an_object); } diff --git a/editor/scene/connections_dialog.h b/editor/scene/connections_dialog.h index f5913611401..0523743ef3b 100644 --- a/editor/scene/connections_dialog.h +++ b/editor/scene/connections_dialog.h @@ -238,7 +238,7 @@ class ConnectionsDock : public VBoxContainer { }; VBoxContainer *holder = nullptr; - Label *select_a_node = nullptr; + Label *select_an_object = nullptr; Object *selected_object = nullptr; ConnectionsDockTree *tree = nullptr; @@ -285,7 +285,7 @@ protected: static void _bind_methods(); public: - void set_selection(const Vector &p_objects); + void set_object(Object *p_object); void update_tree(); ConnectionsDock(); diff --git a/editor/scene/scene_tree_editor.cpp b/editor/scene/scene_tree_editor.cpp index f2564884368..2d83463ed32 100644 --- a/editor/scene/scene_tree_editor.cpp +++ b/editor/scene/scene_tree_editor.cpp @@ -34,7 +34,8 @@ #include "core/object/script_language.h" #include "editor/animation/animation_player_editor_plugin.h" #include "editor/docks/editor_dock_manager.h" -#include "editor/docks/node_dock.h" +#include "editor/docks/groups_dock.h" +#include "editor/docks/signals_dock.h" #include "editor/editor_node.h" #include "editor/editor_string_names.h" #include "editor/editor_undo_redo_manager.h" @@ -194,16 +195,14 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i set_selected(n); - EditorDockManager::get_singleton()->focus_dock(NodeDock::get_singleton()); - NodeDock::get_singleton()->show_connections(); + EditorDockManager::get_singleton()->focus_dock(SignalsDock::get_singleton()); } else if (p_id == BUTTON_GROUPS) { editor_selection->clear(); editor_selection->add_node(n); set_selected(n); - EditorDockManager::get_singleton()->focus_dock(NodeDock::get_singleton()); - NodeDock::get_singleton()->show_groups(); + EditorDockManager::get_singleton()->focus_dock(GroupsDock::get_singleton()); } else if (p_id == BUTTON_UNIQUE) { bool ask_before_revoking_unique_name = EDITOR_GET("docks/scene_tree/ask_before_revoking_unique_name"); revoke_node = n; diff --git a/editor/script/script_editor_plugin.cpp b/editor/script/script_editor_plugin.cpp index 8a1e5be1b26..e582a26481e 100644 --- a/editor/script/script_editor_plugin.cpp +++ b/editor/script/script_editor_plugin.cpp @@ -45,7 +45,7 @@ #include "editor/doc/editor_help_search.h" #include "editor/docks/filesystem_dock.h" #include "editor/docks/inspector_dock.h" -#include "editor/docks/node_dock.h" +#include "editor/docks/signals_dock.h" #include "editor/editor_interface.h" #include "editor/editor_main_screen.h" #include "editor/editor_node.h" @@ -3022,7 +3022,7 @@ void ScriptEditor::_add_callback(Object *p_obj, const String &p_function, const break; } - // Move back to the previously edited node to reselect it in the Inspector and the NodeDock. + // Move back to the previously edited node to reselect it in the Inspector and the SignalsDock. // We assume that the previous item is the node on which the callbacks were added. EditorNode::get_singleton()->edit_previous_item(); } @@ -4009,7 +4009,7 @@ void ScriptEditor::register_create_script_editor_function(CreateScriptEditorFunc } void ScriptEditor::_script_changed() { - NodeDock::get_singleton()->update_lists(); + SignalsDock::get_singleton()->update_lists(); } void ScriptEditor::_on_replace_in_files_requested(const String &text) { diff --git a/editor/settings/editor_feature_profile.cpp b/editor/settings/editor_feature_profile.cpp index 7e7d14baca2..3a13d3227e8 100644 --- a/editor/settings/editor_feature_profile.cpp +++ b/editor/settings/editor_feature_profile.cpp @@ -47,11 +47,15 @@ const char *EditorFeatureProfile::feature_names[FEATURE_MAX] = { TTRC("Script Editor"), TTRC("Asset Library"), TTRC("Scene Tree Editing"), - TTRC("Node Dock"), +#ifndef DISABLE_DEPRECATED + TTRC("Node Dock (deprecated)"), +#endif TTRC("FileSystem Dock"), TTRC("Import Dock"), TTRC("History Dock"), TTRC("Game View"), + TTRC("Signals Dock"), + TTRC("Groups Dock"), }; const char *EditorFeatureProfile::feature_descriptions[FEATURE_MAX] = { @@ -59,11 +63,15 @@ const char *EditorFeatureProfile::feature_descriptions[FEATURE_MAX] = { TTRC("Allows to edit scripts using the integrated script editor."), TTRC("Provides built-in access to the Asset Library."), TTRC("Allows editing the node hierarchy in the Scene dock."), +#ifndef DISABLE_DEPRECATED TTRC("Allows to work with signals and groups of the node selected in the Scene dock."), +#endif TTRC("Allows to browse the local file system via a dedicated dock."), TTRC("Allows to configure import settings for individual assets. Requires the FileSystem dock to function."), TTRC("Provides an overview of the editor's and each scene's undo history."), TTRC("Provides tools for selecting and debugging nodes at runtime."), + TTRC("Allows to work with signals of the node selected in the Scene dock."), + TTRC("Allows to manage groups of the node selected in the Scene dock."), }; const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = { @@ -71,11 +79,15 @@ const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = { "script", "asset_lib", "scene_tree", +#ifndef DISABLE_DEPRECATED "node_dock", +#endif "filesystem_dock", "import_dock", "history_dock", "game", + "signals_dock", + "groups_dock", }; void EditorFeatureProfile::set_disable_class(const StringName &p_class, bool p_disabled) { @@ -308,11 +320,15 @@ void EditorFeatureProfile::_bind_methods() { BIND_ENUM_CONSTANT(FEATURE_SCRIPT); BIND_ENUM_CONSTANT(FEATURE_ASSET_LIB); BIND_ENUM_CONSTANT(FEATURE_SCENE_TREE); +#ifndef DISABLE_DEPRECATED BIND_ENUM_CONSTANT(FEATURE_NODE_DOCK); +#endif BIND_ENUM_CONSTANT(FEATURE_FILESYSTEM_DOCK); BIND_ENUM_CONSTANT(FEATURE_IMPORT_DOCK); BIND_ENUM_CONSTANT(FEATURE_HISTORY_DOCK); BIND_ENUM_CONSTANT(FEATURE_GAME); + BIND_ENUM_CONSTANT(FEATURE_SIGNALS_DOCK); + BIND_ENUM_CONSTANT(FEATURE_GROUPS_DOCK); BIND_ENUM_CONSTANT(FEATURE_MAX); } diff --git a/editor/settings/editor_feature_profile.h b/editor/settings/editor_feature_profile.h index a57c01dff4d..cbbe815ac7d 100644 --- a/editor/settings/editor_feature_profile.h +++ b/editor/settings/editor_feature_profile.h @@ -48,11 +48,15 @@ public: FEATURE_SCRIPT, FEATURE_ASSET_LIB, FEATURE_SCENE_TREE, +#ifndef DISABLE_DEPRECATED FEATURE_NODE_DOCK, +#endif FEATURE_FILESYSTEM_DOCK, FEATURE_IMPORT_DOCK, FEATURE_HISTORY_DOCK, FEATURE_GAME, + FEATURE_SIGNALS_DOCK, + FEATURE_GROUPS_DOCK, FEATURE_MAX }; diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 2515c3062ef..242f95268b6 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -60,7 +60,7 @@ #ifdef TOOLS_ENABLED #include "core/os/keyboard.h" #include "editor/docks/inspector_dock.h" -#include "editor/docks/node_dock.h" +#include "editor/docks/signals_dock.h" #include "editor/editor_node.h" #include "editor/file_system/editor_file_system.h" #include "editor/settings/editor_settings.h" @@ -1030,7 +1030,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) { // FIXME: Hack to refresh editor in order to display new properties and signals. See if there is a better alternative. if (Engine::get_singleton()->is_editor_hint()) { InspectorDock::get_inspector_singleton()->update_tree(); - NodeDock::get_singleton()->update_lists(); + SignalsDock::get_singleton()->update_lists(); } #endif }