Commit Graph

853 Commits

Author SHA1 Message Date
Rémi Verschelde afe8492241 Fix typos with codespell
Using codespell 2.2-dev from current git.

Fix a couple incorrect uses of gendered pronouns.
2022-06-19 14:06:55 +02:00
Rémi Verschelde 4c5d2159f5 Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@b7d126eb71

(cherry picked from commit 30fbb8964d)
2022-05-05 15:47:02 +02:00
Haoyu Qiu a3f91b9fdc Fix left aligned integer sign in string formatting
(cherry picked from commit 767134fd8d)
2022-05-05 15:17:52 +02:00
snowapril 776bca2488 Fix crash on get index for non-existing string
As _buttons and _axes have both valid string and nullptr.
When iterating over them, if given key exists it will work correctly.
But if given key does not exist, it will end up with
String::operator=(nullptr). As String constructor from nullptr exists, I
use it.

(cherry picked from commit c77b710035)
2022-03-17 13:05:35 +01:00
Rémi Verschelde 4eef71d921 Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@94b76208bc

(cherry picked from commit e3d89a76f7)
2022-02-21 11:11:48 +01:00
Powerbyte7 f5db3d815d [HTML5] Add Stadia controller to database
Add web support for the Stadia controller.

(cherry picked from commit b8a7ea034c)
2022-02-21 11:11:00 +01:00
Rémi Verschelde e33a73d66e
EditorProperty: Fix range hint parsing with optional step
This could lead to have a step of 0 when parsing e.g. "1,10,is_greater".

(cherry picked from commit 80306cc88a)
2022-02-17 10:21:54 +01:00
Rémi Verschelde 0e0ccc4adf
ImageLoader: Remove references to unsupported svgz extension
I don't see any reference to gzip/svgz supported in the nanosvg library,
and the handful of test gzip compressed svgz files I tried failed loading.

Also cleaning a couple missing includes in platform export code.

(cherry picked from commit 1ee44b2366)
2022-01-25 18:41:01 +01:00
Rémi Verschelde 71066cd63b
Update copyright statements to 2022
Happy new year to the wonderful Godot community!

(cherry picked from commit a627cdafc5)
2022-01-13 16:00:37 +01:00
bruvzg b7fbfc2776
Add joystick button index boundary check. Increase max. button number to 128 (max. buttons supported by DirectInput).
(cherry picked from commit 61ea8f8337)
2022-01-12 16:29:19 +01:00
Rémi Verschelde 2e8fdd0112
Fix typos with codespell
Using codespell 2.1.0.

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

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```

(cherry picked from commit b197de6f5f)
2022-01-07 00:17:47 +01:00
Marcel Admiraal fbf32c1ea2
Revert "[3.x] Fixed event spam when using the Nintendo Switch controller"
(cherry picked from commit 9f250e8370)
2021-12-21 12:23:20 +01:00
Rémi Verschelde 60c0e8299d
Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@265b43b789.

(cherry picked from commit ed395c6b99)
2021-12-17 00:15:03 +01:00
Sam Lantinga 3c752893c5
Fixed event spam when using the Nintendo Switch controller
There is no filtering on the Nintendo Switch Pro controller thumbstick, so there will frequently be events with very slight change. These are turned into "not pressed" events, which cancel "pressed" events from keys and buttons.

This change filters out up to 5% jitter, but it might be worth revisiting whether "not pressed" events should cancel "pressed" events.

(cherry picked from commit e5b0f86260)
2021-12-16 23:01:39 +01:00
Haoyu Qiu b90bec546d
Make `--doctool` locale aware
* Adds `indent(prefix)` to `String`
* Moves the loading of tool/doc translation into
  `editor/editor_translation.{h,cpp}`
* Makes use of doc translation when generating XML class references, and
  setup the translation locale based on `-l LOCALE` CLI parameter.

The XML class reference won't be translated if `-l LOCALE` parameter is
not given, or when it's `-l en`.

(cherry picked from commit c11b1850c4)
2021-12-16 17:06:52 +01:00
Rémi Verschelde 2813713be7
Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@348cfa347f.

(cherry picked from commit 03e105f677)
2021-12-10 11:19:21 +01:00
Yuri Sizov fce6e13034
Make default/project theme wait for modules before initializing
(cherry picked from commit 33fb44223f)
2021-12-02 17:32:36 +01:00
Rémi Verschelde 49285b2639
Remove editor splash screen with sponsors logo
The Godot Project Leadership Committe has decided to update the sponsoring
tiers so that the Platinum Sponsorship no longer includes a logo on the
editor splash screen.

This lets us reclaim the editor splash screen space for community-related
content instead of sponsors (e.g. a different community-designed splash
screen for each stable branch?).

Also removes two Platinum Sponsors whose sponsorship has expired earlier this
year.

(cherry picked from commit c283fce698)
2021-12-01 14:36:03 +01:00
bruvzg b8f888a43b
Add Input.is_physical_key_pressed method.
(cherry picked from commit 9877d91c4a)
2021-11-25 23:13:15 +01:00
lawnjelly 07e5022cce
BVH - add option for expanded AABBs in leaves
This PR adds a define BVH_EXPAND_LEAF_AABBS which is set, which stores expanded AABBs in the tree instead of exact AABBs.

This makes the logic less error prone when considering reciprocal collisions in the pairing, as all collision detect is now taking place between expanded AABB against expanded AABB, rather than expanded AABB against exact AABB.

The flip side of this is that the intersection tests will now be less exact when expanded margins are set.

All margins are now user customizable via project settings, and take account of collision pairing density to adjust the margin dynamically.

(cherry picked from commit 211dc8cd2d)
2021-11-25 23:13:14 +01:00
Rémi Verschelde 63b5d5de64
Modules: Make sure to include `modules_enabled.gen.h` where needed
Fixes #51677.

Co-authored-by: Arkadiusz Marcin Kołek <aksoftware91@gmail.com>
(cherry picked from commit 6f4858f184)
2021-11-15 22:36:02 +01:00
Rémi Verschelde 7afb784269
Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@322aac4bb7.

Also improve parser errors to allow identifying the problematic mappings.

(cherry picked from commit 4b247e7ffa)
2021-11-03 21:32:53 +01:00
Rémi Verschelde 42d385b312
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 13:23:38 +02:00
Pawel Lampe cc0479a17e
Fix exit code for --script --check-only, fixes #54087
this commit makes godot executable to return zero exit code
once a valid script is passed via --script during --check-only

(cherry picked from commit 75ae3164a4)
2021-10-23 12:00:28 +02:00
Rémi Verschelde c743649c0b
Merge pull request #53742 from DmitriySalnikov/exposed_sensor_setters 2021-10-18 23:01:07 +02:00
Rémi Verschelde a5093d64ac
SCons: List `.gen.cpp` sources explicitly to avoid globbing errors
Whenever we change the name (or remove) generated cpp files with the `.gen.cpp`
extension, users run into build issues when switching between branches (i.e.
switching before and after the name change/removal). This is because we glob
`*.cpp` so if a now-obsolete file from a previous build is present, we'll
include it too, potentially leading to bugs or compilation failure (due to
missing headers or invalid code).

So globbing patterns in `add_source_files` will now skip files ending with
`.gen.cpp`, which should instead be passed explicitly where they're used.

(cherry picked from commit c133480531)
2021-10-16 10:59:14 +02:00
Дмитрий Сальников 5cf898b897 Exposed setters for sensor values in Input class 2021-10-12 23:09:30 +03:00
Yuri Sizov b02c61ddb1 Ignore OS specific values (constants, project settings, properties)
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2021-10-10 23:40:32 +03:00
Rémi Verschelde 77f52bdf99
Merge pull request #52137 from Ansraer/3.x-2d-scale-factor 2021-10-05 19:12:19 +02:00
Ansraer d44aa61735 implement better ui scaling 2021-10-05 14:30:38 +02:00
Rémi Verschelde 7c9e06f936
Merge pull request #48686 from bruvzg/bundle_icon_3 2021-09-30 14:55:41 +02:00
Manuel Moos f8e62424c5 Fix negative delta arguments
Three attack points, all after the regular calculations:
1. Prevent negative physics timestep counts. They could occur if
   physics_jtter_fix is changed at runtime.
2. idle_step is not allowed to go below 1/8th of the input step.
   That could happen on physics_jitter_fix changes or heavily
   fluctuating performance.
3. Prevent that the idle_step modification breaks the promise
   that Engine.get_physics_interpolation_fraction() is between
   0 and 1 by doing more physics steps than the base system wants.

Fixes #26887

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
Cherry-Pick from 6be702bace.
2021-09-22 21:09:38 +02:00
jmb462 e7dac5da41
Adding InputMap action error suggestion for Input singleton
(cherry picked from commit a3b9842616)
2021-09-21 17:14:58 +02:00
Hugo Locurcio b63016c571
Display an alert when attempting to run a project with no main scene
This gives visual feedback when not starting Godot from a terminal.
This could lead to confusion when placing a Godot binary within a
project folder that has no main scene defined.

(cherry picked from commit 87fb9297e3)
2021-09-21 17:14:58 +02:00
tommyZZM f2a3af47e4 [3.x] Backport Accept global classes for MainLoop type in project settings
https://github.com/godotengine/godot/pull/41190
2021-09-06 23:18:06 +08:00
Hugo Locurcio 59f24d8867
Define a default minimum window size to workaround rendering issues
The minimum window size can still be set to `Vector2(0, 0)` in a script
if needed.
2021-08-23 04:10:24 +02:00
Rémi Verschelde ffc372b002
Merge pull request #42220 from RandomShaper/agile_input_3.2
[3.x] Improve responsiveness on underpowered Android devices
2021-08-12 22:46:17 +02:00
lawnjelly 3025b6d299 Delta smoothing - fix overflow for long frames
Extremely long frames caused by suspending and resuming the machine could result in an overflow in the delta smoothing because it uses 32 bit math on delta values measured in nanoseconds.

This PR puts a cap of a second as the maximum frame delta that will be processed by the smoothing, otherwise it returns the frame delta 64 bit value unaltered. It also converts internal math to explicitly use 64 bit integers.
2021-08-11 09:47:23 +01:00
Pedro J. Estébanez 31a0ca2cac Add project setting for agile input event flushing
If enabled, key/touch/joystick events will be flushed just before every idle and physics frame.

Enabling this can greatly improve the responsiveness to input, specially in devices that need to run multiple physics frames per each idle frame, because of not being powerful enough to run at the target frame rate.

This will only work for platforms using input buffering (regardless event accumulation). Currenly, only Android does so, but could be implemented for iOS in an upcoming PR.
2021-08-08 12:37:55 +02:00
Pedro J. Estébanez 7be9c26e20 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-08 12:37:55 +02:00
Pedro J. Estébanez 58a54f534e 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-08 12:37:55 +02:00
lawnjelly 37f20e1d78 Fix Transform::xform(Plane) functions, add Transform unit tests
The Transform::xform and xform_inv are made safe for Planes when using non-uniform scaling.

Basic unit tests for Transform.

Optimization of calling sites to prevent loss of performance from the changes to xform(Plane).
2021-08-07 08:05:39 +01:00
Hugo Locurcio 21a68d1c44
Print a warning when the engine is started as `root`/superuser
This is a security risk (especially when hosting a game server)
and can make audio non-functional on Linux.

(cherry picked from commit 9c34db6cb4)
2021-08-03 10:20:18 +02:00
lawnjelly 98a39aade9 Profiling - fix frame_time measurement
When the `sync_after_draw` feature was on it was possible for the profiler's frame_time measurement to be incorrect. This fixes this problem by storing the raw measured time for use by the profiler.
2021-08-01 10:05:43 +01:00
EricEzaM 0e5c6e0d55 Allow checking for exact matches with Action events.
Added additional param to action related methods to test for exactness.
If "p_exact_match" is true, then the action will only be "matched" if the provided input event *exactly* matches with the action event.

Before:
* Action Event = KEY_S
* Input Event = KEY_CONTROL + KEY_S
* Is Action Pressed = True

Now:
You can still do the above, however you can optionally check that the input is exactly what the action event is:
* Action Event = KEY_S
* Input Event = KEY_CONTROL + KEY_S
* p_exact_match = True
* Is Action Pressed = False
* If the Input Event was only KEY_S, then the result would be true.

Usage:

```gdscript
Input.is_action_pressed(action_name: String, exact_match: bool)
Input.is_action_pressed("my_action", true)

InputMap.event_is_action(p_event, "my_action", true)

func _input(event: InputEvent):
  event.is_action_pressed("my_action", false, true) # false = "allow_echo", true = "exact_match"
  event.is_action("my_action", true)
```

Co-authored-by: Eric M <itsjusteza@gmail.com>
2021-07-30 15:35:39 +02:00
Aaron Franke 69fb14256b
[3.x] Allow getting Input axis/vector values from multiple actions
For get_vector, use raw values and handle deadzones appropriately
2021-07-23 19:17:55 -04:00
Aaron Franke afa89c9eea
[3.x] Add raw strength value for internal use 2021-07-23 19:09:53 -04:00
lawnjelly 93557927e4 Add option to sync frame delta after draw
Investigations have showed that a lot of the random variation in frame deltas causing glitches may be due to sampling the time at the wrong place in the game loop.

Although sampling at the start of Main::Iteration makes logical sense, the most consistent deltas may be better measured after the location likely to block at vsync - either the OpenGL draw commands or the SwapBuffers.

Here we add an experimental setting to allow syncing after the OpenGL draw section of Main::Iteration.
2021-07-22 12:04:22 +01:00
Rémi Verschelde d3f500cf33
Merge pull request #48390 from lawnjelly/delta_smooth
Add frame delta smoothing option
2021-07-22 12:43:39 +02:00
Rémi Verschelde 801205b2c1
Merge pull request #48892 from lawnjelly/bvh_robust
BVH - thread safety option
2021-07-22 12:41:42 +02:00