Commit graph

3500 commits

Author SHA1 Message Date
Rémi Verschelde
ba8551451f
Resource: Remove unused _use_builtin_script() virtual method
And another piece of dead code found while searching for "use_builtin".

(cherry picked from commit 6e9439198c)
2021-08-12 16:45:48 +02:00
Pedro J. Estébanez
9aafb22d99
Fix logic to allow default null thread argument
(cherry picked from commit a6303b70a5)
2021-08-12 16:42:16 +02:00
lawnjelly
fc60eaccb8 Quickhull - reduce warning spam and make hideable
Added one more warning to the hideable warnings. These seem to be benign warnings and are hidden during use in rooms and portals. When used from other areas, only one warning is displayed per run, instead of for every occurrence.
2021-08-10 12:06:46 +01:00
Rémi Verschelde
7c6bdea33c
Merge pull request #47416 from Calinou/add-contrast-adaptive-sharpening-3.x
Add support for contrast-adaptive sharpening in 3D (GLES3 only)
2021-08-10 10:08:24 +02:00
Rémi Verschelde
a418d09617
Merge pull request #51166 from RandomShaper/fix_can_reset_3.x 2021-08-09 09:19:25 +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
Rémi Verschelde
8db0bd4424
OS: Fix used resource debug prints
These methods were broken by 22419082d9
5 years ago and nobody complained, so maybe they're not so useful...
But at least this should restore them to a working state.

(cherry picked from commit 8c3a6b10a9)
2021-08-06 13:24:02 +02:00
Rémi Verschelde
b3c555504f
Improve documentation and simplifies code for File::get_csv_line()
Also forbids using double quotes as a delimiter.

(cherry picked from commit b8c08ba5ad)
2021-08-06 11:13:43 +02:00
Fabio Alessandrelli
811ea6ad64
[Net] Fix IP address resolution incorrectly locking the main thread.
This seems to be a pretty old bug, older then originally reported (at
least under certain circumstances).

The IP singleton uses a resolve queue so developers can queue hostnames
for resolution in a separate while keeping the main thread unlocked
(address-resolution OS functions are blocking, and could block for a long
time in case of network disruption).

In most places though, the address resolution function was called with
the mutex locked, causing other functions (querying status, queueing
another hostname, ecc) to block until that resolution ended.

This commit ensures that all calls to OS address resolution are done
with the mutex unlocked.

(cherry picked from commit aca5540e13)
2021-08-03 14:33:42 +02:00
Pedro J. Estébanez
e0f8efcb01
Fix thread start with no user data when target has no default argument
(cherry picked from commit 7ca8051645)
2021-08-03 09:33:25 +02:00
Rémi Verschelde
69c194736d
VariantParser: Fix uninitialized ResourceParser funcs
They could cause a segfault when parsing values with ID "Resource"
as apparently we never set a valid `func` for it.

Fixes crash part of #42115.

(cherry picked from commit f3aaa713d9)
2021-08-03 09:33:25 +02:00
Fabio Alessandrelli
ccbd810934
[Net] Fix Marshalls infinite recursion crash.
Variants like dictionaries and arrays can have cyclic references, which
caused `encode_variant` to run an infinite recursion.
Instead of keeping a stack and looking for cyclic references which would
make serialization slower, this commit adds a `MAX_RECURSION_DEPTH`
constant to Variant, and have `encode_variant` keep track of the current
recursion depth, bailing when it's too high since this likely means a
cyclic reference has been encountered.

(cherry picked from commit 324636473a)
2021-08-03 09:33:24 +02:00
kleonc
507fcf2a82
Astar::get_available_point_id Start from 0
(cherry picked from commit 17324db4ca)
2021-08-03 08:45:27 +02:00
Pedro J. Estébanez
7426b3fa91 Add Script::inherits_script()
Partial cherry-pick of 5d4dc2d45c.

Co-authored-by: Juan Linietsky <reduzio@gmail.com>
2021-08-02 15:18:30 +02: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
Raul Santos
daa07219cb Set p_raw_strength in action_match methods 2021-07-28 20:42:21 +02:00
Rémi Verschelde
a71169c0e0
Merge pull request #50788 from aaronfranke/3.x-input-get-axis 2021-07-26 16:30:44 +02:00
Hugo Locurcio
af3f83407f
Expose an ImportOrder enum in ResourceImporter
This avoids using magic numbers in code.

(cherry picked from commit 7f83977f37)
2021-07-26 13:26:58 +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
Haoyu Qiu
329df4e404
Fix UndoRedo crash when clearing history
(cherry picked from commit c3baf83e28)
2021-07-24 00:51:42 +02: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
Rémi Verschelde
54ad72d08d
Merge pull request #50320 from nekomatata/optimize-node-path-check-3.x
[3.x] Optimize NodePath update when renaming or deleting nodes in the editor
2021-07-22 12:13:26 +02:00
Rémi Verschelde
51f8247871
Merge pull request #50642 from akien-mga/3.x-cherrypicks 2021-07-20 13:53:03 +02:00
Rémi Verschelde
028bf846a8
Merge pull request #50640 from goostengine/add-engine-print-error-property-3.x
[3.x] Add `Engine.print_error_messages` property to disable printing errors
2021-07-20 13:31:04 +02:00
Haoyu Qiu
49c521021a
Fix missing locale names
(cherry picked from commit 7eec8334d4)
2021-07-20 13:05:13 +02:00
Kyle
f218e9e929
MultiplayerAPI is_network_server Fails Silently
Removes the error message when the network peer is not valid and returns false instead.

This makes it simpler to make games that are both on/offline by replacing server checks of

'''
if is_instance_valid(get_tree().network_peer) and get_tree().is_network_server():
		# Do server things
'''

with

'''
if get_tree().is_network_server():
		# Do server things
'''

Requires no changes to the docs because both the MultiplayerAPI and SceneTree docs don't mention the error.

(cherry picked from commit 74379b15ff)
2021-07-20 13:05:13 +02:00
Andrii Doroshenko (Xrayez)
726111f38f Add Engine.print_error_messages property to disable printing errors
Backports #48359 to 3.x.

Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2021-07-20 13:58:07 +03:00
Aaron Franke
7dc2edc430
[3.x] Allow reading shaders from .gdshader files 2021-07-19 23:34:23 -04:00
Rémi Verschelde
cbbea6084d
SCons: Generate header with info on which modules are enabled
We already had `MODULE_*_ENABLED` defines but only in the modules
environment, and a few custom `*_ENABLED` defines in the main env
when we needed the information in core.

Now this is defined in a single header which can be included in the
files that need this information.

(cherry picked from commit b7297fb39c)
2021-07-14 23:09:47 +02:00
Rémi Verschelde
aecb1c32ab
Merge pull request #50459 from MisoMosiSpy/image-lock-issue-3.x
Fixes 50428, added missing checks for image lock
2021-07-14 22:49:10 +02:00
Dipal M Zambare
b626c57bc7 Fixes 50428, added missing checks for image lock 2021-07-14 21:49:23 +05:30
lawnjelly
eb6f98ec55 Portal occlusion culling
Adds support for occlusion culling via rooms and portals.
2021-07-14 11:43:23 +01:00
lawnjelly
6914d7c6e0 Add frame delta smoothing option
Frame deltas are currently measured by querying the OS timer each frame. This is subject to random error. Frame delta smoothing instead filters the delta read from the OS by replacing it with the refresh rate delta wherever possible.

This PR also contains code to estimate the refresh rate based on the input deltas, without reading the refresh rate from the host OS.
2021-07-14 08:44:31 +01:00
PouleyKetchoupp
788db5cf47 Clean convex hull decomposition code
Remove unnecessary conversion between triangle data and vertex data
whenever possible.
2021-07-13 11:13:25 -07:00
Haoyu Qiu
958e1e9ae2
Fix decompression with FastLZ when buffer size is less than 16 bytes
(cherry picked from commit ccf292df38)
2021-07-13 12:13:01 +02:00
Faymoon
03f7d707e7
Let thread func have optional parameter
Fixes #38042.

(cherry picked from commit 78ead60372)
2021-07-13 11:40:09 +02:00
Jonas Bernemann
3b5ee6a38a
String::format leave passed values untouched
If the passed value or key contains double quotation marks it will no
longer get removed.

(cherry picked from commit a403efb67c)
2021-07-13 10:20:03 +02:00
Haoyu Qiu
2b2f3d7f2d
Fix memfree parameter name
(cherry picked from commit 542d7d6460)
2021-07-13 10:20:03 +02:00
Haoyu Qiu
9184f58dc7
Fix unicode invalid skip error in AssetLib
(cherry picked from commit 0caaaf4018)
2021-07-13 10:20:03 +02:00
Haoyu Qiu
5a54cdf4fd
Handle Z_BUF_ERROR in decompress_dynamic
(cherry picked from commit 293050a919)
2021-07-13 10:20:03 +02:00
Rémi Verschelde
9d2cbe2c02
Merge pull request #50328 from nekomatata/convex-hull-simplification-3.x
[3.x] Options to clean/simplify convex hull generated from mesh
2021-07-12 22:34:22 +02:00
PouleyKetchoupp
240c33708c Options to clean/simplify convex hull generated from mesh
Clean: remove duplicate and interior vertices (uses Bullet algorithm)
Simplify: modify the geometry for further simplification (uses VHACD
algorithm)

In the editor, single convex hull now uses the clean option.
Added a new editor entry to create a simplified convex hull, can be
useful for creating convex hull from highly tessellated triangle meshes.

Specific change for 3.x:
Add support for Vector<Vector3> and PoolVector<Vector3> in the convex hull generator.
2021-07-09 17:45:59 -07:00
PouleyKetchoupp
8185c5fe8a Optimize NodePath update when renaming or deleting nodes in the editor
Now the process uses a Map to lookup node pointers instead of iterating
over all modified node paths in a list and comparing them for each
property to check.

The process also avoids checking properties with empty node paths and
does an early exit on deleted nodes to avoid checking the node and its
descendants.

Also made a minor change in NodePath::rel_path_to() to avoid resizing a
Vector many times for long paths (with copy-on-write each time). Now
it's down to 2 resize calls in any case.
2021-07-09 11:43:05 -07:00
JestemStefan
9513354f68 Added signed_angle_to for Vector3
Added signed_angle_to method for Vector3

Added signed_angle_to for Vector3

formatting fix...
2021-07-09 12:49:12 +02:00
bruvzg
c7a0113a4b
Fix Variant tags parsing.
(cherry picked from commit eca4d2fccc)
2021-07-06 11:24:06 +02:00
Fabio Alessandrelli
32e91b232c
[Crypto] Delete mbedtls ctx in deconstructor.
Would cause memory leak when the context was `start`ed but not
`finish`ed.

(cherry picked from commit a28d25c441)
2021-07-06 11:10:47 +02:00
Nick H
ca1a2e1124
Add get_dead_zone() method to InputMap
This commit adds a new method to the `InputMap`, allowing the user to get the value of an action's dead zone as a float.

(cherry picked from commit c6f28ed62b)
2021-07-06 11:10:45 +02:00
Rémi Verschelde
f0e76377cb
LocalVector: Don't error if from >= count
Vector handles this silently by returning -1, and we should do the same here.
Otherwise we get errors when calling `find()` on e.g. a LocalVector of size 0,
while `find()` is expected to always work (if the parameters are invalid then
it doesn't find anything, so -1).

Fixup to #49925.

(cherry picked from commit 7b7ccf25b6)
2021-07-06 11:10:44 +02:00
Ricard Rovira
84474c0e6f
Use unused from in local vector find function.
(cherry picked from commit 14d5908057)
2021-06-29 14:56:48 +02:00
Haoyu Qiu
91ea7530bd
Validates the p_format parameter in Image::create functions.
(cherry picked from commit 0b7ffd4f68)
2021-06-29 14:02:23 +02:00
Paweł Fertyk
2676d815ab
Validate image formats, check if resize_to_po2 failed
(cherry picked from commit 3dae9993ac)
2021-06-29 14:02:23 +02:00
Hugo Locurcio
a9c0c5484f
Add support for contrast-adaptive sharpening in 3D (GLES3 only)
This is an older, easier to implement variant of CAS as a pure
fragment shader. It doesn't support upscaling, but we won't make
use of it (at least for now).

The sharpening intensity can be adjusted on a per-Viewport basis.
For the root viewport, it can be adjusted in the Project Settings.

Since `textureLodOffset()` isn't available in GLES2, there is no
way to support contrast-adaptive sharpening in GLES2.
2021-06-21 15:37:31 +02:00
Hugo Locurcio
21ad630e11
Expose OS data directory getter methods
This can be used by editor plugins and non-game applications to
store data in the correct directories according to the
XDG Base Directory specification.
2021-06-19 09:28:53 +02:00
Aaron Franke
85a0345d57
[3.x] Add Quat angle_to method 2021-06-18 11:00:44 -04:00
Marcel Admiraal
7e03bd1671 Remove duplicate WARN_PRINTS macro 2021-06-18 12:57:59 +01:00
Rémi Verschelde
c7f27f1d9d
Merge pull request #48651 from tavurth/3.x
Port HTTPRequest gzip compression to 3.4
2021-06-18 02:01:11 +02:00
Haoyu Qiu
95c60b76a4
Save binary ProjectSettings key length properly
(cherry picked from commit 06c0a5f9f2)
2021-06-17 12:47:55 +02:00
Philip Whitfield
606331fdcb
fix url parsing with port numbers
String.get_slice_count is always at least 1 or 2 for bases with a port number.
Before this change the following URL would return ERR_INVALID_PARAMETER ```ws://127.0.0.1:8000/test```

(cherry picked from commit 3d9f29910c)
2021-06-17 12:47:54 +02:00
Haoyu Qiu
41b6fdf946
Fix json dump and print of circular structure
(cherry picked from commit b3bd54001f)
2021-06-17 12:47:53 +02:00
Rémi Verschelde
465ab36ddf
Merge pull request #49653 from madmiraal/remove-err_prints-3.x
[3.x] Remove duplicate ERR_PRINTS macro
2021-06-16 17:33:22 +02:00
Marcel Admiraal
5a58516231 Remove duplicate ERR_PRINTS macro 2021-06-16 11:56:25 +01:00
Hugo Locurcio
9be9304238
Improve the console error logging appearance
This makes secondary information less visually prominent to improve
overall readability.

Various loggers were also tweaked for consistency.
2021-06-13 19:18:09 +02:00
Rémi Verschelde
c45ce768b1
Merge pull request #47854 from mortarroad/3.x-lossless-webp
[3.x] Implement lossless WebP encoding
2021-06-11 19:35:47 +02:00
Morris Tabor
5de08ef1d6 Implement lossless WebP encoding 2021-06-11 18:48:04 +02:00
Marcel Admiraal
6d63ccba31 Add OS.get_external_data_dir() to get Android external directory 2021-06-10 16:48:37 +01:00
Chuck
17ee8ff0d9 Support multiple address resolution in DNS requests
Add two new functions to the IP class that returns all addresses/aliases associated with a given address.

This is a cherry-pick merge from 010a3433df which was merged in 2.1, and has been updated to build with the latest code.

This merge adds two new methods IP.resolve_hostname_addresses and IP.get_resolve_item_addresses that returns a List of all addresses returned from the DNS request.
2021-06-09 12:06:46 +07:00
Rémi Verschelde
32047ffd9c
FileAccess: Don't err in store_buffer with buffer of size 0
The error check was added for `FileAccessUnix` but it's not an error when both
`p_src` and `p_length` are zero.

Added correct error checks to all implementations to prevent the actual
erroneous case: `p_src` is nullptr but `p_length > 0` (risk of null pointer
indexing).

Fixes #33564.

(cherry picked from commit 01d5c463be)
2021-06-07 22:36:07 +02:00
Rémi Verschelde
80e1585a6e
Style: Cleanup uses of double spaces between words
Or after punctuation. Tried to leave third-party stuff alone, unless it has
been heavily modified for Godot.

(cherry picked from commit c1c76850cb)
2021-06-07 12:06:59 +02:00
Marcel Admiraal
18825ad4ff Fix game controllers ignoring the last listed button 2021-06-03 15:45:05 +01:00
Henry Conklin
a28beb3048
Add support for numeric XML entities to XMLParser
* Add support for decimal numeric entities to String::xml_unescape
* Add more error checks to String::xml_unescape
* Refactor XMLParser to use String::xml_unescape instead of an internal
implementation
2021-06-03 11:44:47 +02:00
Rémi Verschelde
fd4475f652
OS: Better validation of invalid input for get_unix_time_from_datetime
Default missing keys to Unix time 0 (1970-01-01 at 00:00:00 UTC).
Abort if year <= 0, this is not supported by the current algorithm.

Prevents an infinite loop further down.

Fixes #49022.

(cherry picked from commit 62efa30ed2)
2021-06-01 12:52:18 +02:00
Rémi Verschelde
e9909b763a
Merge pull request #49057 from lawnjelly/bvh_current_tree
BVH - fix stale current_tree in deactivate function
2021-05-26 11:13:34 +02:00
Rémi Verschelde
94b5a82e7d
Merge pull request #48943 from Calinou/screen-orientation-remove-ios-duplicate-3.x
Remove duplicate orientation settings in the iOS export preset
2021-05-26 00:24:17 +02:00
Hugo Locurcio
914b5dc525
Remove duplicate orientation settings in the iOS export preset
The screen orientation is now sourced from the Project Settings
like it is done for Android already.
2021-05-25 23:55:37 +02:00
Rémi Verschelde
2555567e7a
Merge pull request #49072 from pfertyk/issue-49006-decompress-crashes-godot
[3.x] Return error when decompressing empty PoolByteArray
2021-05-25 21:18:30 +02:00
Paweł Fertyk
f563cabb4e Return error when decompressing empty buffer 2021-05-25 17:31:00 +02:00
lawnjelly
14ce176f10 BVH - thread safety option
Added optional thread safe version through template argument and runtime switch, that wraps access with a mutex.
2021-05-25 10:47:32 +01:00
lawnjelly
0a350845d5 BVH - fix stale current_tree in deactivate function
Changes passing of current_tree from a member variable to a function argument, making bugs due to stale state less likely.

Fix a bug in deactivate where current_tree variable was stale. This may have resulted in visual anomalies.
2021-05-25 10:43:04 +01:00
Hugo Locurcio
a38b447413
Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
2021-05-25 00:31:39 +02:00
Rémi Verschelde
b94b09cd19
Merge pull request #46860 from bruvzg/symlinks_and_macos_gdn_framework_export 2021-05-24 15:15:10 +02:00
Zae
3756fbd463
Fix duplicate close files when deconstructing ZipArchive
(cherry picked from commit a65dac3fa7)
2021-05-24 12:56:41 +02:00
Rémi Verschelde
ac3417005d
Merge pull request #48533 from mortarroad/3.x-convex-hull-ported
[3.x] Port Bullet's convex hull computer to replace of QuickHull
2021-05-22 23:23:15 +02:00
bruvzg
6aa8f7d85b
Add symlink API to the DirAccess (on macOS and Linux). 2021-05-22 17:36:16 +03:00
Morris Tabor
ba396caefc Replace QuickHull with Bullet's convex hull computer.
The code is based on the current version of thirdparty/vhacd and modified to use Godot's types and code style.

Additional changes:
- backported and extended PagedAllocator to allow leaked objects
- applied patch from https://github.com/bulletphysics/bullet3/pull/3037
2021-05-22 08:16:43 +02:00
Rémi Verschelde
2660fafcc0
Merge pull request #48869 from tavurth/feature/hmac-port
Backport HMACContext to 3.x
2021-05-21 19:06:18 +02:00
Aaron Franke
ebfba19b59
Use global scope round method for rounding
(cherry picked from commit b01aa69c80)
2021-05-21 13:41:27 +02:00
Hugo Locurcio
66a8654963
Remove #ifdef catering to MSVC 2012 and earlier in math_funcs.h
For the `master` branch, the minimum supported MSVC version is now
MSVC 2017 (with MSVC 2019 being recommended).

(cherry picked from commit b57d9c8005)
2021-05-21 13:41:27 +02:00
Haoyu Qiu
3f89287ddb
Fix XMLParser behavior for comments and premature endings
(cherry picked from commit 549ad70760)
2021-05-21 12:27:45 +02:00
Rémi Verschelde
f479a7972f
Merge pull request #48883 from akien-mga/3.x-codespell-2.0.0
[3.x] Fix typos with codespell
2021-05-20 14:32:14 +02:00
Rémi Verschelde
eb78f80f03
Fix typos with codespell
Using codespell 2.0.0.

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

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2021-05-20 12:56:56 +02:00
Aaron Franke
1154b6264c
[3.x] Make is_equal_approx have explicit float and double versions 2021-05-20 06:50:09 -04:00
Will Whitty
3f606263d5 Backport HMac crypto to 3.x
Fix headers

Fix docs formatting

Changes for PR

Fix tests
2021-05-20 13:29:38 +03:00
Marcel Admiraal
26a99548f2 Fix Quat includes 2021-05-19 15:13:39 +01:00
Pedro J. Estébanez
817ffc01e1
Make all file access 64-bit (uint64_t)
This changes the types of a big number of variables.

General rules:
- Using `uint64_t` in general. We also considered `int64_t` but eventually
  settled on keeping it unsigned, which is also closer to what one would expect
  with `size_t`/`off_t`.
- We only keep `int64_t` for `seek_end` (takes a negative offset from the end)
  and for the `Variant` bindings, since `Variant::INT` is `int64_t`. This means
  we only need to guard against passing negative values in `core_bind.cpp`.
- Using `uint32_t` integers for concepts not needing such a huge range, like
  pages, blocks, etc.

In addition:
- Improve usage of integer types in some related places; namely, `DirAccess`,
  core binds.

Note:
- On Windows, `_ftelli64` reports invalid values when using 32-bit MinGW with
  version < 8.0. This was an upstream bug fixed in 8.0. It breaks support for
  big files on 32-bit Windows builds made with that toolchain. We might add a
  workaround.

Fixes #44363.
Fixes godotengine/godot-proposals#400.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-05-16 17:52:31 +02:00
Marcus Brummer
74174676b8
Fixed build with SCRIPT_AES256_ENCRYPTION_KEY set
(cherry picked from commit 7e8e40a38e)
2021-05-14 15:15:25 +02:00
Zae
3fd1a5d144
Fix zip file opening twice
(cherry picked from commit f403e62df1)
2021-05-14 12:57:43 +02:00
Rémi Verschelde
a00ef0d27b
SCons: Abort if SCRIPT_AES256_ENCRYPTION_KEY is invalid
Helps users figure out that something is wrong if they did define this
environment variable and it turns out being ignored.

(cherry picked from commit 08b4383e3f)
2021-05-14 12:03:55 +02:00
Will Whitty
c1135cf006 Work on porting HTTPRequest compression to 3.3
Fix doc issues

Use memcpy

Bind RESULT_BODY_DECOMPRESS_FAILED

Docs update
2021-05-14 12:20:31 +03:00
bruvzg
3b0c071ce2
[macOS] Prefer .app bundle icon over the default one. 2021-05-13 09:30:56 +03:00
Hugo Locurcio
8b06085249
Implement the %command% placeholder in the Main Run Args setting
This can be used to tell Godot to run an executable that will run Godot
rather than running Godot directly. This is useful to make Godot start
on the dedicated GPU when using a NVIDIA Optimus setup on Linux:
`prime-run %command%`

The `editor/run/main_run_args` setting declaration was moved to make it
visible in the ProjectSettings documentation.

(cherry picked from commit ce4aa07276)
2021-05-09 17:47:38 +02:00
Pedro J. Estébanez
90f13520dd Extend UndoRedo handling of Resource to every Reference 2021-05-09 09:29:45 +02:00
Rémi Verschelde
e96f0ea1d7
Android: Remove non-functional native video OS methods
Those methods are only properly implemented for iOS.

Supersedes #43811.
2021-05-07 16:42:17 +02:00
bruvzg
dab4cf3ed6
Add physical_scancode (keyboard layout independent keycodes) to InputEventKey and InputMap.
Fix non-latin keyboard layout keycodes on Linux/X11 (fallback to physical keycodes).
2021-05-06 23:19:45 +03:00
Rémi Verschelde
bf9f288c7d
Fix crash with user-defined ResourceFormatLoader.load
There's still some fishy recursive relationship between `load_interactive` and
`load` which needs to be investigated here, but this patch solves the crash
when returning an error code in user-defined `load`.

Fixes #48463.
2021-05-05 15:44:42 +02:00
Rémi Verschelde
619482472e
Merge pull request #48355 from MaxStgs/3.x
Add PackedDataContainer data pointer check for non nullable
2021-05-05 15:22:40 +02:00
Rémi Verschelde
140350d767
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2021-05-05 15:02:01 +02:00
PouleyKetchoupp
0dacc681b6 Fixed unnecessary bvh tree updates when calling set_pairable
Dynamic BVH doesn't update the tree anymore when calling set_pairable
with no parameter change.

Also modified Godot Physics broadphase to create objects directly with
pairable (static) set correctly to make use of this optimization for the
BVH broadphase.

Note: Octree broadphase doesn't use this optimization because it forces
an update on move, so passing the proper AABB and static parameters on
creation would cause the tree to update twice.
2021-05-04 12:24:31 -07:00
Rémi Verschelde
b4af1eba0a
Style: Enforce use of bool literals instead of integers
Using clang-tidy's `modernize-use-bool-literals`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html
2021-05-04 16:39:13 +02:00
Rémi Verschelde
a828398655
Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2021-05-04 16:30:23 +02:00
Rémi Verschelde
b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde
64a63e0861
Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde
3d15f04668
Style: clang-format: Disable AllowShortIfStatementsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde
6e600cb3f0
Style: Set clang-format Standard to c++14 2021-05-04 14:45:15 +02:00
Rémi Verschelde
2660f24160
Merge pull request #48429 from kleonc/posmod-change-int-to-int64
[3.x] Make posmod use int64_t instead of int
2021-05-04 12:31:01 +02:00
Rémi Verschelde
32cc022267
Merge pull request #48314 from nekomatata/physics-2d-dynamic-bvh
[3.x] Support for Dynamic BVH as 2D Physics broadphase
2021-05-04 09:23:04 +02:00
kleonc
f04a964627 Make posmod use int64_t instead of int 2021-05-03 22:03:16 +02:00
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
MaxStgs
94d0c4182b Add PackedDataContainer data pointer check for non nullable 2021-05-02 15:56:36 +05:00
PouleyKetchoupp
d8f681029f Support for Dynamic BVH as 2D Physics broadphase
List of changes:
- Modified bvh class to handle 2D and 3D as a template
- Changes in Rect2, Vector2, Vector3 interface to uniformize template
calls
- New option in Project Settings to enable BVH for 2D Physics (enabled
by default like in 3D)
2021-04-30 15:53:15 -07: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