summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-11-07 13:41:29 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-11-07 13:41:29 +0100
commit518b4bcc0d688dcbc6c9766cacd85fd3a461bcd6 (patch)
tree241ad991b4531eb1c50776900fff91c7a323bb6a
parenta1bc636098c91ed47a8d9a23e07a4c85b64c1884 (diff)
parentc89100e5718d035698b5dc34a20a2950fd86acfb (diff)
Merge pull request #68342 from KoBeWi/Godot_museum't
Allow to disable History Dock via feature profile
-rw-r--r--doc/classes/EditorFeatureProfile.xml5
-rw-r--r--editor/editor_feature_profile.cpp4
-rw-r--r--editor/editor_feature_profile.h1
-rw-r--r--editor/editor_node.cpp10
-rw-r--r--editor/editor_node.h2
5 files changed, 18 insertions, 4 deletions
diff --git a/doc/classes/EditorFeatureProfile.xml b/doc/classes/EditorFeatureProfile.xml
index 99e97fc25f..27f61f1bd8 100644
--- a/doc/classes/EditorFeatureProfile.xml
+++ b/doc/classes/EditorFeatureProfile.xml
@@ -116,7 +116,10 @@
<constant name="FEATURE_IMPORT_DOCK" value="6" enum="Feature">
The Import dock. If this feature is disabled, the Import dock won't be visible.
</constant>
- <constant name="FEATURE_MAX" value="7" enum="Feature">
+ <constant name="FEATURE_HISTORY_DOCK" value="7" enum="Feature">
+ The History dock. If this feature is disabled, the History dock won't be visible.
+ </constant>
+ <constant name="FEATURE_MAX" value="8" enum="Feature">
Represents the size of the [enum Feature] enum.
</constant>
</constants>
diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp
index 9549ffb09b..49fb16a095 100644
--- a/editor/editor_feature_profile.cpp
+++ b/editor/editor_feature_profile.cpp
@@ -47,6 +47,7 @@ const char *EditorFeatureProfile::feature_names[FEATURE_MAX] = {
TTRC("Node Dock"),
TTRC("FileSystem Dock"),
TTRC("Import Dock"),
+ TTRC("History Dock"),
};
const char *EditorFeatureProfile::feature_descriptions[FEATURE_MAX] = {
@@ -57,6 +58,7 @@ const char *EditorFeatureProfile::feature_descriptions[FEATURE_MAX] = {
TTRC("Allows to work with signals and groups of the node selected in the Scene dock."),
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."),
};
const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = {
@@ -67,6 +69,7 @@ const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = {
"node_dock",
"filesystem_dock",
"import_dock",
+ "history_dock",
};
void EditorFeatureProfile::set_disable_class(const StringName &p_class, bool p_disabled) {
@@ -302,6 +305,7 @@ void EditorFeatureProfile::_bind_methods() {
BIND_ENUM_CONSTANT(FEATURE_NODE_DOCK);
BIND_ENUM_CONSTANT(FEATURE_FILESYSTEM_DOCK);
BIND_ENUM_CONSTANT(FEATURE_IMPORT_DOCK);
+ BIND_ENUM_CONSTANT(FEATURE_HISTORY_DOCK);
BIND_ENUM_CONSTANT(FEATURE_MAX);
}
diff --git a/editor/editor_feature_profile.h b/editor/editor_feature_profile.h
index dab6c951e4..6868c54146 100644
--- a/editor/editor_feature_profile.h
+++ b/editor/editor_feature_profile.h
@@ -52,6 +52,7 @@ public:
FEATURE_NODE_DOCK,
FEATURE_FILESYSTEM_DOCK,
FEATURE_IMPORT_DOCK,
+ FEATURE_HISTORY_DOCK,
FEATURE_MAX
};
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index a748572d2a..bd6bc3ece5 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -5968,12 +5968,14 @@ void EditorNode::_feature_profile_changed() {
TabContainer *import_tabs = cast_to<TabContainer>(ImportDock::get_singleton()->get_parent());
TabContainer *node_tabs = cast_to<TabContainer>(NodeDock::get_singleton()->get_parent());
TabContainer *fs_tabs = cast_to<TabContainer>(FileSystemDock::get_singleton()->get_parent());
+ TabContainer *history_tabs = cast_to<TabContainer>(history_dock->get_parent());
if (profile.is_valid()) {
node_tabs->set_tab_hidden(node_tabs->get_tab_idx_from_control(NodeDock::get_singleton()), profile->is_feature_disabled(EditorFeatureProfile::FEATURE_NODE_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);
fs_tabs->set_tab_hidden(fs_tabs->get_tab_idx_from_control(FileSystemDock::get_singleton()), fs_dock_disabled);
import_tabs->set_tab_hidden(import_tabs->get_tab_idx_from_control(ImportDock::get_singleton()), fs_dock_disabled || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_IMPORT_DOCK));
+ history_tabs->set_tab_hidden(history_tabs->get_tab_idx_from_control(history_dock), profile->is_feature_disabled(EditorFeatureProfile::FEATURE_HISTORY_DOCK));
main_editor_buttons[EDITOR_3D]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D));
main_editor_buttons[EDITOR_SCRIPT]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT));
@@ -5989,6 +5991,8 @@ void EditorNode::_feature_profile_changed() {
import_tabs->set_tab_hidden(import_tabs->get_tab_idx_from_control(ImportDock::get_singleton()), false);
node_tabs->set_tab_hidden(node_tabs->get_tab_idx_from_control(NodeDock::get_singleton()), false);
fs_tabs->set_tab_hidden(fs_tabs->get_tab_idx_from_control(FileSystemDock::get_singleton()), false);
+ history_tabs->set_tab_hidden(history_tabs->get_tab_idx_from_control(history_dock), false);
+ history_dock->set_visible(true);
ImportDock::get_singleton()->set_visible(true);
NodeDock::get_singleton()->set_visible(true);
FileSystemDock::get_singleton()->set_visible(true);
@@ -7100,7 +7104,7 @@ EditorNode::EditorNode() {
filesystem_dock->connect("display_mode_changed", callable_mp(this, &EditorNode::_save_docks));
get_project_settings()->connect_filesystem_dock_signals(filesystem_dock);
- HistoryDock *hd = memnew(HistoryDock);
+ history_dock = memnew(HistoryDock);
// Scene: Top left.
dock_slot[DOCK_SLOT_LEFT_UR]->add_child(SceneTreeDock::get_singleton());
@@ -7123,8 +7127,8 @@ EditorNode::EditorNode() {
dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(dock_slot[DOCK_SLOT_RIGHT_UL]->get_tab_idx_from_control(NodeDock::get_singleton()), TTR("Node"));
// History: Full height right, behind Node.
- dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(hd);
- dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(dock_slot[DOCK_SLOT_RIGHT_UL]->get_tab_idx_from_control(hd), TTR("History"));
+ dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(history_dock);
+ dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(dock_slot[DOCK_SLOT_RIGHT_UL]->get_tab_idx_from_control(history_dock), TTR("History"));
// Hide unused dock slots and vsplits.
dock_slot[DOCK_SLOT_LEFT_UL]->hide();
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 9c8d564057..f27fe429b9 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -77,6 +77,7 @@ class EditorUndoRedoManager;
class ExportTemplateManager;
class FileDialog;
class FileSystemDock;
+class HistoryDock;
class HSplitContainer;
class ImportDock;
class LinkButton;
@@ -274,6 +275,7 @@ private:
EditorRunNative *run_native = nullptr;
EditorSelection *editor_selection = nullptr;
EditorSettingsDialog *editor_settings_dialog = nullptr;
+ HistoryDock *history_dock = nullptr;
ProjectExportDialog *project_export = nullptr;
ProjectSettingsEditor *project_settings_editor = nullptr;