diff --git a/doc/classes/EditorInterface.xml b/doc/classes/EditorInterface.xml
index d0de09e4512..fc28622fdb9 100644
--- a/doc/classes/EditorInterface.xml
+++ b/doc/classes/EditorInterface.xml
@@ -195,6 +195,15 @@
Shows the given property on the given [param object] in the editor's Inspector dock. If [param inspector_only] is [code]true[/code], plugins will not attempt to edit [param object].
+
+
+
+ Returns [code]true[/code] if multiple window support is enabled in the editor. Multiple window support is enabled if [i]all[/i] of these statements are true:
+ - [member EditorSettings.interface/multi_window/enable] is [code]true[/code].
+ - [member EditorSettings.interface/editor/single_window_mode] is [code]false[/code].
+ - [member Viewport.gui_embed_subwindows] is [code]false[/code]. This is forced to [code]true[/code] on platforms that don't support multiple windows such as Web, or when the [code]--single-window[/code] [url=$DOCS_URL/tutorials/editor/command_line_tutorial.html]command line argument[/url] is used.
+
+
diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml
index b7f3ec9963d..2c329e3608f 100644
--- a/doc/classes/EditorSettings.xml
+++ b/doc/classes/EditorSettings.xml
@@ -616,6 +616,7 @@
If [code]true[/code], embed modal windows such as docks inside the main editor window. When single-window mode is enabled, tooltips will also be embedded inside the main editor window, which means they can't be displayed outside of the editor window.
+ [b]Note:[/b] To query whether the editor can use multiple windows in an editor plugin, use [method EditorInterface.is_multi_window_enabled] instead of querying the value of this editor setting.
Editor UI default layout direction.
@@ -637,8 +638,9 @@
If [code]true[/code], display OpenType features marked as [code]hidden[/code] by the font file in the [Font] editor.
- If [code]true[/code], the multi window support in editor is enabled. The following panels can become dedicated windows (made floating): Docks, Script editor, and Shader editor.
+ If [code]true[/code], multiple window support in editor is enabled. The following panels can become dedicated windows (i.e. made floating): Docks, Script editor, and Shader editor.
[b]Note:[/b] When [member interface/editor/single_window_mode] is [code]true[/code], the multi window support is always disabled.
+ [b]Note:[/b] To query whether the editor can use multiple windows in an editor plugin, use [method EditorInterface.is_multi_window_enabled] instead of querying the value of this editor setting.
If [code]true[/code], when panels are made floating they will be maximized.
diff --git a/editor/editor_dock_manager.cpp b/editor/editor_dock_manager.cpp
index dfe95047064..54789bdef18 100644
--- a/editor/editor_dock_manager.cpp
+++ b/editor/editor_dock_manager.cpp
@@ -702,15 +702,18 @@ EditorDockManager::EditorDockManager() {
dock_select->set_v_size_flags(Control::SIZE_EXPAND_FILL);
dock_vb->add_child(dock_select);
- if (!SceneTree::get_singleton()->get_root()->is_embedding_subwindows() && !EDITOR_GET("interface/editor/single_window_mode") && EDITOR_GET("interface/multi_window/enable")) {
- dock_float = memnew(Button);
- dock_float->set_text(TTR("Make Floating"));
- dock_float->set_focus_mode(Control::FOCUS_NONE);
- dock_float->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
- dock_float->connect("pressed", callable_mp(this, &EditorDockManager::_dock_make_selected_float));
-
- dock_vb->add_child(dock_float);
+ dock_float = memnew(Button);
+ dock_float->set_text(TTR("Make Floating"));
+ if (!EditorNode::get_singleton()->is_multi_window_enabled()) {
+ dock_float->set_disabled(true);
+ dock_float->set_tooltip_text(EditorNode::get_singleton()->get_multiwindow_support_tooltip_text());
+ } else {
+ dock_float->set_tooltip_text(TTR("Make this dock floating."));
}
+ dock_float->set_focus_mode(Control::FOCUS_NONE);
+ dock_float->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
+ dock_float->connect("pressed", callable_mp(this, &EditorDockManager::_dock_make_selected_float));
+ dock_vb->add_child(dock_float);
dock_select_popup->reset_size();
}
diff --git a/editor/editor_interface.cpp b/editor/editor_interface.cpp
index bad28ff43d5..dcaf7fbd00d 100644
--- a/editor/editor_interface.cpp
+++ b/editor/editor_interface.cpp
@@ -235,6 +235,10 @@ bool EditorInterface::is_distraction_free_mode_enabled() const {
return EditorNode::get_singleton()->is_distraction_free_mode_enabled();
}
+bool EditorInterface::is_multi_window_enabled() const {
+ return EditorNode::get_singleton()->is_multi_window_enabled();
+}
+
float EditorInterface::get_editor_scale() const {
return EDSCALE;
}
@@ -445,6 +449,7 @@ void EditorInterface::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_main_screen_editor", "name"), &EditorInterface::set_main_screen_editor);
ClassDB::bind_method(D_METHOD("set_distraction_free_mode", "enter"), &EditorInterface::set_distraction_free_mode);
ClassDB::bind_method(D_METHOD("is_distraction_free_mode_enabled"), &EditorInterface::is_distraction_free_mode_enabled);
+ ClassDB::bind_method(D_METHOD("is_multi_window_enabled"), &EditorInterface::is_multi_window_enabled);
ClassDB::bind_method(D_METHOD("get_editor_scale"), &EditorInterface::get_editor_scale);
diff --git a/editor/editor_interface.h b/editor/editor_interface.h
index 73e89ae2f24..9515a1226fd 100644
--- a/editor/editor_interface.h
+++ b/editor/editor_interface.h
@@ -99,6 +99,7 @@ public:
void set_main_screen_editor(const String &p_name);
void set_distraction_free_mode(bool p_enter);
bool is_distraction_free_mode_enabled() const;
+ bool is_multi_window_enabled() const;
float get_editor_scale() const;
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 928deb588c6..23d57040488 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -3715,6 +3715,10 @@ bool EditorNode::is_scene_open(const String &p_path) {
return false;
}
+bool EditorNode::is_multi_window_enabled() const {
+ return !SceneTree::get_singleton()->get_root()->is_embedding_subwindows() && !EDITOR_GET("interface/editor/single_window_mode") && EDITOR_GET("interface/multi_window/enable");
+}
+
void EditorNode::fix_dependencies(const String &p_for_file) {
dependency_fixer->edit(p_for_file);
}
@@ -4126,6 +4130,20 @@ void EditorNode::request_instantiate_scenes(const Vector &p_files) {
SceneTreeDock::get_singleton()->instantiate_scenes(p_files);
}
+String EditorNode::get_multiwindow_support_tooltip_text() const {
+ if (SceneTree::get_singleton()->get_root()->is_embedding_subwindows()) {
+ if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_SUBWINDOWS)) {
+ return TTR("Multi-window support is not available because the `--single-window` command line argument was used to start the editor.");
+ } else {
+ return TTR("Multi-window support is not available because the current platform doesn't support multiple windows.");
+ }
+ } else if (EDITOR_GET("interface/editor/single_window_mode")) {
+ return TTR("Multi-window support is not available because Interface > Editor > Single Window Mode is enabled in the editor settings.");
+ }
+
+ return TTR("Multi-window support is not available because Interface > Multi Window > Enable is disabled in the editor settings.");
+}
+
void EditorNode::_inherit_request(String p_file) {
current_menu_option = FILE_NEW_INHERITED_SCENE;
_dialog_action(p_file);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index f1dea0c11e4..014b72c5808 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -758,6 +758,8 @@ public:
bool is_resource_read_only(Ref p_resource, bool p_foreign_resources_are_writable = false);
+ String get_multiwindow_support_tooltip_text() const;
+
bool is_changing_scene() const;
VBoxContainer *get_main_screen_control();
@@ -807,6 +809,7 @@ public:
List &p_addition_list);
bool is_scene_open(const String &p_path);
+ bool is_multi_window_enabled() const;
void setup_color_picker(ColorPicker *p_picker);
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 55191f44d40..c8e65e98a71 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -4074,18 +4074,19 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
script_forward->set_disabled(true);
script_forward->set_tooltip_text(TTR("Go to next edited document."));
- if (p_wrapper->is_window_available()) {
- menu_hb->add_child(memnew(VSeparator));
+ menu_hb->add_child(memnew(VSeparator));
- make_floating = memnew(ScreenSelect);
- make_floating->set_flat(true);
+ make_floating = memnew(ScreenSelect);
+ make_floating->set_flat(true);
+ make_floating->connect("request_open_in_screen", callable_mp(window_wrapper, &WindowWrapper::enable_window_on_screen).bind(true));
+ if (!make_floating->is_disabled()) {
+ // Override default ScreenSelect tooltip if multi-window support is available.
make_floating->set_tooltip_text(TTR("Make the script editor floating."));
- make_floating->connect("request_open_in_screen", callable_mp(window_wrapper, &WindowWrapper::enable_window_on_screen).bind(true));
-
- menu_hb->add_child(make_floating);
- p_wrapper->connect("window_visibility_changed", callable_mp(this, &ScriptEditor::_window_changed));
}
+ menu_hb->add_child(make_floating);
+ p_wrapper->connect("window_visibility_changed", callable_mp(this, &ScriptEditor::_window_changed));
+
tab_container->connect("tab_changed", callable_mp(this, &ScriptEditor::_tab_changed));
erase_tab_confirm = memnew(ConfirmationDialog);
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 5798ff9d99b..a018ec095ba 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -643,20 +643,21 @@ ShaderEditorPlugin::ShaderEditorPlugin() {
file_menu->get_popup()->set_item_disabled(file_menu->get_popup()->get_item_index(i), true);
}
- if (window_wrapper->is_window_available()) {
- Control *padding = memnew(Control);
- padding->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- menu_hb->add_child(padding);
+ Control *padding = memnew(Control);
+ padding->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ menu_hb->add_child(padding);
- make_floating = memnew(ScreenSelect);
- make_floating->set_flat(true);
+ make_floating = memnew(ScreenSelect);
+ make_floating->set_flat(true);
+ make_floating->connect("request_open_in_screen", callable_mp(window_wrapper, &WindowWrapper::enable_window_on_screen).bind(true));
+ if (!make_floating->is_disabled()) {
+ // Override default ScreenSelect tooltip if multi-window support is available.
make_floating->set_tooltip_text(TTR("Make the shader editor floating."));
- make_floating->connect("request_open_in_screen", callable_mp(window_wrapper, &WindowWrapper::enable_window_on_screen).bind(true));
-
- menu_hb->add_child(make_floating);
- window_wrapper->connect("window_visibility_changed", callable_mp(this, &ShaderEditorPlugin::_window_changed));
}
+ menu_hb->add_child(make_floating);
+ window_wrapper->connect("window_visibility_changed", callable_mp(this, &ShaderEditorPlugin::_window_changed));
+
shader_list = memnew(ItemList);
shader_list->set_auto_translate(false);
shader_list->set_v_size_flags(Control::SIZE_EXPAND_FILL);
diff --git a/editor/window_wrapper.cpp b/editor/window_wrapper.cpp
index a085c2e44f1..b2b237269a8 100644
--- a/editor/window_wrapper.cpp
+++ b/editor/window_wrapper.cpp
@@ -315,7 +315,7 @@ void WindowWrapper::set_margins_enabled(bool p_enabled) {
}
WindowWrapper::WindowWrapper() {
- if (SceneTree::get_singleton()->get_root()->is_embedding_subwindows() || EDITOR_GET("interface/editor/single_window_mode") || !EDITOR_GET("interface/multi_window/enable")) {
+ if (!EditorNode::get_singleton()->is_multi_window_enabled()) {
return;
}
@@ -375,7 +375,9 @@ void ScreenSelect::_build_advanced_menu() {
}
void ScreenSelect::_emit_screen_signal(int p_screen_idx) {
- emit_signal("request_open_in_screen", p_screen_idx);
+ if (!is_disabled()) {
+ emit_signal("request_open_in_screen", p_screen_idx);
+ }
}
void ScreenSelect::_bind_methods() {
@@ -436,13 +438,19 @@ void ScreenSelect::pressed() {
}
ScreenSelect::ScreenSelect() {
- set_tooltip_text(TTR("Make this panel floating.\nRight click to open the screen selector."));
set_button_mask(MouseButtonMask::RIGHT);
set_flat(true);
set_toggle_mode(true);
set_focus_mode(FOCUS_NONE);
set_action_mode(ACTION_MODE_BUTTON_PRESS);
+ if (!EditorNode::get_singleton()->is_multi_window_enabled()) {
+ set_disabled(true);
+ set_tooltip_text(EditorNode::get_singleton()->get_multiwindow_support_tooltip_text());
+ } else {
+ set_tooltip_text(TTR("Make this panel floating.\nRight-click to open the screen selector."));
+ }
+
// Create the popup.
const Size2 borders = Size2(4, 4) * EDSCALE;