Commit graph

120 commits

Author SHA1 Message Date
Mai Lavelle
ce43781cb3 Fix input methods returning zero strength when pressed status not requested
Fixes behavior of these methods:

`InputMap::event_get_action_status`
`InputEvent*::action_match`

Previously when `p_pressed` was `nullptr`, `p_strength` would be set to
`0.0f` regardless of event strength. This affected `InputEventAction` events
processed by `Input.parse_input_event` for example.

Regression found in afa89c9eea
2021-08-16 00:53:01 -04:00
Rémi Verschelde
81512a3732
Style: Cleanup code using text_editor/completion/use_single_quotes 2021-08-13 21:27:57 +02:00
Pedro J. Estébanez
dc187324be Add input buffering framework
Input buffering is implicitly used by event accumulation, but this commit makes it more generic so it can be enabled for other uses.

For desktop OSs it's currently not feasible given main and UI threads are the same).
2021-08-13 11:19:19 +02:00
Pedro J. Estébanez
7c864d41c9 Improve input event accumulation
- API has been simplified: all events now go through `parse_input_event()`. Whether they are accumulated or not depends on the `use_accumulated_input` flag.
- Event accumulation is now thread-safe (it was not needed so far, but it prepares the ground for the following changes).
- Touch drag events now support accumulation.
2021-08-13 11:19:19 +02:00
Aaron Franke
fa3a32a2d6
Use Key enum instead of plain integers 2021-08-10 16:26:55 -05:00
Bhuvan Vemula
a0a019a998 Added EditorCommandPalette 2021-08-09 17:41:50 +05:30
Julien Nguyen
daee3c316f Fix action_get_events returning booleans instead of InputKey entries 2021-08-07 21:17:55 +02:00
Rémi Verschelde
ac3322b0af
Use const references where possible for List range iterators 2021-07-25 12:22:25 +02:00
Aaron Franke
4e6efd1b07
Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -04:00
Aaron Franke
4147c67bb0
Fix Input get_action_raw_strength 2021-07-22 21:05:44 -04:00
Rémi Verschelde
a98677181b
Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@241fed0a44.
2021-07-20 13:08:50 +02:00
reduz
6631f66c2a Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.

This is part of ongoing work to optimize GUI and the editor.
2021-07-18 21:20:02 -03:00
Fabio Alessandrelli
5717118bcc [HTML5] Add 2 controllers to the godot database.
Sony PlayStation DualShock 4 (054c:05c4 first gen).
Unofficial Switch controller.
2021-07-17 23:51:48 +02:00
Eric M
c2ba7464b6 Added EditorInspectorPlugin to aid in editing InputEvents in resources and shortcuts 2021-07-06 23:50:33 +10:00
Nick H
c6f28ed62b Add get_dead_zone() method to InputMap
This commit adds a new method to the `InputMap`, allowing the user to get the value of an action's dead zone as a float.
2021-07-02 03:07:37 -04:00
Aaron Franke
0ce49800ac
Use mouse and joypad enums instead of plain integers
Also MIDIMessage
2021-06-20 11:54:24 -04:00
Aaron Franke
e919d894f8
Move many input enums to their own file 2021-06-20 11:53:01 -04:00
Lightning_A
e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Rémi Verschelde
4effadc0ba
Merge pull request #48696 from madmiraal/fix-48692
Fix `InputMap.action_erase_event()` failing to erase events correctly.
2021-06-20 00:29:42 +02:00
Gregory Basile
8ab13f8ace Documentation search fixes
Updates rich_text_label so that the built-in documentation can be searched
Previously, it would only find the first result and would not select other results
Renames "_entered" functions to "_submitted"
2021-06-16 09:43:34 -07:00
SpaghettiCoder01
5b81af09dc Added Input_Map entry for backspacing using Shift+Backspace 2021-06-15 04:30:49 +01:00
Haoyu Qiu
c727d40507 Fix InputEventJoypadButton::as_text crash for invalid button index 2021-06-13 13:53:11 +08:00
Aaron Franke
98aa3b669e
Add MOUSE_MODE_CONFINED_HIDDEN
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2021-06-03 11:44:28 -04:00
Paulb23
1c16673798 Move and expose AutoComplete in CodeEdit 2021-06-01 15:38:45 +01:00
Hugo Locurcio
80f4e407b2
Add a keyboard shortcut to select the word under cursor in TextEdit
This also acts as a general-purpose "deselect" shortcut since pressing
it a second time will deselect text.

This is available both in the script editor and in TextEdit fields
in use, both in the editor and projects.

The Duplicate Line script editor shortcut was moved to Ctrl + Shift + D
since it conflicts with the new shortcut (Ctrl + D). The rationale for
doing so is that Duplicate Line is a less commonly used action, and
its behavior can be replicated by copying and pasting the current line
anyway. (With no selection active, the whole line will be copied.)
2021-05-22 23:47:43 +02:00
Tomasz Chabora
b1859510ab Change behavior of String.right 2021-05-20 23:07:57 +02:00
Rémi Verschelde
4219a4cb6f
Fix typos with codespell
Using codespell 2.0.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
GIRD
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2021-05-20 12:38:56 +02:00
Marcel Admiraal
7104229a85 Fix InputMap.action_erase_event() failing to erase events correctly. 2021-05-19 11:43:02 +01:00
Rémi Verschelde
6c367f8e0d
Merge pull request #48168 from LightningAA/control-to-ctrl-4.0 2021-05-17 17:38:02 +02:00
fox
df52f5de75 Fix typo in InputEventMIDI string 2021-05-17 09:54:28 -04:00
Marcel Admiraal
5cdf167dcc Make printing of InputEvents consistent
- Removes the undesired spaces before the colon
- Adds missing commas between parameters
- Adds quotes or brackets to strings
- Removes brackets around single values
2021-05-15 13:55:22 +01:00
Lightning_A
97fecd1b69 Rename "Control" key to "Ctrl" and add "_pressed" suffix to all InputEventWithModifiers properties/methods 2021-05-07 14:00:50 -06:00
Aaron Franke
0de9a7d803
Rename doubleclick to double_click 2021-05-04 04:38:08 -04:00
kobewi
76903d2c44 Add Enter as alternate key to complete code 2021-05-03 19:28:59 +02:00
Rémi Verschelde
8247667a3e
Core: Drop custom copymem/zeromem defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.
2021-04-27 16:26:27 +02:00
Rémi Verschelde
7e215a4b54
Merge pull request #35666 from Calinou/inputmap-nonexistent-suggestions
Print suggestions when requesting a nonexistent InputMap action
2021-04-18 11:39:12 +02:00
Hugo Locurcio
71b254f68e
Print suggestions when requesting a nonexistent InputMap action
Co-authored-by: Marc Gilleron <marc.gilleron@gmail.com>
2021-04-18 02:38:42 +02:00
Marcel Admiraal
0fb4dbf1bd Avoid creating joy_names map entries when using Map operator[] 2021-04-17 20:29:04 +01:00
Rémi Verschelde
f83486b430
Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@01dce71403.
2021-04-06 22:39:35 +02:00
Rémi Verschelde
cde67f0315
Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@807ac1fbf9.
2021-03-23 13:18:43 +01:00
Aaron Franke
a5324787c8
Rename some more global enums (Key, Joy, MIDI) 2021-03-23 07:13:23 -04:00
Aaron Franke
10d7fccb54
Rename ButtonList enum and members to MouseButton 2021-03-23 07:13:23 -04:00
Fabio Alessandrelli
70d5f652a2 [HTML5] Logitech Dual Action Gamepad FF/Linux 2021-03-21 15:59:31 +01:00
Anshul7sp1
91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
Rémi Verschelde
65305ea001
Merge pull request #46371 from EricEzaM/PR/fix-osx-inputmap-spammed-errors
Fixed 'nonexistent action' errors spammed at startup on OSX
2021-02-24 16:52:52 +01:00
Eric M
d91e915d79 Fixed 'nonexistent action' errors spammed at startup on OSX 2021-02-24 23:16:22 +10:00
Liz Haas
2aee71d52d Input: Throw error if action doesn't exist
Thow errors if requesting an unexisting InputMap action.
Makes `Input.is_action_*` methods consistents with `Event.is_action_*` which already throw errors.

fixes #33303
2021-02-24 13:49:21 +01:00
Rémi Verschelde
12cc660d7d Input: Swap events for ui_redo to favor Shift+Ctrl+Z over Ctrl+Y
That's the most common one we've been using for the general editor, and while the script editor
also supports Ctrl+Y, it should have lower priority.

In theory this code should make both be supported the same but for some reason the general editor
only seems to use the first entry (the script editor does support both).
2021-02-22 15:04:09 +01:00
Rémi Verschelde
0d1d719178 doc: Sync classref with current source
And fix various bogus bindings following previous PRs.
2021-02-19 14:39:14 +01:00
Eric M
49714b0963 Removed hardcoded shortcuts from /scene and converted to input actions
This removes hardcoded actions from things like LineEdit and TextEdit.

Previously, things like copy, paste, etc were all hardcoded to Ctrl+C, Ctrl+V, etc. They could not be changed. This allows the possibility of them being changed, by making them use the action map. This has the added benefit of greatly simplifying the input handling logic in those controls. The logic which was previously in a huge and hard to follow switch statement has been extracted to individual methods.
2021-02-18 16:22:51 +01:00