Commit Graph

3858 Commits

Author SHA1 Message Date
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
Rémi Verschelde 101cbe5d5b
Merge pull request #62723 from hansemro/eraser-detect-3.x 2022-07-15 00:13:15 +02:00
Francois Belair 2ceb93bbef Fix custom res caching sub-res even if no-cache
Fixes #59686, fixes #59752
2022-07-13 11:18:26 -04:00
Kirill Diduk 7b8b91f505 [GDScript][GDNative] Add 'sort' and 'has' methods to pooled arrays
This is a backport from 4.0 to 3.x that adds 'sort' and 'has' methods
to the following types:
- PoolByteArray
- PoolIntArray
- PoolRealArray
- PoolStringArray
- PoolVector2Array
- PoolVector3Array
- PoolColorArray

For all the types above, the methods 'sort' and 'has' have been
exposed to the GDNative API (v. 1.3)

Since the method 'has' was already implemented in GDScript before,
in this commit it has been only exposed to GDNative API.

The classes documentation is updated.

The method 'sort' uses the exisging class "Sorter".

Pooled arrays in 4.0 are rewritten, that's why this backport is not
completely indentical to the original PR made for 4.0 (see #32144).
2022-07-07 23:24:31 +02:00
Brian Semrau ce24b48e50 Add support for multiple virtual keyboard types 2022-07-07 14:22:28 -04:00
Rémi Verschelde be85923dc5
Merge pull request #54083 from Rubonnek/add_bin_messages_3x 2022-07-05 23:04:15 +02:00
Wilson E. Alvarez a97a016381
Add error messages to String::bin_to_int64, and accept capital B in prefix
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2022-07-05 11:59:21 -04:00
Wilson E. Alvarez f12a1b6214
Add error messages String::hex_to_int functions, and accept capital X in prefix
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2022-07-05 10:16:55 -04:00
Hansem Ro 193d5c11f3 [3.x, macOS, Windows, X11] Add stylus inverted/eraser support to InputEventMouseMotion event 2022-07-04 16:12:11 -07:00
bruvzg a8eb779ac3
Backport locale selection improvements. 2022-07-04 11:49:20 +03:00
Estelle Linkpy Reid 7a2d3b04a5 Corrected InputEventKey::as_text to return a non-empty string for physical keys. 2022-07-02 15:34:15 +02:00
bruvzg 6489fe890e
Backport text-to-speech support. 2022-07-01 11:04:50 +03:00
Rémi Verschelde a7559fcb6e Errors: Fallback to `fprintf` if `OS` singleton doesn't exist
Otherwise we would crash if something prints an error before init or
after destruction of the `OS` singleton which handles printing/logging.

(cherry picked from commit c83084fccb)
2022-06-30 19:23:02 +02:00
Rémi Verschelde d74ff8dd93
Merge pull request #62440 from timothyqiu/thread-func-base
[3.x] Check thread func in base scripts for argument info
2022-06-28 08:11:11 +02:00
Haoyu Qiu f740b4f481 Check thread func in base scripts for argument info 2022-06-27 11:24:04 +08:00
ne0fhyk 24e3b3b88d Add full support for Android scoped storage.
This was done by refactoring directory and file access handling for the Android platform so that any general filesystem access type go through the Android layer.
This allows us to validate whether the access is unrestricted, or whether it falls under scoped storage and thus act appropriately.
2022-06-26 16:53:02 -07:00
Marcel Admiraal b8b7c21583 Ensure AudioFrame variables l and r are always initialised
(cherry picked from commit d3f0994572)
2022-06-20 14:58:57 +02:00
Rémi Verschelde acd4a01b8c ProjectSettings: Ensure 'editor/' settings aren't nested
Having a mix of settings with and without subcategory makes the 'Editor'
section stand out with a weird UX, as instead of simply being a foldable
section like the others, it also holds its own top-level settings and is
therefore selectable.

This wasn't the case in 3.4, and is fixed in 4.0 by refactoring, so for
3.5 we should preserve the 3.4 UX, even if it's not the best.
2022-06-19 11:47:19 +02:00
Theraot 6007d7f0ed Added missing p_bidirectional to AStar2D methods
The methods disconnect_points and are_points_connected  now have an optional p_bidirectional parameter matching AStar.

(cherry picked from commit 3590cdfd34)
2022-06-16 20:49:01 +02:00
Yuri Rubinsky d525d902c1 Fix `wrapf` to correct wrap values with 0.1 stepping
(cherry picked from commit 09418afbc0)
2022-06-16 10:10:48 +02:00
smix8 8bd7c6188b [3.5] Update NavigationServer backport
Backports features and bugfixes from current Godot 4.0 to 3.5 and brings functions and codebase of both version largely in sync to make tutorials more compatible and future backports easier.
2022-06-14 05:55:14 +02:00
bruvzg 11a7997a67 [Windows, 3.x] Add support for handling network share paths. 2022-06-13 09:24:35 +03:00
FireForge 53c01540d9 Make Input mouse_mode and use_accumulated_input properties
Co-authored-by: Haoyu Qiu <timothyqiu32@gmail.com>
2022-06-10 17:33:12 +08:00
kobewi 460fd7c03b Add Dictionary.merge()
(cherry picked from commit a0915e6dee)
2022-06-09 11:58:48 +02:00
sps1112 ede6ce9847 Bind vararg method flag in core constants
(cherry picked from commit 1f361b0367)
2022-06-09 10:55:17 +02:00
Rémi Verschelde 80b82e4e66 i18n: Misc fixes translation strings
Adds some translator comments to solve some questions raised on Weblate.
2022-06-08 12:56:42 +02:00
lawnjelly 1d870403b2 Optimized Mesh Merging
Changes from PoolVector to LocalVector and pre-reserving vectors rather than push_back.
2022-06-07 20:16:51 +01:00
lawnjelly ba74643594 Force unsigned behaviour for bitfield enums
Some compilers (notably MSVC) were using signed values for bitfield enums. This was causing problems where 2 bits were used to store 4 or less enum values, where they were being treated as negative numbers.

This PR explicitly requests these enums to be treated as unsigned values.
2022-06-06 16:58:21 +01:00
Aaron Franke 0470392930
[3.x] Improve architectures in OS::has_feature and make it work on MSVC 2022-06-05 23:16:13 -05:00
Haoyu Qiu 1a7e3b3ab6 Fix String.http_escape on Windows 2022-06-03 13:41:45 +08:00
Univeous e514cd71b1 fix get_meta() with defalt value 2022-05-24 20:23:08 +08:00
Hugo Locurcio 61278499aa Tweak 64-bit integer overflow message to mention that it's a signed type
(cherry picked from commit 7b5bf3af19)
2022-05-22 19:43:56 +02:00
Haoyu Qiu b657d0c76c Add dedicated macros for property name extraction
* Replace case-by-case extraction with PNAME & GNAME
* Fix group handling when group hint begins with property name
* Exclude properties that are PROPERTY_USAGE_NOEDITOR
2022-05-19 11:31:35 +08:00
Haoyu Qiu b611b4cddc Create onready variables when dropping nodes and holding Ctrl 2022-05-17 11:52:17 +08:00
Hugo Locurcio e19f8fcbdc Improve error messages when creating Images from code
The rationale behind the expected number of bytes is now displayed
in clear (width, height, format, number of mipmaps expected if any).

(cherry picked from commit 18e9e6a81a)
2022-05-16 21:12:21 +02:00
kobewi 621cb8c52f Move Display settings higher in the list
(cherry picked from commit 739242dd04)
2022-05-16 17:14:43 +02:00
Haoyu Qiu b40dff698c Fix invalid memory usage when using Image.convert
(cherry picked from commit 34c1a2beaa)
2022-05-16 17:14:43 +02:00
Rémi Verschelde 5e693b6d84 Fix warnings found by Emscripten 3.1.10
Fix `-Wunused-but-set-variable`, `-Wunqualified-std-cast-call`, and
`-Wliteral-range` warnings.

(cherry picked from commit d8935b27a9)
2022-05-16 16:38:26 +02:00
Nicholas Huelin 5cedb395dc Fix inconsistent naming in Time
(cherry picked from commit 8409d92282)
2022-05-16 15:58:36 +02:00
Mario Liebisch 4cfe174263 Increase line counter when parsing comments
(cherry picked from commit bf708e72dc)
2022-05-16 15:56:47 +02:00
Haoyu Qiu 3d1644f7c3 Add search methods for pool arrays
* has()
* count()
* find()
* rfind()
2022-05-08 11:07:00 +08:00
Hugo Locurcio 8682874419
Rename profiler "Idle Time" to "Process Time"
References to "idle time" are progressively being replaced by
"process time" throughout the engine to avoid confusion.

This also changes some debug prints to be printed only when verbose
mode is enabled (like in `master`).
2022-05-06 19:31:31 +02:00
smix8 da9a88a35a Allow AStar/AStar2D zero point weight
Allow AStar/AStar2D zero point weight.

Limit was set to 1 which seemed like an arbitrary value as lower values down to zero can be useful for common gameplay navigation elements like teleports.
2022-05-06 02:33:31 +02:00
Rémi Verschelde 9e37599f36 Core: Rename math 'phi' arguments to 'angle'
(cherry picked from commit e7a58a7eb6)
2022-05-05 15:02:46 +02:00
mdavisprog 53fb0440d3 Add OS::is_process_running function.
Adds the is_process_running function to the native OS class and exposes it to script.

This is implemented on Windows and Unix platforms. A stub is provided for other platforms that do not support this function.

Documentation is updated to reflect new API function.

(cherry picked from commit f3c1232c59)
2022-05-05 15:02:46 +02:00
lawnjelly df7fab51a3 Physics Interpolation - Flush transforms after physics tick
Leftover transforms from the physics tick were being flushed during idle, which was causing problems for physics interpolation.

This PR flushes the transforms at the end of the physics tick when physics interpolation is active.
2022-05-04 20:30:46 +01:00
Rémi Verschelde 6ee64331db
Merge pull request #60527 from KoBeWi/unique_names_demastered 2022-05-02 10:48:27 +02:00
Rémi Verschelde d8e702b010
Merge pull request #60552 from madmiraal/implement-3466-3.x
[3.x] Add a method for obtaining display cutouts on Android
2022-05-02 07:58:05 +02:00
Haoyu Qiu 767134fd8d Fix left aligned integer sign in string formatting 2022-05-01 12:43:03 +08:00
bruvzg bea7c9be5d [3.x] Improve embedded PCK loading and exporting. 2022-04-28 11:11:48 +03:00
kobewi b7336524f2 Expose move_to_trash()
(cherry picked from commit b80e52f048)
2022-04-27 12:41:01 +02:00
kleonc 6f01a949c2 Fix `Image.blit_rect/blend_rect()` for negative `p_dest` point
(cherry picked from commit 4038bc0c36)
2022-04-27 12:38:27 +02:00
laws65 6aac042faa Proper validation of negative values in datetime strings and datetime dicts
(cherry picked from commit cf9fc0b936)
2022-04-27 12:22:49 +02:00
Oğuzhan Eroğlu fd329d19e8 Quick fix: Crash when parsing invalid datetime string #60189
(cherry picked from commit 2b8eb126b4)
2022-04-27 12:22:26 +02:00
Haoyu Qiu d088128b43 Remove duplicate editor settings definitions 2022-04-27 15:26:46 +08:00
Rémi Verschelde ba7881bd36
Merge pull request #60366 from adamscott/nav-map-thread-work-pool-3x
Use ThreadWorkPool instead of thread_process_array in NavMap [3.x]
2022-04-26 18:45:53 +02:00
Adam Scott 7749346f48 Use ThreadWorkPool instead of thread_process_array in NavMap
Port ThreadWorkPool to 3.x
2022-04-26 09:18:46 -04:00
kobewi e1c74ae83f Implement Scene Unique Nodes 2022-04-26 13:55:48 +02:00
Marcel Admiraal ec2270b88f Add a method for obtaining display cutouts on Android 2022-04-26 13:52:33 +02:00
Rémi Verschelde ab4bbdde90
Merge pull request #60421 from AndreaCatania/bvo_3x 2022-04-26 11:35:03 +02:00
Rémi Verschelde 5e4358eb73
Merge pull request #60426 from timothyqiu/array-fill
[3.x] Add fill method to `Array` and `Pool*Array`
2022-04-25 23:00:17 +02:00
Rémi Verschelde 9260dd3ac1
Merge pull request #60427 from lawnjelly/rid_handles_safer_locks 2022-04-25 15:50:00 +02:00
Haoyu Qiu 8f0f98ffab Bind Semaphore.try_wait() 2022-04-25 20:47:09 +08:00
Haoyu Qiu 77b6f7595a Add fill method to Array and PoolArrays
Co-authored-by: Matheus Lima Cunha <matheus.limacunha@hotmail.com>
2022-04-23 19:29:17 +08:00
lawnjelly 130cc36a88 Improve locking safety for RID handles builds
Additional locks are added. This is primarily to cover a potential race condition where the pool is resized from another thread during a get operation.
2022-04-23 09:09:50 +01:00
AndreaCatania 62e9044837 Backported the oa_hashmap lookup_ptr function 2022-04-22 10:00:55 +02:00
AndreaCatania 6f24727916 Backported the Vector function to_byte_array and slice 2022-04-22 10:00:55 +02:00
RedHeadphone b6968ab060 validate input in Time.get_datetime_string_from_dict()
format fix

better fix to handle ERR_FAIL_COND_V_MSG return data type

(cherry picked from commit 7e35af3dc3)
2022-04-14 21:38:27 +02:00
Rémi Verschelde 9a45eb70b4
Merge pull request #60204 from akien-mga/3.x-cherrypicks 2022-04-13 14:23:56 +02:00
kobewi e86a64a2a5 Add optional 'default' argument to get_meta()
(cherry picked from commit 3eb7fc4bfd)
2022-04-13 11:43:49 +02:00
Bartłomiej T. Listwon 71f5a88b04 Remove get_data() from CowData 2022-04-13 11:32:44 +02:00
keptsecret c69689ab5a fix unable to change directory in user access mode 2022-04-03 11:22:01 -04:00
George Marques f0ca73892a
Fix argument type generation with typed method binds
It needs to generate the types, not only set the argument count.
2022-04-02 14:32:01 -03:00
George Marques 226103d166
Enable type information on release
This is needed for GDScript (and potentially other scripting languages)
to properly identify type errors and avoid mismatch between release and
debug versions.

This increases the release bynary size by about 889 KiB.
2022-04-01 18:20:33 -03:00
Rémi Verschelde 3c0d32562b
Merge pull request #59606 from m4gr3d/fix_low_processor_mode_3x
[3.x] Fix flickering issues with low processor mode on Android
2022-03-29 22:51:32 +02:00
Fredia Huya-Kouadio 8ca32d1727 Fix flickering issues with low processor mode on Android 2022-03-29 12:17:25 -07:00
Haoyu Qiu 50ba2d3051 Fix crash when exporting projects with shared libraries
(cherry picked from commit 680bcef825)
2022-03-28 23:48:03 +02:00
bruvzg fd2fba7c2c
Add binary MO translation file support. Add brotli decoder and WOFF2 support.
Use smaller .mo files instead of .po, if gettext is available.
Convert editor fonts to .woff2 format.
2022-03-25 19:51:39 +02:00
Hugo Locurcio 292ad704e6
Increase the maximum number of concurrent DNS queries from 32 to 256
This makes the following error message less likely to be printed
when performing many concurrent HTTP requests:

    Condition ' resolving == IP::RESOLVER_INVALID_ID ' is true. returned: ERR_BUG
2022-03-25 17:13:51 +01:00
Rémi Verschelde 9e44fb166d
Merge pull request #59344 from madmiraal/fix-57943-3.x
[3.x] Ensure minimum modifiers are pressed when matching actions
2022-03-20 11:27:20 +01:00
Marcel Admiraal 88c723c33c Ensure minimum modifiers are pressed when matching actions 2022-03-20 08:08:40 +00:00
Rémi Verschelde 4739c821dc
Merge pull request #59234 from akien-mga/3.x-rid-comparison-id 2022-03-18 12:06:17 +01:00
taigi100 e49d8f8b4c Update color constants to use HEX codes
(cherry picked from commit bd247fa315)
2022-03-17 15:49:58 +01:00
Bartłomiej T. Listwon 8db39b82ea Include platform_config.h in thread.cpp and thread.h
(cherry picked from commit 6c6291b84f)
2022-03-17 13:03:52 +01:00
Rémi Verschelde 797321fec4 RID: Change comparison operators to use RID_Data id instead of address
This should helps making sorting more deterministic in physics and rendering.

The same change was done for 4.0 in 4f163972bb.
2022-03-17 11:03:07 +01:00
Haoyu Qiu 878cf8262a Add context support for editor translation 2022-03-16 15:44:30 +08:00
ConteZero 2ff0735329 Added primary clipboard for Linux 2022-03-14 15:28:36 +01:00
Aaron Franke 3040285b27 Add offset string from minutes conversion method to Time singleton
(cherry picked from commit 55aabb8b06)
2022-03-12 14:44:23 +01:00
Hugo Locurcio cec7c908ca
Add `get_screen_refresh_rate()` to OS
This method can be used to get the refresh rate of a given screen.
It is supported on Windows, macOS, Linux, Android and iOS (but not
HTML5).
2022-03-10 22:10:48 +01:00
Rémi Verschelde 1639b3a6a9
Merge pull request #58674 from Calinou/smooth-trimesh-collision-always-setting-3.x 2022-03-10 21:11:44 +01:00
Rémi Verschelde 690020d385 Revert "Fix ProjectSettings has_setting() when used on a overriden setting with feature tags"
(cherry picked from commit 78bf9926f8)
2022-03-09 09:53:26 +01:00
Rémi Verschelde 85b4848ca8
Merge pull request #54188 from Rubonnek/increase_var_arg_max_3x 2022-03-08 13:10:48 +01:00
Wilson E. Alvarez 424dbf70af
Increase VARIANT_ARG_MAX to 8 2022-03-07 10:03:49 -05:00
Rémi Verschelde 445339e1b2
Merge pull request #58427 from lawnjelly/safe_vector2 2022-03-07 12:39:28 +01:00
lawnjelly 0bcda22d7c Protection for array operator for Vector2 / 3 in DEV builds
A previous PR had changed the array operator to give unbounded access. This could cause crashes where old code depended on this previous safe behaviour.

This PR adds DEV_ASSERT macros for out of bound access to DEV builds, allowing us to quickly identify bugs in calling code, without affecting performance in release or release_debug editor builds.
2022-03-07 10:34:40 +00:00
Rémi Verschelde f622c60805
Merge pull request #58492 from lawnjelly/float_literals_3
[3.x] Float literals - fix math classes to allow 32 bit calculations
2022-03-06 10:14:10 +01:00
Hugo Locurcio 413689559c
Always register the Smooth Trimesh Collision project setting
This ensures the project setting never disappears from the editor,
even if the current physics engine is GodotPhysics.

This also adds documentation for the Smooth Trimesh Collision
project setting.
2022-03-02 18:50:21 +01:00
Haoyu Qiu 56fd92ca76 Fix `UndoRedo::create_action()` invalid memory usage
(cherry picked from commit b00b7f9b7c)
2022-03-02 12:02:37 +01:00
Hugo Locurcio 824eaabd7b Print every file exported with `PCKPacker.flush()`s verbose parameter
Previously, only one line per 100 files was printed.

This also refactors the print statement to use Godot methods and
make it more informative overall.

(cherry picked from commit 8e57e5dc6a)
2022-03-02 11:00:26 +01:00
lawnjelly d24c715678 Float literals - fix math classes to allow 32 bit calculations
Converts float literals from double format (e.g. 0.0) to float format (e.g. 0.0f) where appropriate for 32 bit calculations, and cast to (real_t) or (float) as appropriate.

This ensures that appropriate calculations will be done at 32 bits when real_t is compiled as float, rather than promoted to 64 bits.
2022-02-24 16:46:02 +00:00
Rémi Verschelde fe8ea0de5b
Merge pull request #58295 from Pineapple/ustring-optimizations
Optimize String concatenation and copy functions
2022-02-21 08:45:23 +01:00
Bartłomiej T. Listwon 66085e210e Optimize String::copy_from(const CharType &p_char) 2022-02-20 12:47:35 +01:00
Bartłomiej T. Listwon 3d35f29f27 Optimize String::copy_from_unchecked 2022-02-20 12:47:35 +01:00
Bartłomiej T. Listwon 069e8f32d8 Optimize String::operator+= and CharString::operator+= 2022-02-20 12:47:22 +01:00
Ricardo Subtil 60f9c0fb42 Fix decompression functions not returning errcodes
(cherry picked from commit 61790a03f5)
2022-02-19 15:50:38 +01:00
Yuri Sizov df13466139 Add type variations to Theme 2022-02-17 15:24:10 +03:00
Rémi Verschelde 47e34dc4e2
Merge pull request #58157 from Calinou/os-add-get-processor-name-3.x 2022-02-17 12:34:16 +01:00
Haoyu Qiu 0f76143444
Make VMap::find_nearest return -1 when empty
(cherry picked from commit 3057b19daa)
2022-02-17 09:59:28 +01:00
Hugo Locurcio 7f9e974a8b
Add an `OS.get_processor_name()` method
This method can be used to get the CPU model name.
It can be used in conjunction with
`VisualServer.get_video_adapter_name()` and
`VisualServer.get_video_adapter_vendor()` for annotating benchmarks
and automatic graphics quality configuration.
2022-02-16 18:39:02 +01:00
lawnjelly 522bce1159 Fixed Timestep Interpolation (3D)
Adds fixed timestep interpolation to the visual server.
Switchable on and off with project setting.

This version does not add new API for set_transform etc, when nodes have the interpolated flag set they will always use interpolation.
2022-02-16 09:41:23 +00:00
Max 273abf5225
Fixed variant decoding Segmentation Fault
(cherry picked from commit 6aede992a9)
2022-02-15 12:30:40 +01:00
BimDav b343660dac
has_setting now correctly returns true when the setting is present due to a feature tag
(cherry picked from commit d39e416c61)
2022-02-15 12:23:45 +01:00
Rémi Verschelde 7a16bb2ee4
Fix typos with codespell
Using codespell 2.2-dev from current git.

Added `misc/scripts/codespell.sh` to make it easier to run it once in a
while and update the skip and ignore lists.

(cherry picked from commit 1bdb82c64e)
2022-02-11 09:50:59 +01:00
Hayden 6d867b6d13
Make parser treat all exponent literals as float
(cherry picked from commit 1305ff92f7)
2022-02-11 09:50:58 +01:00
Hayden Leete 61cd26be28
Added hex and bin literal support to Expression parser
fixed formatting

(cherry picked from commit 018de19eba)
2022-02-11 09:50:58 +01:00
Rémi Verschelde f50c7f7415
Core: Move generated `VERSION_HASH` to a `.cpp` file
This lets us have its definition in `core/version.h` and avoid
rebuilding a handful of files every time the commit hash changes.

(cherry picked from commit 90162851a7)
2022-02-10 13:06:56 +01:00
Rémi Verschelde 43dfafdfc9
Merge pull request #53296 from lawnjelly/project_settings_dirty_flag 2022-02-09 14:04:45 +01:00
lawnjelly f0af29346b ProjectSettings add dirty flag and project_settings_changed signal
Most frames there will be no change in project settings, and it makes no sense to read settings every frame in case of changes, as a large number of string compares are involved.

This PR adds a signal to ProjectSettings that can be subscribed to in order to keep local settings up to date with ProjectSettings.

In addition a function `ProjectSettings::has_changes()` is provided for objects outside the signal system (e.g. Rasterizers).
2022-02-09 11:20:25 +00:00
Bartłomiej T. Listwon 134aac5725 Fix Vector2 and Vector2i coord access via operator[] 2022-02-09 09:18:05 +01:00
lawnjelly ee979d321a Add fflush to error macros
CRASH_NOW and DEV_ASSERT macros would previously terminate before outputting any error messages.
This PR ensures calling fflush for stdout before terminating.
2022-02-05 12:38:57 +00:00
Haoyu Qiu de47cb0c5b Fix PoolByteArray.decompress_dynamic return value and memleak 2022-02-05 15:14:23 +08:00
Rémi Verschelde 689f59dca0
Merge pull request #53463 from lawnjelly/vital_redraws
Add editor vital redraws only option
2022-02-04 21:42:49 +01:00
Rémi Verschelde ae948d83b2
Merge pull request #57561 from lawnjelly/bvh_fix_leaf_leak 2022-02-03 09:57:01 +01:00
lawnjelly 90bea27e82 BVH - fix leaking leaves
In the BVH leaf nodes are a combination of two objects - a node object, and a leaf object. Testing revealed that in some situations node objects could be freed without also freeing the paired leaf object. This closes this bug.
2022-02-03 08:05:57 +00:00
Rémi Verschelde 98ed117613
Merge pull request #54174 from nathanfranke/3.x-fix-exact-match 2022-02-02 23:25:08 +01:00
lawnjelly a0c6d16c90 Add editor vital redraws only option
When editor continuous redraws is switched off, the editor only redraws when a redraw_request was issued by an element in the scene. This works well in most situations, but when scenes have dynamic content they will continuously issue redraw_requests.

This can be fine on high power desktops but can be an annoyance on lower power machines.

This PR splits redraw requests into high and low priority requests, defaulting to high priority. Requests due to e.g. shaders using TIME are assigned low priority.

An extra editor setting is used to record the user preference and an extra option is added to the editor spinner menu, to allow the user to select between 3 modes:

* Continuous
* Update all changes
* Update vital changes
2022-02-02 11:26:45 +00:00
Rémi Verschelde b6dbff7621
Merge pull request #57361 from lawnjelly/occ_poly_only 2022-02-01 14:04:24 +01:00
lawnjelly 8ea20f5fdd Add OccluderShapePolygon
Add OccluderShapePolygon, glue to Occluder and gizmos etc.
2022-02-01 11:31:06 +00:00
Fabio Alessandrelli aa3ef20fcb
[Net] Simplify IP resolution code, fix caching.
First, we should not insert into cache if the hostname resolution has
failed (as it might be a temporary internet issue), second, the async
resolver should also properly insert into cache.

Took the chance to remove some duplicate code with critical section in
it at the cost of little performance when calling the blocking
resolve_hostname function.

(cherry picked from commit 49297d937c)
2022-01-31 22:54:25 +01:00
Rémi Verschelde d3582685d2
Merge pull request #57159 from Pineapple/rid-set-data
[3.x] Use refval() instead of separate ref() and get() in RID_OwnerBase::_set_data()
2022-01-28 21:49:29 +01:00
Fabio Alessandrelli 822da984bb
[Net] Fix get_response_body_length for large files.
Parsing was fixed, but not the return value for the exposed getter.

(cherry picked from commit 01e5e98312)
2022-01-25 18:23:04 +01:00
cdemirer dd57c321bf
Fix Array and Dictionary id() and dictionary test bug
(cherry picked from commit e2ed9d13eb)
2022-01-25 18:20:59 +01:00
Bartłomiej T. Listwon 7df2f31c27 Use refval() instead of separate ref() and get() 2022-01-24 21:36:25 +01:00
lawnjelly dc14636e68 BVH templated mask checks and generic NUM_TREES
Refactors the BVH to make it more generic and customizable. Instead of hard coding the system of pairable_mask and pairable_type into the BVH, this information is no longer stored internally, and instead the BVH uses callbacks both for determining whether pairs of objects can pair with each other, and for filtering cull / intersection tests.

In addition, instead of hard coding the number of trees, the BVH now supports up to 32 trees, and each object can supply a tree collision mask to determine which trees it can collide against.

This enables the BVH to scale to either the two or 3 trees needed in physics, and the single tree used without pairing in Godot 4 render tree.
2022-01-21 10:08:29 +00:00
lawnjelly adf14bfdde Add nodiscard to core math classes to catch c++ errors.
A common source of errors is to call functions (such as round()) expecting them to work in place, but them actually being designed only to return the processed value. Not using the return value in this case in indicative of a bug, and can be flagged as a warning by using the [[nodiscard]] attribute.
2022-01-20 17:28:31 +00:00
Rémi Verschelde a9b10054b8
Merge pull request #56950 from timothyqiu/has-clipboard-3.x 2022-01-20 12:09:53 +01:00
Fabio Alessandrelli d76a26e086
Bump mbedTLS version to 2.28.0 (new LTS).
Keep applying the windows entropy patch (UWP support).
Remove no longer needed padlock patch.
Update thirdparty README to reflect changes, and new source inclusion
criteria.

(cherry picked from commit e375cbd094)
2022-01-19 14:03:03 +01:00
Haoyu Qiu 76297e744d Add `OS.has_clipboard()` to check clipboard content 2022-01-19 20:19:06 +08:00
Rémi Verschelde c938104a88
Merge pull request #56630 from Pineapple/replace-find-last 2022-01-18 16:36:52 +01:00
Haoyu Qiu 7f49e5beec Expose `Image.COMPRESS_SOURCE_LAYERED` to scripting 2022-01-17 20:43:05 +08:00
Rémi Verschelde 879244c54e
Merge pull request #56015 from bruvzg/phy_code_conv 2022-01-16 11:36:26 +01:00
Nathan Franke 2232168ede [3.x] Fix action exact match 2022-01-13 22:29:18 -06:00
Marcel Admiraal 3d96d7d9fb Fix mouse speed not changing fast enough
- Uses all accumulated movements when calculating speed
- Discards old accumulated movements
- Sets last mouse speed to zero when there is no movement
2022-01-13 18:52:08 +00:00
Rémi Verschelde a627cdafc5
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-13 15:54:13 +01:00
bruvzg 6eac65d4fe
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 17:28:07 +01:00
Haoyu Qiu e1f96d5ee8
Fix crash on importing FBX file
(cherry picked from commit af67e4c291)
2022-01-12 17:28:07 +01:00
Rémi Verschelde 09884f17a3
Revert "Warn when using an AABB or Rect2 with a negative size"
This reverts commit d75e580765.

Fixes #56509.
2022-01-12 17:28:03 +01:00
Rémi Verschelde 8a192cd0ab
Merge pull request #55987 from bruvzg/wt🤎3 2022-01-10 16:43:56 +01:00
Rémi Verschelde edd9534f97
Merge pull request #53900 from ChronicallySerious/update-vcs-1 2022-01-10 12:18:57 +01:00
Bartłomiej T. Listwon 22750b1c03 Replace String::find_last with rfind where possible (backward compatible with old API) 2022-01-08 22:40:44 +01:00
LATRio 47f0cf7460 Add type validations when setting basic type 2022-01-08 11:30:55 +09:00
Rémi Verschelde b197de6f5f
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
```
2022-01-07 00:14:54 +01:00
bruvzg 6f81a8ee2c
Fix multiple missing UTF-8 decoding.
(cherry picked from commit c69e0d16bc)
2022-01-06 21:44:40 +01:00
Rémi Verschelde 73f7d29c26
Merge pull request #56363 from Rubonnek/fix-to-int-32 2022-01-06 16:24:07 +01:00
Rémi Verschelde 5fa1961ee3
Merge pull request #56369 from Rubonnek/expose-string-join 2022-01-06 15:14:18 +01:00
Cnidarias e3292633be
Fix http limitation for large "content-length"
When a request was issued to a server that returned "content-length" header
whose value was greater than that of an "int" we ran into overflow
problems. The fix for this was rather simple by increasing the data
type to `int64_t`

(cherry picked from commit 69a532414c)
2022-01-06 00:21:36 +01:00
Max Hilbrunner c44de001de
Merge pull request #56395 from aaronfranke/3.x-doc-midi
[3.x] Document InputEventMIDI and add some missing 0xF MIDI messages
2022-01-04 18:28:16 +01:00
kobewi 3f0248dc8e Fix method validation in Thread 2022-01-04 14:48:16 +01:00
Aaron Franke da88e42f16
[3.x] Document InputEventMIDI and add some missing 0xF MIDI messages 2022-01-04 05:30:15 -08:00
Wilson E. Alvarez 3df436a08e
Map 64-bit versions of String.to_int and String.hex_to_int over to GDScript 2021-12-30 21:36:54 -05:00
Wilson E. Alvarez d03b82cde7
Expose String::join over to GDScript 2021-12-30 21:27:18 -05:00
bruvzg 59085d5051
[Windows] Improve console handling and execute.
Always build with the GUI subsystem.
Redirect stdout and stderr output to the parent process console.
Use CreateProcessW for blocking `execute` calls with piped stdout and stderr (prevent console windows for popping up when used with the GUI subsystem build, and have more consistent behavior with non-blocking calls).
Add `open_console` argument to the `execute` to open a new console window (for both blocking and non-blocking calls).
Remove `interface/editor/hide_console_window` editor setting.
Remove `Toggle System Console` menu option.
Remove `set_console_visible` and `is_console_visible` functions.
2021-12-18 10:13:27 +02:00
Haoyu Qiu d99a313fd3 Fix font preview text color on light background 2021-12-18 00:34:54 +08:00
bruvzg b4ec1c5817
Backport: Allow for mapping scancodes to current layout
Co-authored-by: Frixuu <kontakt@lukasz.xyz>
2021-12-17 13:04:47 +02:00
Rémi Verschelde a90cac7ba4
Merge pull request #55988 from timothyqiu/http-proxy-3.x 2021-12-16 13:09:07 +01:00
Rémi Verschelde 8cc549d587
Merge pull request #55986 from timothyqiu/doctool-i18n-3.x 2021-12-16 13:08:59 +01:00
Haoyu Qiu 1cada6bfa9 Add proxy support for `HTTPClient` and the editor
* Adds proxy related methods for `HTTPClient` and `HTTPRequest`
* Adds `network/http_proxy/{host,port}` editor settings
* Makes AssetLib and Export Template Manager proxy aware
2021-12-16 19:38:53 +08:00
raphaelazev 102f102f7d
Added check to get_all_locales to avoid adding duplicate locales to array
(cherry picked from commit 82527df55c)
2021-12-16 12:10:11 +01:00
Haoyu Qiu c11b1850c4 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`.
2021-12-16 18:27:32 +08:00
Haoyu Qiu a16b06e7a4 Fix Color.v integer assignment 2021-12-16 00:33:23 +08:00
lawnjelly 7eae6cd310 RID tracked handles better error messages for dangling RIDs
Keeps track of previous allocations as well as current allocations, as the previous allocation will be the one of interest in many cases for dangling RIDs.

Prints the file / line number in the error message, instead of using print_verbose.
2021-12-08 10:07:25 +00:00
Rémi Verschelde 0845f20784
Merge pull request #55614 from Calinou/add-os-crash-method-3.x 2021-12-06 17:04:14 +01:00
Aaron Franke d75e580765
Warn when using an AABB or Rect2 with a negative size
(cherry picked from commit 9687f6fca3)
2021-12-06 16:51:59 +01:00
lawnjelly 3d981b8265 Add option to use handles to RID
Adds an option to compile an alternative implementation for RIDs, which allows checks for erroneous usage patterns as well as providing leak tests.
2021-12-06 14:43:34 +00:00
Hugo Locurcio 58296c7e21
Add an `OS.crash()` method for testing system crash handler
This makes it possible to test the system's crash handler without
having to modify engine code or exploit an engine bug.
2021-12-04 01:40:56 +01:00
janglee 0b327eb46e VCS: Add push, pull, fetch and improved diff view to VCS UI
This commit was created by merging the commits presented in #39255 for
the GSoC 2020 VCS Improvement project

VCS: Make EditorVCSInterface store less amount of internal state

VCS: Add force push checkbox + more frequent VCS updates

Add force push checkbox in the Commit dock. Also add some missing
opportunities for checking the VCS state again on from UI inputs

VCS: Fix script contents not being updated on merge conflict

VCS: Add branch creation VCS interface calls

VCS: Add VCS remote creation and remote selection menus

VCS: Show more commit information + Fix truncated commit offsets

VCS: Make VCS less noisy + Fix diff view refreshes

VCS: Fix mismatched argument names in VCS helpers

VCS: Add SSH transport support for remote operations

Also, moves the editor's VCS settings registrations to
project_settings.cpp and editor_settings.cpp

VCS: Change TTR() to vformat() for branch and remote removal text

VCS: Add VCS branch icon instead of using Tree node icon

Co-authored-by: @ChronicallySerious
2021-12-01 22:52:07 +05:30
Rémi Verschelde c4f7ba4686
Merge pull request #55358 from timothyqiu/pop-front-3.x
[3.x] Fix potential infinite loop when connecting HTTPClient
2021-11-30 09:26:38 +01:00
Aaron Franke 035a84fe92
[3.x] Add a Time singleton 2021-11-29 11:00:06 -06:00
Aaron Franke 1d8cef8236
[3.x] Backport some APIs in math structs 2021-11-27 01:19:45 -06:00
Haoyu Qiu de1cdc2102 Fix potential infinite loop when connecting HTTPClient 2021-11-26 23:43:55 +08:00
kobewi 420c351592
Ignore override.cfg when in editor
(cherry picked from commit 7dc97d6558)
2021-11-25 22:48:20 +01:00
bruvzg 2ef2879d7b
Add Input.is_physical_key_pressed method.
(cherry picked from commit 9877d91c4a)
2021-11-25 22:19:33 +01:00
Haoyu Qiu 9442114013
Fix crash when executing PackedDataContainer._iter_init
(cherry picked from commit 8253a45a1a)
2021-11-25 22:05:48 +01:00
kleonc 16baa9bb9a Image Use memcpy() in fill(), fill_rect(), _put_pixelb(), _get_pixelb()
Co-authored-by: Lightning_A <aaronjrecord@gmail.com>
2021-11-23 17:59:08 +01:00
kleonc 4f446c8b9e Add Image::fill_rect method 2021-11-23 17:59:08 +01:00
Camille Mohr-Daurat 3970f28f67
Merge pull request #55096 from lawnjelly/bvh_expanded_leaf
BVH - add option for expanded AABBs in leaves
2021-11-22 09:37:16 -07:00
Brian Semrau 04846156c3
Expose Thread::get_main_id in core bindings
(cherry picked from commit c558263d84)
2021-11-20 11:48:09 +01:00
lawnjelly 211dc8cd2d 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.
2021-11-20 06:45:12 +00:00
Rémi Verschelde 4a29f657b6
Merge pull request #55050 from lawnjelly/bvh_detect_shrinkage 2021-11-19 17:39:12 +01:00
Marcel Admiraal 4d3690eba5 Remove unimplemented methods 2021-11-18 12:47:36 +00:00
lawnjelly 9315b4fb51 BVH - fix typename compiler warning
Some versions of microsoft compiler flag a warning that they want a typename keyword in templates in more places than clang / gcc.
2021-11-18 07:42:00 +00:00
lawnjelly ed47570266 BVH - detect shrinkage within expanded bounds
Although the expanded bounds were working in normal use, for moving and growing objects, there was one case which was not dealt with properly - significant shrinkage of exact bounds within an expanded bound.

This PR detects significant shrinkage and forces a new expanded bound to be created.
2021-11-17 09:06:10 +00:00