diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index f207418f7168..538ff2f52537 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2357,7 +2357,7 @@ void EditorNode::_edit_current(bool p_skip_foreign) { SceneTreeDock::get_singleton()->set_selected(current_node); InspectorDock::get_singleton()->update(current_node); if (!inspector_only && !skip_main_plugin) { - skip_main_plugin = stay_in_script_editor_on_node_selected && ScriptEditor::get_singleton()->is_visible_in_tree(); + skip_main_plugin = stay_in_script_editor_on_node_selected && (ScriptEditor::get_singleton()->is_visible_in_tree() && !ScriptEditor::get_singleton()->is_floating()); } } else { NodeDock::get_singleton()->set_node(nullptr); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 67df349e485c..ad265f162d20 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2556,6 +2556,10 @@ void ScriptEditor::save_all_scripts() { _update_script_names(); } +bool ScriptEditor::is_floating() const { + return floating_activated; +} + void ScriptEditor::apply_scripts() const { for (int i = 0; i < tab_container->get_tab_count(); i++) { ScriptEditorBase *se = Object::cast_to(tab_container->get_tab_control(i)); @@ -3747,6 +3751,7 @@ void ScriptEditor::_on_find_in_files_modified_files(PackedStringArray paths) { void ScriptEditor::_window_changed(bool p_visible) { make_floating->set_visible(!p_visible); + floating_activated = p_visible; } void ScriptEditor::_filter_scripts_text_changed(const String &p_newtext) { @@ -4037,6 +4042,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { make_floating->connect("request_open_in_screen", callable_mp(window_wrapper, &WindowWrapper::enable_window_on_screen).bind(true)); menu_hb->add_child(make_floating); + floating_activated = false; p_wrapper->connect("window_visibility_changed", callable_mp(this, &ScriptEditor::_window_changed)); } diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 198aaa6c4ea6..56ee16966511 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -274,6 +274,7 @@ class ScriptEditor : public PanelContainer { Button *help_search = nullptr; Button *site_search = nullptr; Button *make_floating = nullptr; + bool floating_activated; EditorHelpSearch *help_search_dialog = nullptr; ItemList *script_list = nullptr; @@ -499,6 +500,7 @@ class ScriptEditor : public PanelContainer { bool toggle_scripts_panel(); bool is_scripts_panel_toggled(); + bool is_floating() const; void apply_scripts() const; void reload_scripts(bool p_refresh_only = false); void open_script_create_dialog(const String &p_base_name, const String &p_base_path);