Commit graph

3591 commits

Author SHA1 Message Date
Rémi Verschelde
14ef65e49b
Merge pull request #54348 from akien-mga/3.x-clang-format-dont-align-operands 2021-10-28 15:43:15 +02:00
Rémi Verschelde
87c80f529f
clang-format: Enable BreakBeforeTernaryOperators
clang-format keeps breaking the way it handles break *after* ternary operators,
so I give up and go with the only style they seem to actually test.
2021-10-28 14:50:33 +02:00
Rémi Verschelde
1b65550ec7
clang-format: Various fixes to comments alignment from clang-format 13
All reviewed manually and occasionally rewritten to avoid bad auto formatting.
2021-10-28 14:50:32 +02:00
Rémi Verschelde
42d385b312
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 13:23:38 +02:00
Rémi Verschelde
8c04e10298
Merge pull request #54271 from nekomatata/fix-bvh-recheck-pairs-crash 2021-10-26 18:49:31 +02:00
Max Hilbrunner
e29126914d
Save all 64 bits of get_ticks_msec() in more cases
(cherry picked from commit 5dc02eb8b0)
2021-10-26 18:23:31 +02:00
PouleyKetchoupp
ba424a22d3 Fix crash due to recheck pair process in BVH broadphase
The pair user data wasn't correctly updated in the BVH from the check
pair callback.

This could lead to crashes when the check caused logical unpairing in
physics, then actual unpairing from the broadphase occured and the
physics server tried to delete an already deleted pointer.
2021-10-26 09:17:36 -07:00
Pedro J. Estébanez
beb99fe54b
Expose Input::flush_buffered_events()
(cherry picked from commit 6dc3fae201)
2021-10-23 12:02:48 +02:00
Aaron Franke
5659120af3
[3.x] Add support for the RISC-V architecture
Supports RV64GC (RISC-V 64-bit with general-purpose and compressed-instruction extensions)
2021-10-22 12:51:23 -05:00
PouleyKetchoupp
48144ed40e Fix physics BVH broadphase update when changing collision layer/mask
The BVH implementation is not checking collision layers on existing
pairs on move like other physics broadphases do.

This is solved by adding a new call to trigger pair callbacks again so
the physics engine can check layers again (specific to the BVH version,
other broadphase implementations just trigger a move like before).
2021-10-21 16:53:41 -07:00
bruvzg
b97ca39360 Fix handling multiple "physical key" events in the single input map action. 2021-10-19 22:19:13 +03:00
Rémi Verschelde
da5c843bd1
Merge pull request #53986 from madmiraal/remove-unused-variables-3.x 2021-10-19 12:18:21 +02:00
Rémi Verschelde
c743649c0b
Merge pull request #53742 from DmitriySalnikov/exposed_sensor_setters 2021-10-18 23:01:07 +02:00
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
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