Commit Graph

3262 Commits

Author SHA1 Message Date
Fabio Alessandrelli ef77fb0a38 Add AESContext.
GDScript interface to CryptoCore::AESContext.
Also add CBC mode in CryptoCore::AESContext and expose it.
2021-04-24 00:04:56 +02:00
Rémi Verschelde 1c9203ad68
Object: Make deleted object access raise errors, not warnings
Clarify doc about not decaying to `null` for `free` and `queue_free`.

Part of #45639.
2021-04-20 11:37:39 +02:00
Rémi Verschelde 701fa8a779
Revert "Fix `_File::get_buffer` length always set to p_length"
This reverts commit 9a7e537aac.

Fixes #47971.
2021-04-17 13:07:18 +02:00
Johannes 9a7e537aac
Fix `_File::get_buffer` length always set to p_length
(cherry picked from commit 33d6eccdec)
2021-04-12 00:23:43 +02:00
Daniel Kříž edcb95cede
fix wrong encoding in uri_encode
(cherry picked from commit 13c999d9d7)
2021-04-12 00:23:43 +02:00
jmb462 ce4dec647c
fix crash on null class in ClassDB.get_property() and set_property()
(cherry picked from commit 400843c172)
2021-04-05 12:02:32 +02:00
lawnjelly d67975c1cd BVH - prevent self collisions
I had missed a special case check for userdata of two colliding objects being equal. In this case, collisions should not be reported. This is used in the physics to prevent self intersection in composite objects.
2021-04-04 09:13:58 +01:00
Hein-Pieter van Braam-Stewart ff3099abcf Fix thread_local, tls, ASLR, and DEP with MingW
This commit changes the way Thread::caller_id works. By moving caller_id
to the .cpp file we make sure that the TLS variable doesn't get
relocated twice causing a crash. Since we build with LTO for release
builds (and everyone should be doing that anyway) there is no extra
overhead from the non-static method. We do do an extra bool check now
there but I don't think this will add much in the way of overhead.

This check cannot be avoided if we still want to be able to cache the
thread ID hash, as we had to move the setter because of limitations of
the WinRT platform. The original workaround for this was in #46813 but
this has some unintended consequences. Specifically; threads that never
create a Thread object will always return 0 in Thread::get_caller_id()
which caused a regression. For instance the editor now freezes when
importing large textures. This PR also addresses that.

Additionally we now enable ASLR support when building with MingW, this
includes a workaround for MingW. MingW refuses to create an appropriate
relocation table if no symbols are exported. So we just export the
various main() functions in godot_windows.cpp.

While ASLR support isn't criticial for Godot, previous versions of Godot
just happened to work with a dynamic base 'by accident' and some users
run Godot this way. After the thread change the .tls section now needs
relocations to make this work. By enabling ASLR at build-time we create
these relocations and people who forced ALSR on previously will now get
a working Godot again.

This fixes #47256 and fixes #47219

This is the 3.x version of this PR. For master a different approach is
possible which I will make in the coming days.
2021-03-25 23:20:12 +01:00
Juan Linietsky 24e1ba1298
Add a "keep" import mode to keep files as-is and export them.
(cherry picked from commit 8d64f3bd76)
2021-03-23 15:44:24 +01:00
Alex Hirsch 0b541af8a1
Allow nullptr with zero length in FileAccess get_buffer
fix #47071

(cherry picked from commit c28428fe4d)
2021-03-17 15:17:02 +01:00
Fredia Huya-Kouadio 0eb220eedc
Fix bug causing `project.godot` to be ignored when `project.binary` is missing
(cherry picked from commit 862e2df1a4)
2021-03-17 15:17:02 +01:00
Haoyu Qiu 0a17e96ab2 Fix invalid memory usage when modifying locked image 2021-03-16 13:45:45 +08:00
Alex Hirsch 5a882a659a
Add parameter checkes to FileAccess get_buffer functions
fix #46540

(cherry picked from commit cdf3099c68)
2021-03-14 12:03:22 +01:00
Rémi Verschelde ba174332af
Merge pull request #46939 from abaire/relaxes_gltf_name_sanitization_3.2
Relaxes Node naming constraints in glTF documents to match the Editor.
2021-03-13 14:57:09 +01:00
abaire b032067e42 Relaxes Node naming constraints in glTF documents to match the Editor. 2021-03-12 08:35:50 -08:00
Aitor Cereceto 7e5020b2fa [46188] fix: get unix from datetime when empty dict
(cherry picked from commit 1e820b3d9d)
2021-03-12 10:17:41 +01:00
bruvzg 8feb53e509 Move caller_id init to Thread constructor to fix UWP build.
(cherry picked from commit 741e1cf672)
2021-03-12 10:12:52 +01:00
lawnjelly 20f7037edb Add GLOBAL_DEF_ALIAS and alias for rename of pixel_snap
Having to rename project settings is rare, but when it does occur it can cause user confusion. In order to make compatibility more seamless this PR introduces two new GLOBAL_DEF functions,

GLOBAL_DEF_ALIAS(new_name, old_name, default)
GLOBAL_DEF_ALIAS_RST(new_name, old_name, default)

These are the same as the existing GLOBAL_DEF functions except that if the new setting is not found, it attempts to load from the old setting name. If the old setting is found, it stores it into the new setting, and then calls the regular GLOBAL_DEF functions.
2021-03-09 15:16:24 +00:00
Ev1lbl0w bae4b0c952
Fix negative VRAM values 2021-03-09 09:51:17 +00:00
kobewi e9e0cac3f5 Allow to save override.cfg with ProjectSettings
(cherry picked from commit 156c402f2b)
2021-03-08 17:40:22 +01:00
Rémi Verschelde 118567ca28
Merge pull request #46657 from lawnjelly/revert_snapping
Revert backport of 2D transform and camera snapping options
2021-03-08 14:49:41 +01:00
bruvzg ce11f7fa3e
[3.2] Improve thread IDs to avoid collisions with threads not created by the Godot API. 2021-03-07 10:09:02 +02:00
lawnjelly bf1de6bbfa Revert backport of 2D transform and camera snapping options
More work is needed to make sure that those options actually solve users' issues, so we prefer to remove the options for 3.2.4 and revisit for a future release.
2021-03-05 14:20:31 +00:00
Pedro Rodrigues eec2731eb2 Fix crash on HTTPClient::poll method
The problem happened because `poll` assumed that when the SSL flag was
true, the `connection` would be a subclass of StreamPeerSSL. However
that invariant could be broken by calling HTTPClient::set_connection
with a `connection` that is not a subclass of StreamPeerSSL.

Fixes #46138

(cherry picked from commit a3a731ed92)
2021-03-04 11:39:51 +01:00
kleonc 5022103ee7 Make Color::from_hsv use Color::set_hsv
(cherry picked from commit b59a06da25)
2021-03-04 11:39:02 +01:00
Mateo Kuruk Miccino 04fefed904 Logger: Cache 'flush_stdout_on_print' to improve performance, and works before ProjectSettings starts.
ProjectSetting: Now 'application/run/flush_stdout_on_print' requires a restart of the Editor to take effect

(cherry picked from commit 89283b7b53)
2021-03-02 10:26:14 +01:00
lawnjelly b1e24597e7 Renaming rendering/2d project settings.
The rendering/quality/2d section of project settings is becoming considerably expanded in 3.2.4, and arguably was not the correct place for settings that were not really to do with quality.

3.2.4 is the last sensible opportunity we will have to move these settings, as the only existing one likely to break compatibility in a small way is `pixel_snap`, and given that the whole snapping area is being overhauled we can draw attention to the fact it has changed in the release notes.

Class reference is also updated and slightly improved.

`pixel_snap` is renamed to `gpu_pixel_snap` in the project settings and code to help differentiate from CPU side transform snapping.
2021-03-01 11:38:46 +00:00
Fabio Alessandrelli 9084e2e85b Fix thread_process_array when NO_THREADS.
(cherry picked from commit dfbeb5ae29)
2021-02-26 15:23:23 +01:00
Carlos Cabello d6c67d0521 Add descriptive error message when trying to access a dir fails
(cherry picked from commit edb8c11970)
2021-02-25 22:40:32 +01:00
Hugo Locurcio b2725cb4b9 Improve the `OS.get_environment()`/`OS.set_environment()` documentation
(cherry picked from commit 355803db1b)
2021-02-25 22:38:07 +01:00
Pedro J. Estébanez 5a67eefbcf Fix SafeNumeric::conditional_increment() for NO_THREADS
(cherry picked from commit b1edb69249)
2021-02-25 22:34:15 +01:00
Emmanuel Leblond 94fe2dd31e
Fix Godot returned status code on unexpected error 2021-02-25 18:39:29 +01:00
Rémi Verschelde dadba2b391
Merge pull request #46392 from YeldhamDev/here_comes_another_rc
Backport the Import Defaults Editor
2021-02-25 15:45:34 +01:00
kleonc 5d628535b9 Geometry2D::make_atlas Fail is passed invalid rect size
(cherry picked from commit 988f4cdc90)
2021-02-25 15:14:32 +01:00
andybarcia 82b31fe8e7 Fixes some inconsistent ISO-639 language codes
And also adds tmz (Central Atlas Tamazight) as a language

(cherry picked from commit 476df5e198)
2021-02-25 15:14:32 +01:00
Pedro J. Estébanez ef129acedd Prevent thread wait on itself for finish
(cherry picked from commit afc5af8dfa)
2021-02-25 14:28:16 +01:00
Bastiaan Olij e9ce9a8422 Expose set_environment to GDScript 2021-02-25 22:07:38 +11:00
Michael Alexsander 95191b9826 Backport the Import Defaults Editor 2021-02-24 17:50:42 -03:00
bruvzg 5bbacc85bd
Expose String contents to the GDScript as PoolByteArray. 2021-02-23 13:43:36 +02:00
Delf Neumärker 4f891b7060 Fix unchecked array access in build_*_planes
(cherry picked from commit f054f760e6)
2021-02-22 21:43:28 +01:00
Rémi Verschelde 0abf702d4b
Merge pull request #45957 from lupoDharkael/natural-comp
[3.2] Add natural string comparison
2021-02-22 11:07:54 +01:00
Hugo Locurcio 9f236d48e6 Don't allow negative values for `OS.delay_usec()`/`OS.delay_msec()`
This closes #46190.

(cherry picked from commit 76f1f9b3c5)
2021-02-19 15:52:54 +01:00
Pedro J. Estébanez 55b5f98402 Improve robustness of atomics
And fix increment in `CowData` not being conditional anymore after the recent changes.

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-19 11:48:30 +01:00
Hein-Pieter van Braam 220f24c191
Merge pull request #45618 from RandomShaper/modernize_mt_3.2
Backport of all the multi-threading modernization (3.2)
2021-02-18 20:47:24 +01:00
Rémi Verschelde 7af8da32b1
Merge pull request #45933 from nekomatata/cylinder-support-3.2
[3.2] Cylinder support in Godot Physics 3D
2021-02-18 19:36:42 +01:00
PouleyKetchoupp c6fbd55ca9 Cylinder support in Godot Physics 3D
Backport of cylinder support from Master.
2021-02-18 08:44:23 -07:00
Pedro J. Estébanez 4485b43a57 Modernize atomics
- Based on C++11's `atomic`
- Reworked `SafeRefCount` (based on the rewrite by @hpvb)
- Replaced free atomic functions by the new `SafeNumeric<T>`
- Replaced wrong cases of `volatile` by the new `SafeFlag`
- Platform-specific implementations no longer needed

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-18 12:23:25 +01:00
Pedro J. Estébanez 6d89f675b1 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-02-18 11:58:08 +01:00
Pedro J. Estébanez 8f6a636ae7 Modernize Semaphore
- Based on C++11's `mutex` and `condition_variable`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
2021-02-18 11:58:08 +01:00
Pedro J. Estébanez 4ddcdc031b Modernize Mutex
- Based on C++11's `mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
- `BinaryMutex` added for special cases as the non-recursive version
- `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`.
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
2021-02-18 11:58:08 +01:00