Commit graph

3381 commits

Author SHA1 Message Date
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
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
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