Commit graph

3093 commits

Author SHA1 Message Date
Rémi Verschelde ebb30ac45a Core: Add hints to run with --verbose when leaking nodes/resources at exit
(cherry picked from commit 2b5545270a)
2020-06-10 15:30:52 +02:00
Rémi Verschelde 1a1c30702d VariantParser: Fix crash on malformed vectors
Each time `r_err_str` is set, we should return a parse error.

Removed redundant `return OK;` which were already handled after the big
`if`/`else if`/`else` for `TK_IDENTIFIER`.

Part of #17372.

(cherry picked from commit e7ebda975a)
2020-06-10 15:30:52 +02:00
Fabio Alessandrelli b2c7f94ae2 Crypto as a custom instance class.
(cherry picked from commit 87cc283b8b)
2020-06-10 15:30:51 +02:00
Fabio Alessandrelli 402a7e0094 Fix editor crash when mbedtls is disabled.
(cherry picked from commit 054f52364f)
2020-06-10 15:30:51 +02:00
azagaya a6d8773d0b Fixing wrong blending rect methods
Using Color.blend function instead of custom code

Fixed clang_format

Removed unnecessary help

(cherry picked from commit b211a86ebe)
2020-06-10 15:30:51 +02:00
Hugo Locurcio 424d1b5fab Print errors when calling MIDI input methods on unsupported platforms
This partially addresses #32065.

(cherry picked from commit 9c0d214776)
2020-06-04 12:09:40 +02:00
Rémi Verschelde 77aa8c0095 Improve documentation of ProjectSettings::setup
Subsequent PRs adding and fixing support for bundled PCKs
did not update the documentation /o\

(cherry picked from commit 0183bfbb0f)
2020-06-04 11:07:54 +02:00
bruvzg c4e652a6a3 Docs: Fix order of variant constants.
(cherry picked from commit 409562558a)
2020-05-25 16:32:25 +02:00
Rémi Verschelde d5e380117f
Merge pull request #38952 from bruvzg/win_ink_block_mm_3
[3.2] Block WM_MOUSEMOVE during Windows Ink pen handling.
2020-05-22 14:34:29 +02:00
bruvzg 28aabf4f73
[3.2] Block WM_MOUSEMOVE during Windows Ink pen handling. 2020-05-22 14:05:53 +03:00
Andrii Doroshenko (Xrayez) a3cad44f44 Add Image.save_png_to_buffer method
Backported from da0457fa29.

This commit additionally exposes the method to scripting (4.0).
2020-05-20 15:38:20 +03:00
Rémi Verschelde b6c551e864
Merge pull request #38875 from bruvzg/tab_drv_sel_32
[Windows, 3.2] Add tablet driver selection.
2020-05-20 13:58:26 +02:00
SkyJJ 2197ef0566 Fix Android LineEdit editing bugs
(cherry picked from commit cc473b948f)
2020-05-20 12:07:08 +02:00
Andrea Catania b0ba122443 Removed const from OAHashMap iterator value
to allows to mutate the value while iterating over it.

(cherry picked from commit 97f9bbcfa3)
2020-05-20 11:35:28 +02:00
bruvzg 71b2abbfa3
[Windows, 3.2] Add tablet driver selection. 2020-05-20 09:36:56 +03:00
Pedro J. Estébanez 8349635ffc Fix leaks and crashes in OAHashMap
This changes the way the lifespan of items is managed to be consistent.

Bonus: Simplify cases of destroy-then-emplace.
2020-05-18 14:02:49 +02:00
Thakee Nathees 7cfbde19c9 Fix: can't convert Transform -> Transform2D
Fix: #38528
(cherry picked from commit e32cdbe568)
2020-05-11 11:01:13 +02:00
Technohacker 9584f24be5
Use DWMEnableBlurBehindWindow instead of WS_EX_LAYERED
Affects per-pixel transparency

The current method renders to the screen by copying the GLES output to a
DIB for transparency using the CPU instead of rendering directly to the
window via the GPU. This is slower and also forces the window to be borderless
as WS_EX_LAYERED affects the non-client region as well.

This change uses DWMEnableBlurBehindWindow which allows using the standard
glClearColor() background alpha and is also performed through the GPU,
eliminating CPU bottlenecks
2020-05-10 21:05:37 +05:30
Rémi Verschelde aa57bb0473
Merge pull request #38482 from RandomShaper/improve_yield_3.2
Fix object leaks caused by unfulfilled yields (3.2)
2020-05-09 22:03:00 +02:00
Marcel Admiraal 23d473f488 Fix array slicing.
(cherry picked from commit 4409f3cc68)
2020-05-06 23:28:44 +02:00
Pedro J. Estébanez 64344e6d1d Fix object leaks caused by unfulfilled yields
Now the stack saved in a `GDScriptFunctionState` is cleared as soon as the `yield()` operation is known not to be resumed because either the script, the instance or both are deleted.

This clears problems like leaked objects by eliminating cases of circular references between `GDScriptFunctionState`s preventing them and the objects they refer to in their saved stacks from being released. As an example, this makes using `SceneTreeTimer` safer.

Furthermore, with this change it's now possible to print early warnings about `yield()`s to released script/instances, as now we know they won't be successfully resumed as the condition for that happens. However, this PR doesn't add such messages, to keep the observed behavior the same for the time being.

Also, now a backup of the function name in `GDScriptFunctionState` is used, since the script may not be valid by the time the function name is needed for the resume-after-yield error messages.
2020-05-05 17:53:47 +02:00
bruvzg 78266c09c4
Add support for the WinTab API for pen input. (3.2) 2020-05-05 14:56:02 +03:00
HaSa1002 caadd761f2 Priorize Embedded PCKs on loading
If existing, embedded PCKs are loaded before the pcks the engine might
find next to it.

Fixes #37568

(cherry picked from commit fba98950c7)
2020-05-05 13:41:29 +02:00
Marcel Admiraal fa11b5d754 Check for empty vectors before trying to access a pointer to the first
element in Octree<T, use_pairs, AL>::cull_convex().

(cherry picked from commit 54c36adbec)
2020-05-05 13:41:29 +02:00
Rémi Verschelde ef715f37d5
Merge pull request #35091 from Faless/dtls/enet
[3.2] DTLS support + optional ENet encryption
2020-05-05 13:40:59 +02:00
Juan Linietsky 7f61710183 Implement Skew in Node2D
Skew is x-axis only, because it must be bidirectionally convertible to a 2x3 matrix, but you can subtract it  to the rotation to get the effect on y-axis

(cherry picked from commit efb1f7d76b)
2020-05-04 16:10:22 +02:00
Hugo Locurcio 6fb6107e6a Warn when trying to open res:// or user:// with OS.shell_open()
`OS.shell_open()` will pass on the path directly to the OS' shell
handler (which can handle file paths or URLs). It can't handle
Godot-specific paths, so these need to be converted with
`ProjectSettings.globalize_path()` first.

(cherry picked from commit d46e411b44)
2020-05-01 10:56:58 +02:00
Rémi Verschelde 510406af28
Merge pull request #38350 from RandomShaper/fix_variant_to_rid
Fix errors in Variant to RID conversion
2020-04-30 16:25:29 +02:00
Pedro J. Estébanez ee301bceb5 Fix errors in Variant to RID conversion 2020-04-30 10:23:30 +02:00
Rémi Verschelde 8d93303483
Merge pull request #37863 from ExpiredPopsicle/culling5
Fixed false positives in the culling system.
2020-04-30 08:05:11 +02:00
Kiri Jolly bac44ee19f Fixed false positives in the culling system.
This fixes numerous false positives coming out of the culling system.

AABB checks are now a full separating-axis check against the frustum, with the points of the frustum being compared to the planes of the box just as the points of the box were being compared to the planes of the frustum. This fixes large objects behind the camera not being culled correctly.

Some systems that used frustums that were (sometimes mistakenly?) unbounded on one or more side have been modified to be fully enclosed.
2020-04-28 17:14:06 -07:00
Rémi Verschelde 78f0cf40cb
Merge pull request #38257 from RandomShaper/imvu/fix_variantrc_gdnative
Fix GDNative compat breakage due to dangling Variants fix
2020-04-27 18:43:10 +02:00
Pedro J. Estébanez 3bdc0913a5 Make wording of all Variant warnings consistent 2020-04-27 13:15:52 +02:00
Pedro J. Estébanez ac8b4708a3 Fix GDNative compat breakage due to dangling Variants fix
This moves the instance id member from Variant to the ObjectRC so that Variant is still the same size as before the fix (and also regardless if debug or release build).
2020-04-27 13:07:52 +02:00
Tobias Mansfield-Williams 8b33b08c29 Add const to InputEventMouseButton::get_factor
(cherry picked from commit 982efb1864)
2020-04-27 10:16:21 +02:00
Pedro J. Estébanez d904d05e65 Fix dangling and reassigned Variants
This commit addresses multiple issues with `Variant`s that point to an `Object`
which is later released, when it's tried to be accessed again.

Formerly, **while running on the debugger the system would check if the instance id was
still valid** to print warnings or return special values. Some cases weren't being
warned about whatsoever.

Also, a newly allocated `Object` could happen to be allocated at the same memory
address of an old one, making cases of use hard to find and having **`Variant`s pointing
to the old one magically reassigned to the new**.

This commit makes the engine realize all these situations **under debugging**
so you can detect and fix them. Running without a debugger attached will still
behave as it always did.

Also the warning messages have been extended and made clearer.

All that said, in the name of performance there's still one possible case of undefined
behavior: in multithreaded scripts there would be a race condition between a thread freeing
an `Object` and another one trying to operate on it. The latter may not realize the
`Object` has been freed soon enough. But that's a case of bad scripting that was never
supported anyway.
2020-04-23 13:51:02 +02:00
Rémi Verschelde 253fc093b8 DocData: Skip unexposed classes
Properly expose classes that we actually want accessible.

(cherry picked from commit 0ef8bcac4d)
2020-04-21 14:15:34 +02:00
Vasiliy Makarov 982dee67f0 Fix square image resize
Fixes #37980

(cherry picked from commit d45e8734d1)
2020-04-21 14:11:43 +02:00
Rémi Verschelde faf858fe41 Revert "Made possible to specify where to dump the contents when loading a ".pck" file"
This reverts commit ffcfd9c8ea.

This was not so useful as is due to the way dependency paths are stored
in scenes and resources.
2020-04-20 13:48:02 +02:00
Michael Alexsander ffcfd9c8ea Made possible to specify where to dump the contents when loading a ".pck" file
(cherry picked from commit 3c261e0dfa)
2020-04-17 13:00:52 +02:00
Marcel Admiraal e869da9665 Remove unnecessary check for zero determinant in Basis::orthonormalize().
(cherry picked from commit 8e6e91f2cd)
2020-04-16 12:57:22 +02:00
Marcel Admiraal 5bd603a542 Fix Engine get_target_fps() returning float instead of int.
(cherry picked from commit 0b9e95cac5)
2020-04-16 12:47:19 +02:00
Zak Grumbles 6fa871027c Make dict erase node sequenced godotengine#37477
* Updated macro call to make the visual Dictionary Erase node sequenced.

(cherry picked from commit d648f77119)
2020-04-16 12:04:10 +02:00
Juan Linietsky 94f451e070 Ensure COWData does not reallocate on push back, fixes #22561
(cherry picked from commit 0c24a844ec)
2020-04-16 11:46:00 +02:00
Yuri Roubinsky 5914fdc067 Implements estimate/compute_cost for AStar2D
(cherry picked from commit bad77bcb52)
2020-04-16 11:35:52 +02:00
Bastiaan Olij a7438f0e61 Fix aspect ratio on hmd projection matrix 2020-04-05 16:58:33 +10:00
sumit0190 35c7628074 Read and write exported infs/nans correctly (#35388)
(cherry picked from commit c4dbd8a744)
2020-03-25 11:38:54 +01:00
Rémi Verschelde 86ecefa1a2 Fix potential divisions by 0 reported by MSVC
The `TextEdit` one was indeed a potential bug.
The `PCKPacker` one seems to be a false positive, it's already in a
`for` loop that depends on `files.size()`.

(cherry picked from commit ca4e4506db)
2020-03-25 11:38:54 +01:00
Hugo Locurcio 6e517f9da3 Tweak the message queue maximum size property hint
The minimum slider value no longer allows decreasing the value below
the default, as this can cause things to break in the editor.

The maximum slider value was also increased to 4096 since it can safely
be increased to that value (some add-ons may require it).

This closes #37052.

(cherry picked from commit 8d8c7a9383)
2020-03-25 11:38:53 +01:00
PouleyKetchoupp 82bee3f993 Added has_signal method for Object
(cherry picked from commit 258d91f883)
2020-03-25 09:36:41 +01:00
Rémi Verschelde c01e840f03
Merge pull request #36639 from RandomShaper/imvu/improve_drives_ux_3.2
Improve UX of drive letters (3.2)
2020-03-17 16:27:33 +01:00
Pedro J. Estébanez 6105dfdac9 Improve UX of drive letters
Namely, move the drive dropdown to just the left of the path text box and don't include the former
in the latter.

This improves the UX on Windows.

In the UNIX case, since its concept of drives is (ab)used to provide shortcuts to useful paths, its
dropdown is kept at the original location.
2020-03-17 14:48:54 +01:00
Rémi Verschelde d4e6eff2de ConfigFile: Improve error messages and complete docs
(cherry picked from commit f7c87ed3dd)
2020-03-06 23:51:26 +01:00
Michael Alexsander bd2a2a7e40 Turn Rect2's 'intersects_touch()' into an extra argument of 'intersects()'
(cherry picked from commit 8c8c48a7ad)
2020-03-06 23:51:26 +01:00
Yuri Roubinsky cbeb22eb73 Fix InputEventKey::echo type from INT to BOOL
(cherry picked from commit 5e3c64828a)
2020-03-04 12:40:15 +01:00
Rémi Verschelde 105b7468b1 Expression: Fix parsing integers as 32-bit
(cherry picked from commit ceba2b6761)
2020-03-04 12:40:14 +01:00
Mateo Dev .59 e13324a889 Core: Change _Marshall class inherit from Reference to Object
(cherry picked from commit 9e8e5ebdc7)
2020-03-04 12:40:14 +01:00
clayjohn 2c0d391c48 Force mipmaps off when importing RGBA4444 textures 2020-02-29 19:23:56 -08:00
Fabio Alessandrelli 35a9f0fe64 New PacketPeerDTLS and DTLSServer classes.
Custom instance implementation via the mbedtls module.
2020-02-25 11:35:47 +01:00
Fabio Alessandrelli 2c8340bee9 UDPServer and PacketPeerUDP connect_to_host.
UDP sockets can be "connected" to filter packets from a specific source.
In case of a bound socket (e.g. server), a new socket can be created on
the same address/port that will receive all packets that are not
filtered by a more specific socket (e.g. the previously connect socket).

This way, a UDPServer can listen to new packets, and return a new
PacketPeerUDP when receiving one, knowing that is a "new client".
2020-02-25 11:35:47 +01:00
Fabio Alessandrelli 6b9240aa84 Add peek option to NetSocket recv_from. 2020-02-25 11:26:34 +01:00
Haoyu Qiu c81241e6c0 Fixes crash when resource file is corrupted
(cherry picked from commit 832a5c860b)
2020-02-14 16:07:41 +01:00
Pedro J. Estébanez 541251dff7 Add ConfigFile::parse()
(cherry picked from commit e5bd3b707f)
2020-02-14 16:06:36 +01:00
Pedro J. Estébanez edb70682d5 Fix VariantParser::StreamString EOF determination
(cherry picked from commit 521da75380)
2020-02-14 16:06:07 +01:00
dankan1890 7ccfbd61a4 Fixed String::humanize_size crash.
Close #35872

(cherry picked from commit ca0ee767cb)
2020-02-14 15:59:12 +01:00
nathanwfranke 2d8289579a Fix bug where Control at origin with 0 size not rendered
Make a new method instead to make the code more elegant


Move Function down a bit


(cherry picked from commit e5cb557b73)
2020-02-14 15:56:12 +01:00
Rémi Verschelde 505fee0b6d Color: Fix deprecation warning mentioning 'get_v()' instead of 'v'
Fixes #35657.
2020-01-28 12:41:04 +01:00
Rémi Verschelde cab55bbb9d MessageQueue: Fix setting name in OOM error message
Cf. #35653.
2020-01-28 09:03:46 +01:00
Haoyu Qiu f7d4e6ef6b Fixes invalid writes in Image operations 2020-01-28 13:47:28 +08:00
Rémi Verschelde c8d64de766
Merge pull request #35521 from Calinou/improve-error-macros
Improve and document error macros
2020-01-26 16:39:11 +01:00
Rémi Verschelde cbdbfb00ca doc: Document named color constants
Busywork but it's good for our completion rate :)
2020-01-26 12:08:16 +01:00
Hugo Locurcio 37d55ff153
Improve and document error macros
Documentation can be visible in many IDEs by hovering the macro
anywhere it's used.

Error message styling was also tweaked for consistency.
2020-01-24 17:19:57 +01:00
Hugo Locurcio a002b93d86
Add explanations for errors related to Vector/Quat normalization 2020-01-24 14:19:23 +01:00
Rémi Verschelde c2e07db071
Merge pull request #35438 from MadEqua/virtual-keyboard-line-edit
Android virtual keyboard respecting LineEdit max length.
2020-01-23 08:20:24 +01:00
Bruno Lourenço a3bcdbeb78 Android virtual keyboard respecting LineEdit max length. 2020-01-23 01:52:49 +00:00
Hugo Locurcio 90a1f8d8a7
Make OS.execute() blocking by default if not specified
This makes `OS.execute()` calls quicker to set up when calling programs
in a blocking fashion.
2020-01-23 01:26:32 +01:00
Rémi Verschelde a8460bffd2
Merge pull request #35414 from Ovnuniarchos/AlsaMidiBadPitchBend
ALSA MIDI: Pitch bend and System Common messages
2020-01-22 22:12:57 +01:00
Rémi Verschelde 37897dba80
Merge pull request #35406 from lawnjelly/ortho-shadow
Replace CameraMatrix::get_viewport_size with get_viewport_half_extents, shadow culling with ortho camera and other affected issues
2020-01-22 22:02:09 +01:00
Ovnuniarchos 9c48eb1c59 ALSA MIDI driver:
Pith bend message now has correct size (was 2 bytes instead of 3).
	Recognized (but not implemented) 0xF? messages. SysEx messages will be reocognized as such, but their contents will be ignored.
2020-01-22 21:41:48 +01:00
lawnjelly eaf8e5ce52 Change CameraMatrix::get_viewport_size to get_viewport_half_extents
Fixes #26637.
Fixes #19900.

The viewport_size returned by get_viewport_size was previously incorrect, being half the correct value. The function is renamed to get_viewport_half_extents, and now returns a Vector2.

Code which called this function has also been modified accordingly.

This PR also fixes shadow culling when using ortho cameras, because the correct input for CameraMatrix::set_orthogonal should be the full HEIGHT from get_viewport_half_extents, and not half the width.

It also fixes state.ubo_data.viewport_size in rasterizer_scene_gles3.cpp to be the width and the height of the viewport in pixels as stated in the documentation, rather than the current value which is half the viewport extents in worldspace, presumed to be a bug.
2020-01-22 18:22:00 +00:00
Rémi Verschelde 409de53e72
Merge pull request #35423 from Faless/fix/object_emit_free
Make sure we know when deleting an emitting object
2020-01-22 14:52:54 +01:00
Fabio Alessandrelli 41f59ecfca Make sure we know when deleting an emitting object
We used a lock signals in the signal_map while emitting, because it was
not allowed to disconnect them while being emitted.
We used that lock to check if we where deleting an object during signal
emission.
Now that we allow to disconnect signals while they are being emitted, if
an object first disconnects, then gets deleted we can't know that a
signal was being emitted during the destructor.

This commit adds a new `_emitting` boolean member to Object to be set
while emitting and checked in the destructor, while removing the old
signal lock which is now unused.
2020-01-22 14:08:16 +01:00
Rémi Verschelde ff7e7bd260 Thread: Fix typo in destructor error message 2020-01-22 11:17:20 +01:00
Haoyu Qiu a7368a519e Fixes leak when importing zip in AssetLib 2020-01-22 09:34:18 +08:00
Rémi Verschelde 79aaafc686
Merge pull request #35408 from Faless/ws/fix_packet_count
Fix MultiplayerAPI crash when peer implementation misbehave.
2020-01-21 21:06:11 +01:00
Fabio Alessandrelli 50f1b035b8 Fix MultiplayerAPI crash when peer impl misbehave.
Also fix WebSocketMultiplayer::get_available_packet_count() return value
when peer is not configured to use the multiplayer API.
2020-01-21 20:46:32 +01:00
Eric Rybicki 439e0027ec Fix AtlasPacker ignoring semi-transparent pixels
Fixes #33106
2020-01-20 22:43:38 +01:00
Rémi Verschelde 11260fb87f
Merge pull request #35345 from timothyqiu/pck-packer-leak
Fixes leak when calling PCKPacker::pck_start multiple times
2020-01-20 07:00:11 +01:00
Haoyu Qiu 07941178f0 Fixes leak when pck_start multiple times 2020-01-20 12:16:37 +08:00
Haoyu Qiu aca0b2a459 Fixes XMLParser leak when open multiple times 2020-01-20 11:29:14 +08:00
Fabio Alessandrelli 534bf89976 PacketPeer use heap buffer for var encoding.
Used to allocate in stack (via alloca) which causes crashes when trying
to encode big variables.
The buffer grows as needed up to `encode_buffer_max_size` (which is
8MiB by default) and always in power of 2.
2020-01-19 11:49:10 +01:00
Rémi Verschelde 870ec61417
Merge pull request #35092 from AndreaCatania/frames_exp
Exposed physics frame count and idle frame count
2020-01-14 08:25:46 +01:00
Rémi Verschelde 0aeb5bbf62 Object: Avoid error on emit_signal with freed target
As advised by @reduz.
2020-01-13 22:20:18 +01:00
Andrea Catania 9c60502357 Exposed physics frame count and idle frame count 2020-01-13 17:53:10 +01:00
Rémi Verschelde f38bfccf42 Object: Remove error on disconnect of locked signals
According to 22637beb2e (commitcomment-36651823)
and as confirmed by @reduz, this seems not to be necessary now that we
copy-on-write.

This triggered freeze scenarios in cases where a node would be deleted
while being used as a target in a signal emission.

Fixes #34650.
Fixes #34769.

Now those two errors go back to reporting:
```
ERROR: emit_signal: Condition ' !target ' is true. Continuing..:
   At: core/object.cpp:1191.
```
2020-01-13 17:03:02 +01:00
Rémi Verschelde ab97f78fa5 Revert "Enable Vsync via Compositor by default"
This reverts commit 9600fd5dde.

Add comment warning about possible implications of using this option.

Fixes #35038.
2020-01-13 09:33:27 +01:00
bruvzg d07cdc594f
[macOS] Load PCK from the .app bundle resources, instead of changing working directory. 2020-01-10 18:02:29 +02:00
Rémi Verschelde 83d950b58e
Merge pull request #34968 from Calinou/enable-vsync-via-compositor
Enable Vsync via Compositor by default
2020-01-10 10:04:55 +01:00
Hugo Locurcio 9600fd5dde
Enable Vsync via Compositor by default
This feature was added in #33414 but it was disabled by default.
Now that it got some testing, it's probably safe to enable it
by default.
2020-01-09 22:22:11 +01:00
George Marques 3718f8f592
GDScript: Validate object instance on is operation
Avoids crashes on debug mode. Instead it now breaks the execution and
show the error in-editor. Will still crash on release.

Also add a similar check to Marshalls to ensure the debugger doesn't
crash when trying to serialize the invalid instance.
2020-01-09 13:59:33 -03:00