Commit graph

3075 commits

Author SHA1 Message Date
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
Tomasz Chabora 97273ce378 Check if resource exists before loading 2020-01-08 15:24:43 +01:00
Rémi Verschelde 14b24b6a71
Merge pull request #34875 from neikeq/api-hash-no-underscore-methodbinds
ClassDB: Exclude method binds starting with '_' from API hash
2020-01-08 08:32:25 +01:00
Ignacio Etcheverry 4be87c6016 ClassDB: Exclude method binds starting with '_' from API hash
These methods are not meant to be part of the scripting API.
These are not the same as virtual methods starting with '_', e.g.: '_process'.
2020-01-07 00:08:49 +01:00
Rémi Verschelde 8aea5decc6
Merge pull request #34020 from gytsen/unify-pack-version
PCK: Set VERSION_PATCH in header, factor out header magic
2020-01-06 14:04:55 +01:00
Rémi Verschelde e62941fb53
Merge pull request #34296 from timothyqiu/lock-33072
Fixes crash when using Resource::_take_over_path
2020-01-06 14:04:23 +01:00
Joost Heitbrink dc61323b2c PCK: Set VERSION_PATCH in header, factor out header magic
Unify pack file version and magic to avoid hardcoded literals.

`version.py` now always includes `patch` even for the first release in
a new stable branch (e.g. 3.2). The public name stays without the patch
number, but `Engine.get_version_info()` already included `patch == 0`,
and we can remove some extra handling of undefined `VERSION_PATCH` this
way.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2020-01-06 13:13:17 +01:00
Rémi Verschelde 8454804972
Merge pull request #33967 from Calinou/add-os-is-window-focused
Add an `OS.is_window_focused()` getter
2020-01-06 11:39:18 +01:00
Rémi Verschelde 0783874ff2
Merge pull request #34782 from akien-mga/multiplayerapi-set_network_peer-invalid
MultiplayerAPI: Fix disconnect errors when passing invalid peer
2020-01-03 14:33:25 +01:00
Rémi Verschelde 136846a6ec
Merge pull request #34772 from clayjohn/ETC-support-alpha
Fallback to RGBA4444 for textures with alpha set to ETC compression
2020-01-03 14:29:19 +01:00
Rémi Verschelde fa82664419
Merge pull request #34726 from nekomatata/polygon2d-antialiasing-fix
Fixed antialiasing option for Polygon2D with concave/hollow shapes
2020-01-03 14:17:05 +01:00
Rémi Verschelde 3cbfb11460 MultiplayerAPI: Fix disconnect errors when passing invalid peer
Fixes #34634.
2020-01-03 13:34:54 +01:00
Rémi Verschelde 9d3424f61d
Merge pull request #34688 from sheepandshepherd/gdnative_class_ptr
Expose is_class_ptr to GDNative for dynamic casts
2020-01-03 11:32:01 +01:00
clayjohn 7a9fc69a16 Fallback to RGBA4444 for textures with alpha set to ETC compression 2020-01-02 21:37:48 -08:00
sheepandshepherd 3056c4bd5a Expose cast_to to GDNative for dynamic casts 2020-01-03 04:27:13 +01:00
Rémi Verschelde eadf04e1dd
Merge pull request #34476 from volzhs/no-slash-localize_path
Make sure no additional slash being added with localize_path
2020-01-02 19:11:18 +01:00
Rémi Verschelde bde52cc688
Merge pull request #34618 from qarmin/vector_please_dont_crash
Don't use constant reference in Vector push_back, insert and append_array
2020-01-02 15:44:41 +01:00
Rémi Verschelde a97b08e7d2
Merge pull request #34745 from timothyqiu/vararg-return-nil-34743
Allows to doc vararg method return type as void
2020-01-02 15:20:58 +01:00
Rémi Verschelde e772a1241a Object::disconnect: Better errors when no signal or locked
It will now give information about the originating object instance
and when locked, the target callback.

This should help debugging editor and game issues that are now being
reported due to adding signal locking in
22637beb2e.
2020-01-02 14:51:50 +01:00