Commit graph

3849 commits

Author SHA1 Message Date
Rémi Verschelde
632a544c6e
Merge pull request #75527 from lawnjelly/growable_message_queue3
[3.x] Make MessageQueue growable
2023-04-11 22:01:32 +02:00
lawnjelly
5f1e7e6fbc Make MessageQueue growable
* Uses simple vector resizing (po2)
* Uses pair of read and write buffers
2023-03-31 10:07:56 +01:00
Fredia Huya-Kouadio
f3cdff46fc Add benchmark logic
Add benchmarking measuring methods to `OS` to allow for platform specific overrides (e.g: can be used to hook into platform specific benchmarking and tracing capabilities).
2023-03-20 23:29:36 -07:00
Haoyu Qiu
3544cd1dad Add Color + alpha constructor for Color 2023-03-16 14:51:40 +08:00
lawnjelly
910ddd13c4 Batching - Add MultiRect command
Large groups of similar rects can be processed more efficiently using the MultiRect command. Processing common to the group can be done as a one off, instead of per rect.

Adds the new API to VisualServerCanvas, and uses the new functionality from Font, BitmapFont, DynamicFont and TileMap, via the VisualServerCanvasHelper class.
2023-03-10 10:58:04 +00:00
Rémi Verschelde
5faa423944
Math: Prevent division by zero in posmod
Fixes #43932.

Co-authored-by: David Hoppenbrouwers <david@salt-inc.org>
(cherry picked from commit f011d8ca9c)
2023-03-06 13:48:13 +01:00
lawnjelly
5639be5f4f BVH - fix lockguards for multithread mode
Due to a lack of variable name, the BVH lock guards lifetimes previously did not cover the whole function call.
2023-02-20 15:43:19 +00:00
Pedro J. Estébanez
32a9227f5b Robustify multi-threading primitives 2023-02-17 19:16:10 +01:00
Marcin Nowak
22468ea1d3
Backport implement loading DDS textures at run-time 2023-02-17 11:27:47 +01:00
Pedro J. Estébanez
7d135cb962 Fix code style and consistency of RWLock and Semaphore 2023-01-28 14:17:51 +01:00
Hugo Locurcio
badcfa2523
Expose OS.read_string_from_stdin() to the scripting API
This can be used in scripts to read user input in a blocking manner.

This also removes the unused `block` argument, which is always `true`.
2023-01-16 11:39:53 +01:00
heppocogne
aa8d6c5633
Fix get_path() is not working when files are opend with open_compressed
And also fixed `get_absolute_path()` in the same way

(cherry picked from commit ea11ffc88c)
2023-01-11 14:34:51 +01:00
Rémi Verschelde
1426cd3b3a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".

Backported from #70885.
2023-01-10 15:26:54 +01:00
Rémi Verschelde
111de09c03
Merge pull request #71103 from AThousandShips/array_find_fix_3_x
[3.x] Fix for comparisons with PoolArrays
2023-01-09 14:19:18 +01:00
Ninni Pipping
f26069e94d Fix for PoolArray comparison 2023-01-09 10:24:08 +01:00
Hugo Locurcio
be3017114f Silence Input.vibrate_handheld() warning as it's already documented
The warning causes messages to be spammed if you are calling this
method in a game that runs on both desktop and mobile platforms,
unless you guard all calls to `Input.vibrate_handheld()` with
`OS.has_feature("mobile") or OS.has_feature("web")`.

Since the limitation is already documented (and is obvious enough
given the method's name), the warning message is redundant.

(cherry picked from commit 4a991887bf)
2022-12-18 10:32:04 +08:00
kobewi
9499ebecee Add vector value linking
Co-authored-by: redlamp <244062+redlamp@users.noreply.github.com>
(cherry picked from commit 5553e27fe8)
2022-12-18 10:32:04 +08:00
Rémi Verschelde
5d5f0a3958
Merge pull request #69963 from lawnjelly/variant_parser_optional_readahead_3
VariantParser make readahead optional [3.x]
2022-12-12 19:02:17 +01:00
lawnjelly
776c9d0579 VariantParser make readahead optional
It turns out some areas are independently moving / reading filepointers outside of the VariantParser, which can cause the readahead caching to get out of sync.

This PR makes the VariantParser readahead to be optional to allow for these use cases.
2022-12-12 15:44:39 +00:00
Rémi Verschelde
b0b759e6da
SCons: Cleanup DEBUG, _DEBUG and NDEBUG defines
- `_DEBUG` is MSVC specific so it didn't make much sense to define for
  Android and iOS builds.
- iOS was the only platform to define `DEBUG`. We don't use it anywhere
  outside thirdparty code, which we usually don't intend to debug, so it
  seems better to be consistent with other platforms.
- Consistently define `NDEBUG` to disable assert behavior in both `release`
  and `release_debug` targets. This used to be set for `release` for all
  platforms, and `release_debug` for Android and iOS only.
- Due to the above, I removed the only use we made of `assert()` in Godot
  code, which was only implemented for Unix anyway, should have been
  `DEV_ENABLED`, and is in PoolAllocator which we don't actually use.
- The denoise and recast modules keep defining `NDEBUG` even for the `debug`
  target as we don't want OIDN and Embree asserting all over the place.

(cherry picked from commit 26e9145c26)
2022-12-12 14:49:21 +01:00
Rémi Verschelde
c404cc0e58
Revert "RID: Change comparison operators to use RID_Data id instead of address" 2022-12-12 09:10:37 +01:00
Pedro J. Estébanez
0873cf0656 Keep a single, portable implementation of OS::get_processor_count()
(cherry picked from commit 6bf02c0162)
2022-12-12 14:47:37 +08:00
Emmanouil Papadeas
0754c7ee1a Fix InputEventAction's is_action method ignoring exact_match parameter
(cherry picked from commit 38b51942d6)
2022-12-12 14:44:20 +08:00
Rémi Verschelde
0cd3db459d
Merge pull request #65079 from lawnjelly/faster_variant_parser
Add readahead to VariantParser
2022-12-05 00:13:52 +01:00
lawnjelly
2ef0052113 Fix array-bounds warning in BVH
Provides a workaround to prevent tripping a compiler warning.

(cherry picked from commit 91d252c697)
2022-12-04 20:00:08 +08:00
voidshine
7284230ebe
Fix MIDI note-on events being converted to note-off events
Update documentation with note about MIDI velocity interpretation

(cherry picked from commit f0f72b3132)
2022-11-30 15:36:03 +01:00
Rémi Verschelde
9a340a2868
Project Manager: Fix hacky code for project rename
Instantiating a new ProjectSettings is *not* the way to go.
ConfigFile works just fine to read/change a single value.

Fixes memory leaks as the instantiated ProjectSettings was never freed.
Forbid doing this to prevent such problems.

Fixes #25661.

(cherry picked from commit f21f75eb6f)
2022-11-30 15:34:27 +01:00
dzil123
d7f6cc26d2
Fix Image::bump_map_to_normal_map incorrectly keeping mipmap flag
(cherry picked from commit 1fa8b3dd42)
2022-11-30 15:34:27 +01:00
Rafał Mikrut
e359ba3733
Fix exporting big templates
(cherry picked from commit 86fa3ba560)
2022-11-30 15:34:26 +01:00
lawnjelly
29d4d4105e Add readahead to VariantParser
Adds a readahead buffer to VariantParser, to prevent large numbers of freads for single bytes, which is inefficient.
2022-11-24 15:58:23 +00:00
Rémi Verschelde
4769aa4499
Merge pull request #64564 from timothyqiu/word-wrap-3.x
[3.x] Fix `String::word_wrap()` for long words
2022-11-24 16:06:52 +01:00
Rémi Verschelde
08a6aab661
Merge pull request #68735 from dzil123/v3_pckpacker_error_spam
[3.x] Fix PCKPacker error spam
2022-11-19 00:43:22 +01:00
dzil123
b3812750da [3.x] PCKPacker Fix error spam 2022-11-16 06:52:47 -08:00
Nonunknown
eb5b297fef
add ability to pick random value from array
(cherry picked from commit 9f4dbf415d)

Co-authored-by: BleedingXiko <66162192+BleedingXiko@users.noreply.github.com>
2022-11-14 19:11:41 +01:00
Rémi Verschelde
64635af7ff
Merge pull request #67360 from jordo/PR-expose-property-hints
expose additional global enums in 3.x which are available in master
2022-10-31 12:25:04 +01:00
Rémi Verschelde
20ce0284cf
Merge pull request #67313 from Mickeon/3.x-rename-params
[3.x] Rename `set_indexed` & `get_child`'s params to be clearer
2022-10-31 12:24:58 +01:00
bruvzg
987723b386
[iOS] Fix build with warnings=extra. 2022-10-31 11:59:31 +02:00
Fredia Huya-Kouadio
be4b07c3e4 Add double_tap attribute to InputEventScreenTouch
This provides parity with the `InputEventMouseButton` allowing for proper conversion between the two events.
2022-10-20 11:56:11 -07:00
Jordan Schidlowsky
dc5226ecfd expose additional global enums in 3.x which are available in master 2022-10-14 09:33:24 -06:00
Micky
6102f3cfc2 [3.x] Rename set_indexed & get_child's params to be clearer
3.x backport of #67300 and #64463.
2022-10-12 20:55:41 +02:00
Rémi Verschelde
b3301d22c5 Merge pull request #66168 from Calinou/expose-os-restart-on-exit-3.x
Expose the "restart on exit" OS functionality (3.x)
2022-10-04 16:57:43 +02:00
Rémi Verschelde
506f7d8360 Merge pull request #64870 from MarcusElg/naninfprinting3.x
[3.x] Improve string formatting (%f) for inf and nan
2022-10-03 13:57:30 +02:00
Rémi Verschelde
f9b91d8d24 Style: Ensure consistent formatting with clang-format 15 2022-09-21 13:23:17 +02:00
lawnjelly
17f42e8e66 Improve signal already connected error message
The signal already connected message is improved to provide the names of the objects involved.
2022-09-21 07:52:30 +01:00
Hugo Locurcio
76a14cfd02
Expose the "restart on exit" OS functionality
This can be used to restart a project with specific command line arguments
applied. This can work in tandem with `OS.get_cmdline_args()` to restart
with the same command line arguments as used to originally run the project.

Example use cases:

- Restart to apply an user setting change that requires a restart to work.
- Restart with a Godot command line argument to change the video driver,
  audio driver, etc.
2022-09-20 17:27:46 +02:00
Rémi Verschelde
2aee09c6bc
Merge pull request #65428 from lawnjelly/input_uninit 2022-09-09 14:28:06 +02:00
Micky
93943bc1b9 Prevent HTTPRequest from polling invalid client
(cherry picked from commit 9e284f68ec)
2022-09-09 14:17:24 +02:00
Haoyu Qiu
7ed2b09bc0 Fix parsing of XML CDATA and add test cases 2022-09-09 10:16:36 +08:00
lawnjelly
d60eae3dbc Fix uninitialized data reads in Input
Found by Valgrind.
2022-09-06 14:21:01 +01:00
kobewi
fdbef1c074 Add Dictionary.find_key() 2022-09-05 16:08:41 +02:00
Rémi Verschelde
b38ac3f09f
Merge pull request #55618 from madmiraal/fix-55384-3.x 2022-09-01 23:58:12 +02:00
Marcel Admiraal
3cbc6330bb Fix Geometry::get_closest_points_between_segments() returns NaN
Also fix Geometry::get_closest_distance_between_segments() returning
incorrect values.
2022-09-01 17:51:33 +01:00
Rémi Verschelde
4196cc0c00
Merge pull request #64445 from timothyqiu/action-completion-3.x
[3.x] Fix action name completion for `Input.get_{axis,vector}`
2022-09-01 08:20:40 +02:00
Fredia Huya-Kouadio
9910d4681d Additional fixes to the Android get_current_dir() implementation. 2022-08-30 10:08:30 -07:00
Pedro J. Estébanez
29e235b341 Add FileAccess::get_access_type()
(cherry picked from commit 8c6b2fbb90)
2022-08-29 15:44:29 +02:00
Rémi Verschelde
a21221d70c
Merge pull request #64298 from Razoric480/raz/bin-cache
Fix binary resource internal cache not being filled at polling time
2022-08-29 07:04:31 +02:00
Hugo Locurcio
3b31ff9008
Optimize String.repeat()
This backports the optimization done in `master`.

Co-authored-by: VolTer <mew.pur.pur@abv.bg>
2022-08-28 18:27:42 +02:00
Rémi Verschelde
5beec641b6
Merge pull request #64933 from madmiraal/fix-error_macros-header-guard-3.x
[3.x] Fix header guard in error_macros.h
2022-08-27 09:17:04 +02:00
Rémi Verschelde
c78c9bcf96
Merge pull request #64926 from RandomShaper/ps_res_path_3.x
[3.x] Determine `ProjectSettings`' resource path early
2022-08-26 23:03:06 +02:00
Marcel Admiraal
e2dac6ecd9 Fix header guard in error_macros.h 2022-08-26 16:04:54 +01:00
Pedro J. Estébanez
89892e4f32 Determine ProjectSettings' resource path early 2022-08-26 15:09:19 +02:00
Marcus Elg
e9cbe9517b Improve %f formatting for inf and nan 2022-08-25 12:58:38 +02:00
Rémi Verschelde
8388ea1d6b
Merge pull request #64839 from akien-mga/3.x-zstd-1.5.2
zstd: Update to upstream version 1.5.2
2022-08-25 00:51:28 +02:00
bruvzg
b7c9eb1a3c Add arch flag to assembler to fix build on ARM64 macOS / iOS.
(cherry picked from commit b767d2e0fd)
2022-08-24 18:26:28 +02:00
Rémi Verschelde
bda382684f zstd: Update to upstream version 1.5.2
Release notes:
- https://github.com/facebook/zstd/releases/tag/v1.5.1
- https://github.com/facebook/zstd/releases/tag/v1.5.2

(cherry picked from commit 39ed39900e)
2022-08-24 18:26:14 +02:00
Marcin Nowak
90762b9660 [3.x] Backport panning strength parameters from 4.0 2022-08-23 23:27:51 +02:00
Haoyu Qiu
51fd1c27aa Fix String::word_wrap() for long words 2022-08-18 16:56:38 +08:00
Haoyu Qiu
e6dd71d227 Fix action name completion for Input.get_{axis,vector} 2022-08-15 23:44:11 +08:00
Francois Belair
d331e5c7ac Fix binary internal cache not being filled 2022-08-14 12:30:59 -04:00
Haoyu Qiu
2d93718cd2 Add clear method to pool arrays 2022-08-10 17:31:29 +08:00
Rémi Verschelde
8cec1c63c2
Merge pull request #63629 from dsnopek/fix-locale-remap-with-binary-resources-3.x
[3.x] Fix locale resource remapping with binary conversion on export
2022-08-08 20:03:56 +02:00
David Snopek
0cf4ba0d84 Fix locale resource remapping with binary conversion on export 2022-08-08 09:38:39 -05:00
Rémi Verschelde
6eee83579a
Merge pull request #64101 from timothyqiu/subsecond 2022-08-08 16:31:49 +02:00
Rémi Verschelde
7dc8ec0c61
Merge pull request #63643 from aaronfranke/3.x-mouse-mode-ch 2022-08-08 14:36:45 +02:00
Haoyu Qiu
1be078ebcb Fix Time.get_unix_time_from_system() not including msecs 2022-08-08 20:31:51 +08:00
Fabio Alessandrelli
ee5eb943f7 [File] Fix FileAccessCompressed::get_buffer return value.
It used to return the write index instead of the written bytes (i.e.
index + 1) when reading until last block.

(cherry picked from commit e8f7b79bb0)
2022-08-08 09:50:41 +02:00
Rémi Verschelde
0bed7ea63f
Merge pull request #61316 from bruvzg/tts_3x
[3.x] Backport text-to-speech support.
2022-08-05 23:45:51 +02:00
Rémi Verschelde
0dccbcd7ce
Merge pull request #61878 from bruvzg/backport_locale_select
[3.x] Backport locale selection improvements.
2022-08-05 23:45:17 +02:00
Rémi Verschelde
14c9325b5d
Merge pull request #62408 from Razoric480/raz/fix-no-cache
[3.x] Fix nested resources being cached if no-cache argument used
2022-08-05 23:43:54 +02:00
Rémi Verschelde
daa5b542b4
Merge pull request #56765 from madmiraal/fix-45592-2-3.x
[3.x] Fix mouse speed not changing fast enough
2022-08-05 22:37:44 +02:00
Rémi Verschelde
26762a71b6
Merge pull request #58537 from winterpixelgames/feature/virtual-keyboard-types-3.x 2022-08-05 19:37:13 +02:00
Fabio Alessandrelli
4e33610fb0 [Core] Use std type traits to check operations triviality.
(cherry picked from commit 6f02183f8c)
2022-08-04 15:20:28 +02:00
Rémi Verschelde
751b16a285 File: Re-add support to skip CR (\r) in File::get_as_text
This was removed in #63481, and we confirmed that it's better like this,
but we add back the possibility to strip CR as an option, to optionally
restore the previous behavior.

For performance this is done directly in `String::parse_utf8`.

Also fixes Android `FileAccess::get_line()` as this one _should_ strip CR.

Supersedes #63717.

(cherry picked from commit 1418f97c70)
2022-08-01 00:40:55 +02:00
David Snopek
5eaf83f2d7 Add error messages and docs to explain restrictions when calling NetworkedMultiplayerCustom.initialize() 2022-07-29 13:51:44 -05:00
Aaron Franke
0d6e2d1090
Add MOUSE_MODE_CONFINED_HIDDEN to MouseMode enum 2022-07-29 13:46:04 -05:00
David Snopek
738e76b710 Add error messages and docs to explain allowed transitions in NetworkedMultiplayerCustom.set_connection_status() 2022-07-29 09:02:53 -05:00
pattlebass
fb7ecc748f [3.x] HTML5: Add support for Input.vibrate_handheld() 2022-07-28 13:20:05 +03:00
Rémi Verschelde
6c8d9b8401
Merge pull request #63480 from m4gr3d/fix_remaining_scoped_storage_regressions_3x
[3.x] Address remaining scoped storage regressions
2022-07-26 18:15:14 +02:00
Fredia Huya-Kouadio
fc2c202312 Address remaining scoped storage regressions
- Accelerate common path used to check the storage scope for a given path
- Update the logic for the `get_as_text()` method - previous logic loads the content of a text file one byte at a time
2022-07-26 07:42:49 -07:00
Ricardo Buring
90725964a4 Fixup BVH debugging statements 2022-07-25 18:35:14 +02:00
Rémi Verschelde
818f1eed31 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 14:53:37 +02:00
Rémi Verschelde
c8099e9524
Merge pull request #63223 from m4gr3d/fix_slow_copy_3x
[3.x] Address slow copy performance when using the `FileAccessFilesystemJAndroid` implementation
2022-07-22 00:21:59 +02:00
Fredia Huya-Kouadio
aab26ad7d2 Address slow copy performance when using the FileAccessFilesystemJAndroid implementation.
Read/write ops for this implementation are done through the java layer via jni, and so for good performance, it's key to avoid numerous repeated small read/write ops due the jni overhead.

The alternative is to allocate a (conversatively-sized) large buffer to reduce the number of read/write ops over the jni boundary.
2022-07-21 08:21:12 -07:00
Rémi Verschelde
4ef99b409d
Merge pull request #63163 from dsnopek/multiplayer-peer-custom-3.x 2022-07-20 22:41:15 +02:00
fabriceci
43e9816fb1 Fix the calculation of the angular velocity when the rotation speed is not high.
(cherry picked from commit db7c91e0ad)
2022-07-19 17:16:21 +02:00
Pedro J. Estébanez
4e1f30390d Use the right memory ordering in SafeNumeric operations
(cherry picked from commit 02a584d8e6)
2022-07-19 17:10:26 +02:00
David Snopek
8ad5889c1a Add NetworkedMultiplayerCustom so high-level multiplayer backends can be added from GDScript 2022-07-19 09:16:41 -05:00
Aaron Franke
f60cc50667
[3.x] Add forwards-compatible aliases for pool/packed arrays 2022-07-18 12:37:15 -05:00
Kirill Diduk
910c67b268 [GDNative] Expose String::join() to GDNative Core API v1.3 2022-07-16 16:31:32 +02:00
Kirill Diduk
2cd87ef226 [GDNative] Refactoring: add const to has and join methods of pooled arrays 2022-07-16 14:08:42 +02:00