Commit graph

3049 commits

Author SHA1 Message Date
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
Haoyu Qiu
4d727f1ee6 Allows to doc vararg method return type as void 2020-01-02 21:37:26 +08:00
PouleyKetchoupp
1591677eb8 Fixed antialiasing option for Polygon2D
Some cases were not handled properly for Polygon2D after making changes in common code to fix Line2D antialiasing. Added an option for drawing polygons to differentiate the two use cases.

Fixes #34568
2020-01-01 11:40:14 +01:00
Rémi Verschelde
a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Rémi Verschelde
ccedda9c71
Merge pull request #34682 from Calinou/os-exit-code-nonportable-warning
Print a warning message if `OS.exit_code` is set to a non-portable value
2019-12-30 18:09:32 +01:00
Hugo Locurcio
d441a6aefa
Print a warning message if OS.exit_code is set to a non-portable value
This also improves the related documentation.
2019-12-29 16:56:22 +01:00
Danil Alexeev
134755ebcf Add ord() function to Expression class
The ord() function was recently added in GDScript and VisualScript,
but was missed in the Expression class.
2019-12-29 09:20:10 +03:00
Rafał Mikrut
1ac701cc37 Don't use constant reference in Vector push_back, insert and append_array 2019-12-26 17:38:08 +01:00
Fabio Alessandrelli
cbc772d696 Fix buffers size calculation in PacketPeerStream.
The calculation used to be wrong when exactly at a power of 2.
`nearest_shift` always return the "next" power of 2
`nearest_shift(4) == 3 # 2^3 = 8`.

On the other hand `next_power_of_2` returns the exact value if that
value is a power of 2 (i.e. `next_power_of_2(4) == 4`).

I.e. :
```
WARN_PRINT(itos(next_power_of_2(4)) + " " + itos(1 << nearest_shift(4)));
// WARNING: ... : 4 8
```

Is this by design?
2019-12-22 15:35:44 +01:00
volzhs
02d5591d9d Make sure no additional slash being added with localize_path 2019-12-20 14:49:01 +09:00
Haoyu Qiu
e7e095da3f Encodes property names properly in project.godot 2019-12-20 10:42:08 +08:00
Rémi Verschelde
791c84bbbb
Merge pull request #34421 from Chaosus/fix_strcpy_warning
Fix build warning in ustring.cpp on Windows/MSVC platform
2019-12-19 12:19:45 +01:00
Juan Linietsky
28599e6c20 Suggest use of deferred or oneshot on disconnect if the signal is locked. Closes #34443. 2019-12-18 19:32:00 -03:00
Yuri Roubinsky
8674655a45 Fix build warning in ustring.cpp on Windows/MSVC platform 2019-12-18 17:40:51 +03:00
Rémi Verschelde
7d34d1a85f
Merge pull request #34348 from Catchawink/master
Fixed issues with using a relative path in the export window.
2019-12-17 22:24:34 +01:00
Juan Linietsky
0dd6079e4e Improve error message and do not spam forever. 2019-12-17 11:18:47 -03:00
Juan Linietsky
22637beb2e Restore signal locking, for some reason missing. 2019-12-17 10:43:51 -03:00
Catchawink
b2a14042d5 Fixed issues with using a relative path in the export window.
Before this fix, opening relative export paths inside of an EditorFileDialog was not possible. This was fixed by modifying String::path_to_file() to save relative paths in EditorExportPreset::set_export_path() more appropriately and changing EditorFileDialog::set_current_dir() to open relative paths.
2019-12-16 09:50:42 -05:00
Aaron Franke
1b8b380993
Document that translated does not behave like rotated or scaled 2019-12-15 12:31:08 -05:00
Rémi Verschelde
d3a07d3550
Merge pull request #33910 from Faless/net/android_mlock
Acquire MulticastLock on Android when using broadcast/multicast
2019-12-14 21:53:08 +01:00
Fabio Alessandrelli
9269d6be32 UDP sockets broadcast is now disabled by default.
Add method `set_broadcast_enabled` to allow enabling broadcast via
GDScript.
2019-12-14 17:48:16 +01:00
Rémi Verschelde
f111d1aaed Drop b2d_convexdecomp. no longer necessary.
We now use `thirdparty/misc/triangulator.h` for all physics-related
(collision, navigation) triangulation needs.

Follow-up to #34293.
2019-12-13 23:29:52 +01:00
Rémi Verschelde
d31ff039ed
Merge pull request #34310 from qarmin/shift_operators
Don't allow to use too big or too small shift count
2019-12-13 09:47:43 +01:00
Rafał Mikrut
162a64efcd Don't allow to use too big or too small shift operators 2019-12-12 20:00:26 +01:00
Haoyu Qiu
50c37ed986 Fixes crash when using Resource::_take_over_path 2019-12-12 14:39:03 +08:00
Rémi Verschelde
9abc0ad8a5
Merge pull request #27792 from Giacom/fix_quat
Fixes being unable to use the Quat(Vector3) constructor
2019-12-11 22:04:09 +01:00
Fabio Alessandrelli
ab1bfb9007 NetSocket set_broadcast_enabled returns Error enum 2019-12-10 12:11:52 +01:00