Commit Graph

3528 Commits

Author SHA1 Message Date
Rémi Verschelde 0fb135d598
Merge pull request #53779 from m4gr3d/restrict_project_data_dir_config_3x 2021-10-18 22:58:51 +02:00
Marcel Admiraal fe9fd5c5ce Remove unused variables 2021-10-18 18:51:05 +01:00
Rémi Verschelde a5093d64ac
SCons: List `.gen.cpp` sources explicitly to avoid globbing errors
Whenever we change the name (or remove) generated cpp files with the `.gen.cpp`
extension, users run into build issues when switching between branches (i.e.
switching before and after the name change/removal). This is because we glob
`*.cpp` so if a now-obsolete file from a previous build is present, we'll
include it too, potentially leading to bugs or compilation failure (due to
missing headers or invalid code).

So globbing patterns in `add_source_files` will now skip files ending with
`.gen.cpp`, which should instead be passed explicitly where they're used.

(cherry picked from commit c133480531)
2021-10-16 10:59:14 +02:00
Rémi Verschelde 9657559b66
SCons: Set `DEBUG_ENABLED` and `DEV_ENABLED` in SConstruct
They're the same for all platforms so they don't need to be repeated in all
platform definitions.

(cherry picked from commit cd21cc683a)
2021-10-15 12:54:16 +02:00
Nathan Franke 4df2951b5c
Fix character encoding of Engine::get_copyright_info
(cherry picked from commit 28c163a432)
2021-10-15 12:51:42 +02:00
Fredia Huya-Kouadio 2b6678c851 Restrict the project data directory configuration. 2021-10-13 13:56:01 -07:00
Rémi Verschelde 8bdeee04f0
Merge pull request #53655 from pycbouh/core-print-bytearray-contents-3.x 2021-10-13 12:50:32 +02:00
Rémi Verschelde 4186c5e757
Merge pull request #53490 from briansemrau/thread-is-alive-3.x
[3.x] [core_bind] Add `Thread::is_alive`
2021-10-12 22:35:26 +02:00
Дмитрий Сальников 5cf898b897 Exposed setters for sensor values in Input class 2021-10-12 23:09:30 +03:00
Yuri Sizov c2106725ae Unify Pool*Array printing output
Co-authored-by: mashumafi <mashumafi@gmail.com>
2021-10-12 22:31:18 +03:00
Fredia Huya-Kouadio d1808f0a7f Make the project data directory customizable. 2021-10-11 14:42:40 -07:00
Yuri Sizov b02c61ddb1 Ignore OS specific values (constants, project settings, properties)
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2021-10-10 23:40:32 +03:00
Bartłomiej T. Listwon 5b4e3624f4 Faster hash_compare for integer and string keys in dictionaries 2021-10-08 10:13:43 +02:00
Rémi Verschelde 81da3b8ba4
Use translated docs in PropertySelector
And do the dedent and stripping for both translated and
non-translated strings for consistency, and so that we
don't need to do it at the call site.

(cherry picked from commit a16031beb6)
2021-10-07 12:48:23 +02:00
Thakee Nathees 46df39d5e5
i18n: Fix parsing of multiple escapes before quotes
See https://github.com/godotengine/godot/pull/37114#issuecomment-601463765

(cherry picked from commit 8c3ad2af93)
2021-10-07 12:48:23 +02:00
Rémi Verschelde 9729432ec0
i18n: Add support for translating the class reference
- Parse `.po` files from `doc/translations/*.po` like already done
  with `editor/translations/*.po`.
- Add logic to register a doc translation mapping in `TranslationServer`
  and `EditorSettings`.
- Add `DTR()` to lookup the doc translation mapping (similar to `TTR()`).
  Strings are automatically dedented and stripped of whitespace to ensure
  that they would match the translation catalog.
- Use `DTR()` to translate relevant strings in `EditorHelp`,
  `EditorInspector`, `CreateDialog`, `ConnectionsDialog`.
- Small simplification to `TranslationLoaderPO`, the path argument was
  not really meaningful.

(cherry picked from commit 4857648a16)
2021-10-07 12:48:23 +02:00
Brian Semrau d734bcc289 [core_bind] Add `Thread::is_alive` 2021-10-06 13:18:40 -04:00
Maxime Lapointe 487ca87e94
Improve error message when instantiating virtual class
(cherry picked from commit 29dc8de88b)
2021-10-06 09:29:31 +02:00
Rémi Verschelde df69945f1f
Merge pull request #52714 from m4gr3d/provide_getter_for_project_data_dir_3x 2021-10-05 21:02:41 +02:00
Rémi Verschelde c637588214
Merge pull request #47500 from briansemrau/nan-inf-tscn-parsing-bug-3.x 2021-10-05 20:00:05 +02:00
Thakee Nathees 91be2b4407 NaN, INF read/write bug fixed
Fix: #40589
2021-10-05 13:28:39 -04:00
Rémi Verschelde 393166793c
Merge pull request #52952 from Calinou/cpu-lightmapper-num-threads-editor-setting 2021-10-05 19:20:29 +02:00
Hugo Locurcio 0e943939e2
Add an editor setting to configure number of threads for lightmap baking
This can be used to free some CPU cores when baking lightmaps.
When using fewer CPU cores, lightmap baking is slower but background
tasks aren't slowed down as much.
2021-10-05 17:35:20 +02:00
Rémi Verschelde db0370cab5
Merge pull request #51086 from aaronfranke/3.x-warn-dectime 2021-10-05 12:06:03 +02:00
Rémi Verschelde d82c75adca
Merge pull request #53393 from lawnjelly/dev_asserts 2021-10-05 11:25:24 +02:00
Rémi Verschelde 5f1b659d35
Merge pull request #53226 from aaronfranke/3.x-c-locale 2021-10-05 11:20:20 +02:00
Jordan Schidlowsky db44406082
revert 0d7409a so additional error information prints in release builds
(cherry picked from commit b78d399f91)
2021-10-05 10:56:53 +02:00
lawnjelly c835f1f3c5 Add DEV_ASSERT and DEV_CHECK macros
Change the existing DEV_ASSERT function to be switched on and off by the DEV_ENABLED define. DEV_ASSERT breaks into the debugger as soon as hit.
Add error macros DEV_CHECK and DEV_CHECK_ONCE to add an alternative check that ERR_PRINT when a condition fails, again only enabled in DEV_ENABLED builds.
2021-10-04 14:57:54 +01:00
Shatur95 8ebefc8cf4
Fix CONNECT_REFERENCE_COUNTED
(cherry picked from commit e5a086fde6)
2021-10-04 15:15:27 +02:00
PouleyKetchoupp 54424b57b3
Fix buffer overflow in 2D BVH
Some areas of code were missed and assumed Vector3.

(cherry picked from commit d3c6395dcd)
2021-10-04 15:15:23 +02:00
Lucy 1d3f1c8c0a
Fix Platform Thread Override
(cherry picked from commit 5fe1857496)
2021-10-04 14:37:27 +02:00
Haoyu Qiu 7be67ee1b7 Fix crash when creating thread 2021-10-03 16:03:41 +08:00
Rémi Verschelde 7c9e06f936
Merge pull request #48686 from bruvzg/bundle_icon_3 2021-09-30 14:55:41 +02:00
Aaron Franke c1734dacf6
Add locale rename for the "C" locale 2021-09-29 13:57:24 -05:00
Rémi Verschelde 6bdd84b8d5
Fix -Wextra warnings from GCC 11 2021-09-29 15:23:12 +02:00
O01eg cddabf2a8b
Implement override of get_message 2021-09-29 14:06:57 +03:00
LATRio 4fb7b1ebb0 fix crash in Variant::get_method_default_arguments when wrong type is passed 2021-09-28 19:57:45 +09:00
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
Aaron Franke a5543bc35e
[3.x] Warn when using the dectime method
dectime has been removed in the master branch (what will be Godot 4.0)
2021-09-21 10:03:42 -05: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
Fredia Huya-Kouadio c8b022c165 Provide a getter for the project data directory. 2021-09-15 13:00:25 -07: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
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