Commit graph

3278 commits

Author SHA1 Message Date
Fabio Alessandrelli 77e3514315
[Net] Implement String::parse_url for parsing URLs.
Splits the URL into (scheme, host, port, path).
Supports both literal IPv4 and IPv6.
Strip credentials when present (e.g. http://user:pass@example.com/).

Use that function in both HTTPRequest and WebSocketClient.

(cherry picked from commit 3bb40669d5)
2021-05-03 21:39:43 +02:00
MaxStgs 0bb40df4bb Check PHashTranslation generate p_from is valid 2021-05-03 19:58:40 +05:00
Rémi Verschelde e94161dada
SCons: Add explicit dependencies on thirdparty code in cloned env
Since we clone the environments to build thirdparty code, we don't get an
explicit dependency on the build objects produced by that environment.

So when we update thirdparty code, Godot code using it is not necessarily
rebuilt (I think it is for changed headers, but not for changed .c/.cpp files),
which can lead to an invalid compilation output (linking old Godot .o files
with a newer, potentially ABI breaking version of thirdparty code).

This was only seen as really problematic with bullet updates (leading to
crashes when rebuilding Godot after a bullet update without cleaning .o files),
but it's safer to fix it everywhere, even if it's a LOT of hacky boilerplate.

(cherry picked from commit c7b53c03ae)
2021-04-29 16:57:00 +02:00
Rémi Verschelde 70ae90e0e8
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.

Backport of #48239.
2021-04-29 12:34:11 +02:00
Pasi Nuutinmaki f8c4ffcdde
Fix area calculation of Face3
There seemed to be a bug in area calculation in Face3::get_area()-function. It returned the area of "imaginary" parallelogram instead of the triangle. Therefore the area returned was twice the real area. This manifested itself when using a hydro module for godot ( https://gitlab.com/ringtechsolutions/godot-tools/hydro/hydro ) causing the buoyancy to be two times the expected value.

"Reference": http://www.maths.usyd.edu.au/u/MOW/vectors/vectors-11/v-11-7.html

(cherry picked from commit a165eed73b)
2021-04-29 11:10:50 +02:00
Rémi Verschelde 3ded745305
Merge pull request #47887 from Pineapple/separate-set-3x
[3.x] Separate set.h from map.h
2021-04-28 16:58:09 +02:00
Rémi Verschelde 2d57df60f7
Merge pull request #48144 from Faless/crypto/3.3_encryption_stable 2021-04-27 13:46:49 +02:00
Sergey Minakov 78837f5c65
Core: add EOF check for json parser
Additionally reset parse result if error was found.

(cherry picked from commit a2676ff810)
2021-04-26 13:07:59 +02:00
Fabio Alessandrelli dcd5433b3b Implement RSA encryption/decryption. 2021-04-24 00:04:56 +02:00
Fabio Alessandrelli 09b9e65688 Implement sign and verify in crypto. 2021-04-24 00:04:56 +02:00
Fabio Alessandrelli 09af27fa39 CryptoKey supports public keys. 2021-04-24 00:04:56 +02:00
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
kobewi 07fb3c6aca
Make randomize() use unix time too
(cherry picked from commit 22efa850bd)
2021-04-23 21:50:34 +02:00
Rémi Verschelde 6ed82812aa
NodePath: Remove unimplemented get_parent() method
Fixes #48100.

(cherry picked from commit 12f826da7d)
2021-04-23 21:50:00 +02:00
kleonc 4d7f642fb3 Improve some argument names for core types 2021-04-23 15:34:24 +02:00
Rémi Verschelde 10e86bc017
Add type_traits include for std::is_trivially_destructible
(cherry picked from commit 3d46f28558)
2021-04-22 17:22:52 +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
Bartłomiej T. Listwon 011a3d69e2 Separate set.h from map.h 2021-04-14 13:06:12 +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