diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-11-28 09:04:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-28 09:04:25 +0100 |
commit | a09846e01542f199bbc7eb8b85003736a57f3e16 (patch) | |
tree | dcb2a7c189a7f65095cb1fef9f59eee45b072360 /editor/plugins/tile_map_editor_plugin.cpp | |
parent | a6751e6c58e73d6b8d04e98bba5fb6e380fdf34f (diff) | |
parent | 7941235e06c8acf1cb2888de3db8905c60c8ff00 (diff) |
Merge pull request #42109 from EricEzaM/PR/input-and-shortcuts-rework
Shortcuts rework - fixed issues with input propagation and triggering of unwanted shortcuts.
Diffstat (limited to 'editor/plugins/tile_map_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index ceec3f1830..6c0efcb254 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -2109,6 +2109,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { paint_button = memnew(Button); paint_button->set_flat(true); paint_button->set_shortcut(ED_SHORTCUT("tile_map_editor/paint_tile", TTR("Paint Tile"), KEY_P)); + paint_button->set_shortcut_context(this); paint_button->set_tooltip(TTR("RMB: Erase")); paint_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_NONE)); paint_button->set_toggle_mode(true); @@ -2117,6 +2118,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { line_button = memnew(Button); line_button->set_flat(true); line_button->set_shortcut(ED_SHORTCUT("tile_map_editor/line_fill", TTR("Line Fill"), KEY_L)); + line_button->set_shortcut_context(this); line_button->set_tooltip(TTR("RMB: Erase")); line_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_LINE_PAINT)); line_button->set_toggle_mode(true); @@ -2125,6 +2127,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { rectangle_button = memnew(Button); rectangle_button->set_flat(true); rectangle_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rectangle_fill", TTR("Rectangle Fill"), KEY_O)); + rectangle_button->set_shortcut_context(this); rectangle_button->set_tooltip(TTR("Shift+LMB: Keep 1:1 proporsions\nRMB: Erase")); rectangle_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_RECTANGLE_PAINT)); rectangle_button->set_toggle_mode(true); @@ -2133,6 +2136,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { bucket_fill_button = memnew(Button); bucket_fill_button->set_flat(true); bucket_fill_button->set_shortcut(ED_SHORTCUT("tile_map_editor/bucket_fill", TTR("Bucket Fill"), KEY_B)); + bucket_fill_button->set_shortcut_context(this); bucket_fill_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_BUCKET)); bucket_fill_button->set_toggle_mode(true); toolbar->add_child(bucket_fill_button); @@ -2140,6 +2144,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { picker_button = memnew(Button); picker_button->set_flat(true); picker_button->set_shortcut(ED_SHORTCUT("tile_map_editor/pick_tile", TTR("Pick Tile"), KEY_I)); + picker_button->set_shortcut_context(this); picker_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_PICKING)); picker_button->set_toggle_mode(true); toolbar->add_child(picker_button); @@ -2147,6 +2152,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { select_button = memnew(Button); select_button->set_flat(true); select_button->set_shortcut(ED_SHORTCUT("tile_map_editor/select", TTR("Select"), KEY_M)); + select_button->set_shortcut_context(this); select_button->connect("pressed", callable_mp(this, &TileMapEditor::_button_tool_select), make_binds(TOOL_SELECTING)); select_button->set_toggle_mode(true); toolbar->add_child(select_button); @@ -2172,9 +2178,9 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { // Menu. options = memnew(MenuButton); + options->set_shortcut_context(this); options->set_text("TileMap"); options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon("TileMap", "EditorIcons")); - options->set_process_unhandled_key_input(false); toolbar_right->add_child(options); PopupMenu *p = options->get_popup(); @@ -2191,6 +2197,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { rotate_left_button->set_focus_mode(FOCUS_NONE); rotate_left_button->connect("pressed", callable_mp(this, &TileMapEditor::_rotate), varray(-1)); rotate_left_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rotate_left", TTR("Rotate Left"), KEY_A)); + rotate_left_button->set_shortcut_context(this); tool_hb->add_child(rotate_left_button); rotate_right_button = memnew(Button); @@ -2199,6 +2206,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { rotate_right_button->set_focus_mode(FOCUS_NONE); rotate_right_button->connect("pressed", callable_mp(this, &TileMapEditor::_rotate), varray(1)); rotate_right_button->set_shortcut(ED_SHORTCUT("tile_map_editor/rotate_right", TTR("Rotate Right"), KEY_S)); + rotate_right_button->set_shortcut_context(this); tool_hb->add_child(rotate_right_button); flip_horizontal_button = memnew(Button); @@ -2207,6 +2215,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { flip_horizontal_button->set_focus_mode(FOCUS_NONE); flip_horizontal_button->connect("pressed", callable_mp(this, &TileMapEditor::_flip_horizontal)); flip_horizontal_button->set_shortcut(ED_SHORTCUT("tile_map_editor/flip_horizontal", TTR("Flip Horizontally"), KEY_X)); + flip_horizontal_button->set_shortcut_context(this); tool_hb->add_child(flip_horizontal_button); flip_vertical_button = memnew(Button); @@ -2215,6 +2224,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { flip_vertical_button->set_focus_mode(FOCUS_NONE); flip_vertical_button->connect("pressed", callable_mp(this, &TileMapEditor::_flip_vertical)); flip_vertical_button->set_shortcut(ED_SHORTCUT("tile_map_editor/flip_vertical", TTR("Flip Vertically"), KEY_Z)); + flip_vertical_button->set_shortcut_context(this); tool_hb->add_child(flip_vertical_button); clear_transform_button = memnew(Button); @@ -2223,6 +2233,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { clear_transform_button->set_focus_mode(FOCUS_NONE); clear_transform_button->connect("pressed", callable_mp(this, &TileMapEditor::_clear_transform)); clear_transform_button->set_shortcut(ED_SHORTCUT("tile_map_editor/clear_transform", TTR("Clear Transform"), KEY_W)); + clear_transform_button->set_shortcut_context(this); tool_hb->add_child(clear_transform_button); clear_transform_button->set_disabled(true); |