Commit graph

3438 commits

Author SHA1 Message Date
Haoyu Qiu 8a47fe9eb0 Fix crash when casting from null 2021-09-26 10:08:14 +08:00
kleonc 67b27ea4c9
AStar Add error messages
(cherry picked from commit 71255bc2a9)
2021-09-21 20:33:12 +02:00
Rémi Verschelde b4fc24b73f
Implement OS::get_locale_language() helper method
This method extracts the 2 or 3-letter language code from `OS::get_locale()`,
making it easier for users to identify the "main" language code for users
that might have different OS locales due to different OS or region, but
should be matched to the same translation (e.g. "generic" Spanish).

Fixes #40703.

(cherry picked from commit def99c7baf)
2021-09-21 20:33:12 +02:00
Lucy 83bbb527ad
Allow for platform Thread implementation override
(cherry picked from commit e9723efd34)
2021-09-21 17:15:00 +02:00
jmb462 e7dac5da41
Adding InputMap action error suggestion for Input singleton
(cherry picked from commit a3b9842616)
2021-09-21 17:14:58 +02:00
Rémi Verschelde 22aab6be1c
Merge pull request #51796 from RandomShaper/dangling_obj_release_3.x
[3.x] Promote object validity checks to release builds
2021-09-21 11:48:11 +02:00
Pedro J. Estébanez 26edc6cd41 Promote object validity checks to release builds
Extra:
- Optimized the debug-only check about why the object is null to determine if it's because it has been deleted (the RC is enough; no need to check the ObjectDB).
- Because of the previous point. the debugger being attached is not required anymore for giving the "Object was deleted" error; from now, it only matters that it's a debug build.
- `is_instance_valid()` is now trustworthy. It will return `true` if, and only if, the last object assigned to a `Variant` is still alive (and not if a new object happened to be created at the same memory address of the old one).
- Replacements of `instance_validate()` are used where possible `Variant::is_invalid_object()` is introduced to help with that. (GDScript's `is_instance_valid()` is good.)
2021-09-21 10:39:04 +02:00
Rémi Verschelde b37776fa2f
Merge pull request #52591 from timothyqiu/error-macros
[3.x] Remove do{ } while(0) wrapper around error macros
2021-09-21 10:38:34 +02:00
David Socha ede023d4fa
Update connection comparison operator to compare connection sources based on instance ID instead of by pointer 2021-09-21 01:38:11 -05:00
Rémi Verschelde 91d0e985cd
Merge pull request #52572 from timothyqiu/expose-enum-3x
[3.x] Expose enum related methods in ClassDB
2021-09-20 16:12:16 +02:00
lawnjelly 0316d50ece
Improve Basis::get_quaternion error message
The previous error message incorrectly suggested that any Basis could be fixed by calling get_rotation_quation() or orthonormalize(). This PR points out that only a valid rotation Basis can be fixed in this way.

(cherry picked from commit d3a3b3aff3)
2021-09-20 13:05:26 +02:00
Ricardo Subtil 723ad5ef61
Fix path with multiple slashes not being corrected on templates
(cherry picked from commit eef0327d1e)
2021-09-20 13:01:13 +02:00
Hugo Locurcio 59eafe4cd3
Remove #ifdefs for handling compilation with Visual Studio < 2015
Godot 3.3 and later require Visual Studio 2017 to be compiled.

(cherry picked from commit fc0bfbb33b)
2021-09-19 11:30:22 +02:00
Rémi Verschelde 16ca2757f8
Merge pull request #52737 from EIRTeam/action_erase_fix 2021-09-17 11:52:42 +02:00
Álex Román Núñez 43bc8830f1 Fix InputMap.action_erase_event() failing to erase events correctly.
Fixes #52733

(3.x backport of 7104229a85)
2021-09-17 03:08:21 +02:00
Theraot d03f7c0598 [3.x] Fix get_base_dir windows top level directory logic
This is a fix for https://github.com/godotengine/godot/issues/52048
2021-09-16 06:38:29 -05:00
Rémi Verschelde 187b1ec61e
Merge pull request #51095 from RandomShaper/error_cast_freed_object_3.x
[3.x] Complain if casting a freed object in a debug session
2021-09-14 22:40:17 +02:00
Pedro J. Estébanez 123d3ef935 Complain if casting a freed object in a debug session
The idea is to give the user a chance to realize a mistake that will cause a crash in a release build (or with no debugger attached).
2021-09-14 21:05:47 +02:00
Haoyu Qiu 25bd0c3f72
Try other resolved IPs if one fails to connect
(cherry picked from commit fd52e18d19)
2021-09-14 14:18:18 +02:00
Haoyu Qiu e46d54ebec
Quote and escape ConfigFile keys when necessary
(cherry picked from commit 597d489a20)
2021-09-14 13:41:27 +02:00
Gilles Roudière b0cb253a51
Fix LocalVector crash on insert.
(cherry picked from commit de0765b94a)
2021-09-14 13:41:26 +02:00
Haoyu Qiu 70853fd669 Remove do{ } while(0) wrapper around error macros 2021-09-12 15:04:53 +08:00
Haoyu Qiu 468a2a2a65 Expose enum related methods in ClassDB 2021-09-11 20:33:29 +08:00
kobewi 02535e7f17 Compare connections by object id 2021-09-08 14:00:29 +02:00
Camille Mohr-Daurat 8608ece42f
Merge pull request #50405 from nekomatata/clean-convex-hull-decomposition-3.x
[3.x] Clean convex hull decomposition code
2021-09-06 09:34:50 -07:00
Wilson E. Alvarez f5409e7c3f
Fixed String::simplify_path Variant return type 2021-08-29 20:25:00 -04:00
Hugo Locurcio d717eb537b
Add an Array.pop_at() method to pop an element at an arbitrary index
Negative indices are supported to pop an element relative from the end.
2021-08-27 01:27:07 +02:00
Camille Mohr-Daurat 52b7be5c41
Merge pull request #52059 from mortarroad/3.x-fix-convex-hull-double-edges
[3.x] Fix emitting duplicate edges for convex hulls
2021-08-24 15:41:11 -07:00
Morris Tabor 647ab948c0 Fix emitting duplicate edges for convex hulls
Fixes https://github.com/godotengine/godot/issues/51909
2021-08-24 19:26:33 +02:00
Wilson E. Alvarez fb5417a17b
[3.x] Expose String.simplify_path 2021-08-24 00:48:20 -04:00
Morris Tabor 82279538a3 Fix winding of new convex hull implementation. 2021-08-20 15:19:39 +02:00
kobewi 6eb52b0768
Fix renaming directories
(cherry picked from commit 0dde3e5b59)
2021-08-18 23:19:44 +02:00
Haoyu Qiu 5f316aa216 Improve Undo/Redo menu items
* Make Undo/Redo menu items disabled when clicking it does nothing.
    * Context menu of `TextEdit`
    * Context menu of `LineEdit`
    * Editor's Scene menu
    * Script editor's Edit menu and context menu  (for Script and Text)
* Make editor undo/redo log messages translatable.
* Mark `UndoRedo`'s `has_{un,re}do()` methods as `const`.
* Expose `TextEdit`'s `has_{un,re}do()` to scripts since `{un,re}do()` are already available.
2021-08-18 00:46:51 +08:00
Rémi Verschelde c0fc475078
Merge pull request #51521 from lawnjelly/portals_occluders
Sphere occluders (portals and general use)
2021-08-17 13:55:34 +02:00
lawnjelly 115f4dce55 Sphere occluders (portals and general use)
Add framework for supporting geometrical occluders within rooms, and add support for sphere occluders.
Includes gizmos for editing.

They also work outside the portal system.
2021-08-17 09:02:06 +01:00
Rémi Verschelde 76c891c257
Merge pull request #51706 from maiself/fix-input-methods-returning-zero-strength
Fix input methods returning zero strength when pressed status not requested
2021-08-16 13:02:36 +02:00
Mai Lavelle d418443992 Fix input methods returning zero strength when pressed status not requested
Fixes behavior of these methods:

`InputMap::event_get_action_status`
`InputEvent*::action_match`

Previously when `p_pressed` was `nullptr`, `p_strength` would be set to
`0.0f` regardless of event strength. This affected `InputEventAction` events
processed by `Input.parse_input_event` for example.

Regression found in afa89c9eea
2021-08-15 20:00:31 -04:00
ne0fhyk c88d1608ab Add partial support for Android scoped storage.
This is done by providing API access to app specific directories which don't have any limitations and allows us to bump the target sdk version to 30.
In addition, we're also bumping the min sdk version to 19 as version 18 is no longer supported by Google Play Services and only account of 0.3% of Android devices.
2021-08-13 11:04:17 -07:00
Rémi Verschelde ffc372b002
Merge pull request #42220 from RandomShaper/agile_input_3.2
[3.x] Improve responsiveness on underpowered Android devices
2021-08-12 22:46:17 +02:00
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