Skip to content

Commit

Permalink
Merge pull request #78920 from Rindbee/fix-invalid-shortcut-keys-in-T…
Browse files Browse the repository at this point in the history
…ileSetAtlasSourceEditor

Make sure the shortcut key respects the context in `TileSetAtlasSourceEditor`
  • Loading branch information
akien-mga committed Jul 7, 2023
2 parents 64d451d + fec731b commit e940778
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions editor/plugins/tiles/tile_set_atlas_source_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,7 @@ void TileSetAtlasSourceEditor::_menu_option(int p_option) {
}
}

void TileSetAtlasSourceEditor::_unhandled_key_input(const Ref<InputEvent> &p_event) {
void TileSetAtlasSourceEditor::shortcut_input(const Ref<InputEvent> &p_event) {
// Check for shortcuts.
if (ED_IS_SHORTCUT("tiles_editor/delete_tile", p_event)) {
if (tools_button_group->get_pressed_button() == tool_select_button && !selection.is_empty()) {
Expand Down Expand Up @@ -2418,14 +2418,14 @@ void TileSetAtlasSourceEditor::_notification(int p_what) {
}

void TileSetAtlasSourceEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_unhandled_key_input"), &TileSetAtlasSourceEditor::_unhandled_key_input);
ClassDB::bind_method(D_METHOD("_set_selection_from_array"), &TileSetAtlasSourceEditor::_set_selection_from_array);

ADD_SIGNAL(MethodInfo("source_id_changed", PropertyInfo(Variant::INT, "source_id")));
}

TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
set_process_unhandled_key_input(true);
set_shortcut_context(this);
set_process_shortcut_input(true);
set_process_internal(true);

// Middle panel.
Expand Down
6 changes: 3 additions & 3 deletions editor/plugins/tiles/tile_set_atlas_source_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,6 @@ class TileSetAtlasSourceEditor : public HSplitContainer {
void _update_atlas_view();
void _update_toolbar();

// -- input events --
void _unhandled_key_input(const Ref<InputEvent> &p_event);

// -- Misc --
void _auto_create_tiles();
void _auto_remove_tiles();
Expand All @@ -275,6 +272,9 @@ class TileSetAtlasSourceEditor : public HSplitContainer {
void _notification(int p_what);
static void _bind_methods();

// -- input events --
virtual void shortcut_input(const Ref<InputEvent> &p_event) override;

public:
void edit(Ref<TileSet> p_tile_set, TileSetAtlasSource *p_tile_set_source, int p_source_id);
void init_source();
Expand Down

0 comments on commit e940778

Please sign in to comment.