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

Allow closing scene tab preview using Escape #90720

Merged
merged 1 commit into from
Apr 17, 2024
Merged
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
12 changes: 12 additions & 0 deletions editor/gui/editor_scene_tabs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ void EditorSceneTabs::_scene_tab_input(const Ref<InputEvent> &p_input) {
}
}

void EditorSceneTabs::unhandled_key_input(const Ref<InputEvent> &p_event) {
if (!tab_preview_panel->is_visible()) {
return;
}

Ref<InputEventKey> k = p_event;
if (k.is_valid() && k->is_action_pressed(SNAME("ui_cancel"), false, true)) {
tab_preview_panel->hide();
}
}

void EditorSceneTabs::_reposition_active_tab(int p_to_index) {
EditorNode::get_editor_data().move_edited_scene_to_index(p_to_index);
update_scene_tabs();
Expand Down Expand Up @@ -369,6 +380,7 @@ EditorSceneTabs::EditorSceneTabs() {
singleton = this;

set_process_shortcut_input(true);
set_process_unhandled_key_input(true);

tabbar_panel = memnew(PanelContainer);
add_child(tabbar_panel);
Expand Down
1 change: 1 addition & 0 deletions editor/gui/editor_scene_tabs.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class EditorSceneTabs : public MarginContainer {

protected:
void _notification(int p_what);
virtual void unhandled_key_input(const Ref<InputEvent> &p_event) override;
static void _bind_methods();

public:
Expand Down
Loading