Commit graph

3198 commits

Author SHA1 Message Date
Maganty Rushyendra
6344b75453 Enable zero padding with float specifier for format strings
Godot currently supports zero padding for integers, octals and
hexadecimals when using format strings, but not for floats.

This commit adds support for zero padding for floats, thus ensuring
consistent behavior for all types, and making Godot's format specifiers'
behavior closer to c's `printf()`.

Before: `print("<%07.2f>" % -0.2345)` prints `<  -0.23>`.
Now: `print("<%07.2f>" % -0.2345)` prints `<-000.23>`.
     `print("<%7.2f>" % -0.2345)` prints `<  -0.23>`.
(cherry picked from commit b7d835d9ca)
2020-06-11 09:41:37 +02:00
ntfs.hard
a822d1f133 Fix for Expression class: inner string can be single quoted
(cherry picked from commit ec164b2301)
2020-06-11 09:41:13 +02:00
Pedro J. Estébanez
f09046a9ab Fix potential crash when listing leaked objects
Note:
Casting to the C++ classes and calling the methods there would work as well,
but would require including he header files for the specific object types handled
here, which wouldn't be OK either.
2020-06-10 20:16:10 +02:00
Rémi Verschelde
7bf9787921 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.

(cherry picked from commit cd4e46ee65)
2020-06-10 15:30:52 +02:00
Rémi Verschelde
51de6732c9 AStar: Make get_closest_point() deterministic for equidistant points
Closes godotengine/godot-docs#3667.
Supersedes #39405.

(cherry picked from commit 187ba4c5a8)
2020-06-10 15:30:52 +02:00
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
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
Rémi Verschelde
2845e6a21a
Merge pull request #34040 from qarmin/unused_variable_more_precise_numbers
Removed unused variables, add some constants numbers
2019-12-10 08:25:31 +01:00
Rafał Mikrut
ed1c4bc77d Removed unused variables, add some constants numbers 2019-12-10 05:13:02 +01:00
Hugo Locurcio
fe06966181
Make some arguments in PCKPacker methods optional
Those arguments aren't required for most common use cases,
so making them optional should help with code readability.
2019-12-07 01:06:42 +01:00
Rémi Verschelde
95242b7faf ResourceLoader: Add language code matching for localized resources
Near matching was not implemented like in TranslationServer, so a
resource remapped for 'ru' (but not 'ru_RU') would not be used as
fallback if the system locale was 'ru_RU'.

Fixes #34058.
2019-12-04 16:53:40 +01:00
Rémi Verschelde
0fcb68ffa1 Translation: Refactor locale matching to use proper language code
The previous code only parsed the first two characters (potentially reading
out of bounds if input was invalid), but some locales use a 3-letter language
code (e.g. 'nah_MX').

So I refactored the logic a bit to properly parse the locale and extract the
part left of the regional code, if provided (supports both 'en_US' and 'en-US'
style).

I made TranslationServer::get_language_code() public as I'll use it in a
follow up commit.
2019-12-04 16:53:08 +01:00
TerminalJack
e1dda5195c Added support for vertical syncing via the Windows OS compositor (DWM.) 2019-12-04 11:14:21 +01:00
Andrii Doroshenko (Xrayez)
749d917424 Fix severe performance drop while deflating polylines
Underscaled arc tolerance produced very small values so that changes
to this parameter were negligible when scaled internally, hence significant
performance drop (lots of intermediate points inserted in an arc). Now the
performance is mostly the same compared to other types of offsetting
(SQUARE, MITER).
2019-12-03 15:43:59 +02:00
Rémi Verschelde
c3609eb211
Merge pull request #34072 from arlez80/master
fixed pitch bend value and MIDI running status on the InputEventMIDI.
2019-12-03 09:45:19 +01:00
あるる / きのもと 結衣
e8410c03f5 fixed set pitch bend value and implemented midi running status 2019-12-03 16:22:02 +09:00
Rémi Verschelde
10bae7c05b
Merge pull request #33857 from nekomatata/polygon-2d-antialiasing
Fixed antialiased option for Polygon2D
2019-12-03 07:51:16 +01:00
Fabio Alessandrelli
6f38aeef52
Merge pull request #33640 from mewin/http_head_request
Fix HTTP HEAD requests
2019-12-01 05:50:33 +01:00
PouleyKetchoupp
e6ebc43d72 Fixed antialiased option for Polygon2D / Line2D
Polygon2D:
The property wasn't used anymore after switching from canvas_item_add_polygon() to canvas_item_add_triangle_array() for drawing.

Line2D:
Added the same property as for Polygon2D & fixed smooth line drawing to use indices correctly.

Fixes #26823
2019-11-28 22:57:27 +01:00
Hugo Locurcio
21a3923410
Add an OS.is_window_focused() getter
This makes it possible to know whether the window is focused
at a given time, without having to track the focus state manually
using `NOTIFICATION_WM_FOCUS_IN` and `NOTIFICATION_WM_FOCUS_OUT`.

This partially addresses #33928.
2019-11-28 16:42:51 +01:00
Patrick Wuttke
2cd68a2566 do not wait for response body when making a HEAD request 2019-11-26 14:17:34 +01:00
Emmanuel Leblond
a1f1a1d798
Revert "Fix localise_path method so that uncached scripts don't sometimes get loaded with two backslashes"
This reverts commit 1342551664.
2019-11-26 13:42:18 +01:00
Rémi Verschelde
967cc2c014
Merge pull request #33862 from Faless/net/http_request_chunk_size
Add download_chunk_size property to HTTPRequest.
2019-11-25 14:29:59 +01:00
Fabio Alessandrelli
ed19b4076e Add download_chunk_size property to HTTPRequest.
This allows setting the `read_chunk_size` of the internal HTTPClient.
This is important to reduce the allocation overhead and number of file
writes when downloading large files, allowing for better download speed.
2019-11-24 19:32:20 +01:00
Fabio Alessandrelli
9b2073aa97
Merge pull request #33652 from Black-Cat/http-client-fix
Fix HTTPClient::poll crash when connection set to null
2019-11-23 10:15:45 +01:00
Artem Burjachenko
b73073ae36 Fix HTTPClient::poll crash when connection set to null 2019-11-23 11:06:14 +04:00
Rémi Verschelde
083d088de3
Merge pull request #33583 from qarmin/fix_overflows_unitialized
Fix some overflows and unitialized variables
2019-11-20 21:31:12 +01:00
Rafał Mikrut
99d8626f4a Fix some overflows and unitialized variables 2019-11-20 16:22:16 +01:00
stoofin
8abd64dcbb
Fixed bug caused by a copy/paste error in Face3::get_closest_point_to
s * edge0 = -d / a * edge0 = -edge0⋅v0 / (edge0⋅edge0) * edge0 = vector projection of -v0 onto edge0

By incorrectly using -e/c instead of -d/a, Face3::get_closest_point_to was returning the wrong point in certain cases.  Specifically, I noticed it returning vertex[0] when it should have been returning vertex[1].
2019-11-19 22:30:28 -08:00
Fabio Alessandrelli
0d7409adfb Fix explain message not being stripped in release.
Messages coming from ERR_EXPLAIN / ERR_*_MSG macros used to strip the
error explanation in release builds and was changed in a recent
refactoring.

This commit restores the old behaviour (fixing release builds).
2019-11-13 14:21:32 +01:00
Rémi Verschelde
6b1628f9fc
Merge pull request #33517 from madmiraal/fix-_MSG-macros
Send *_MSG macros' explanations directly to the _err_print_error().
2019-11-11 13:27:51 +01:00
Marcel Admiraal
83069a3c0f Remove ERR_EXPLAIN macros and the scaffolding they needed. 2019-11-11 10:57:00 +01:00
Marcel Admiraal
d18b2e599d Remove all uses of ERR_EXPLAIN macros. 2019-11-11 10:24:04 +01:00
Marcel Admiraal
b7fdac60f1 Send m_msg directly to _err_print_error(). 2019-11-10 08:03:54 +01:00
Hugo Locurcio
e6d53ba75f
Expose the OS.low_processor_usage_mode_sleep_usec property
This makes it possible to change it at runtime in projects.
2019-11-08 18:53:25 +01:00
Rémi Verschelde
9d4e596c69 doc: Sync classref with current source
Fix incomplete binding.
2019-11-08 16:00:01 +01:00
Rémi Verschelde
0e54b2d43c
Merge pull request #33445 from kawa-yoiko/astar-soft-error
Emit an error rather than crash in A*
2019-11-08 14:18:26 +01:00
bruvzg
5d6ff7f2a2
Fix MinGW/clang/LLD/UCRT build. 2019-11-08 15:04:35 +02:00
Shiqing
aac7ddf89f Emit an error rather than crash in A* 2019-11-08 20:32:50 +08:00
Rémi Verschelde
621dc7022f
Merge pull request #27742 from rxlecky/camera-replication
Game camera override
2019-11-08 10:02:18 +01:00
Rémi Verschelde
31f327a4a9
Merge pull request #33052 from KoBeWi/naughty_sliders
Fix analog input in sliders
2019-11-08 09:55:11 +01:00
Rémi Verschelde
665ee70edb
Merge pull request #33376 from jamie-pate/master
Fix #24137 Different number of leading zeros on MINGW printf("%lg")
2019-11-08 09:42:17 +01:00
Jamie Pate
bdb7adecfb Fix #24137 Different number of leading zeros on MINGW printf("%lg")
Use _set_output_format() on MINGW platform to force _snprintf_s() to
conform to the C99 standard and match the other platforms.

Fixes #24137
2019-11-07 16:23:35 -08:00
Tomasz Chabora
a7b202ef18 Fix analog input in sliders 2019-11-07 16:39:14 +01:00
Rémi Verschelde
77816fea8b
Merge pull request #32477 from aaronfranke/equal-approx-separate
Make is_equal_approx separate and make == exact again
2019-11-07 14:54:15 +01:00
Rémi Verschelde
ed373a60b1
Merge pull request #30556 from kawa-yoiko/astar-directed
Improve support for directed graphs in A*; docs update included
2019-11-07 12:33:27 +01:00
Rémi Verschelde
99beb9afe6
Merge pull request #33380 from SaracenOne/localise_path_fix
Fix localise_path method
2019-11-06 22:33:13 +01:00
Marcel Admiraal
24469d9ce4 Remove implicit dependency on String from error_macros.h. 2019-11-06 10:29:53 +01:00
Saracen
1342551664 Fix localise_path method so that uncached scripts don't sometimes get loaded with two backslashes 2019-11-06 03:32:02 +00:00
Rémi Verschelde
68dc6c6c62
Merge pull request #33254 from SneakyFish5/update-zstd
Update zstd to 1.4.3
2019-11-03 18:07:34 +01:00
unknown
61ad365fc9 Update zstd to 1.4.3 2019-11-03 10:37:48 -06:00
Rémi Verschelde
af4fd9de9c
Merge pull request #33238 from qarmin/other_fixes
Fix some crashes, overflows and using variables without  values
2019-11-01 22:12:47 +01:00
Rafał Mikrut
9ddb3265e1 Fix some crashes, overflows and using variables without values 2019-11-01 16:16:31 +01:00
George Marques
5d5df05ee1
Merge pull request #32643 from mewin/add_global_class
Check for cyclic inheritance when adding a global script class
2019-11-01 11:45:53 -03:00
Rémi Verschelde
962fc725c0
Merge pull request #33210 from nekomatata/pool-array-empty
Added empty() function to pool array types
2019-11-01 14:04:16 +01:00
PouleyKetchoupp
475115c0c3 Added empty() function to pool array types 2019-10-31 16:27:32 +01:00
Aaron Franke
8754e21f48
Fix "seperate" typos 2019-10-31 08:52:26 -04:00
Andrii Doroshenko (Xrayez)
56925b9c28 Provide and print error messages for JSON parsing
Core is not touched, only for binding and scripting.
2019-10-31 13:15:44 +02:00