Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix autoswitch 2D/3D view when clicking on node with floating script editor #80307

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions editor/plugins/script_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ScriptEditorBase>(tab_container->get_tab_control(i));
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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));
}

Expand Down
2 changes: 2 additions & 0 deletions editor/plugins/script_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ class ScriptEditor : public PanelContainer {
Button *help_search = nullptr;
Button *site_search = nullptr;
Button *make_floating = nullptr;
bool floating_activated;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set this to false here instead of in the constructor.

EditorHelpSearch *help_search_dialog = nullptr;

ItemList *script_list = nullptr;
Expand Down Expand Up @@ -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);
Expand Down
Loading