Commit graph

3257 commits

Author SHA1 Message Date
Fabio Alessandrelli f6cca77d8f
Disable SO_REUSEADDR for UDP.
It allows binding multiple sockets to the same ADDR:PORT (unlike TCP,
which still requires different ADDR:PORT combinations).

(cherry picked from commit 4b6a35c74a)
2020-12-01 09:00:52 +01:00
Rémi Verschelde 94c31175de
Merge pull request #43152 from Chaosus/color_autocompletion_3.2
[3.2] Shows ColorRect in Color constants autocompletion
2020-11-26 09:32:32 +01:00
Pedro J. Estébanez 8ec5ffe17e Make warning about Reference singletons more accurate 2020-11-23 10:42:50 +01:00
Pedro J. Estébanez 9df6edc7d7
Warn about singleton being a Reference
(cherry picked from commit e1150bd912)
2020-11-19 17:15:28 +01:00
Pedro J. Estébanez ebdcf1cc60
Fix crash duplicating local-to-scene resources
(cherry picked from commit e99cf6bfe5)
2020-11-19 17:15:27 +01:00
Pedro J. Estébanez 58e9bf494d
Fix crash in resoure duplicate
(cherry picked from commit 9450717571)
2020-11-17 12:07:02 +01:00
Hugo Locurcio 3a46e01af3
Remove property groups for Pause Mode and Script
Each of those only grouped 1 property, making them useless.

This closes https://github.com/godotengine/godot-proposals/issues/1840.

(cherry picked from commit 5770e08c2a)
2020-11-17 12:07:02 +01:00
Haoyu Qiu 8361caad86
Allows HTTPClient to talk to proxy server
* Makes request uri accept absolute URL and authority
* Adds Host header only when missing

(cherry picked from commit d92ca6fbb1)
2020-11-17 12:07:01 +01:00
Tomasz Chabora 00c631b13c
Release pressed action if event is removed
(cherry picked from commit b7c612bd54)
2020-11-17 12:07:00 +01:00
Rémi Verschelde 4d667dadb9
Merge pull request #43554 from lawnjelly/refactor_pixel_snap
Add 2d snap transforms option
2020-11-16 18:24:10 +01:00
Rémi Verschelde aeb3557f94
Merge pull request #43539 from zaevi/3.2_fix_loader_saver_broken
[3.2] Fix custom loader/savers broken
2020-11-15 15:43:03 +01:00
lawnjelly a79293e0fc Add 2d snap transforms option
This is a cut back backport of reduz snapping PR #43194.

It just offers a global project setting for transform snapping.
2020-11-15 09:40:07 +00:00
Zae 171768ab7c fix custom loader/saver broken 2020-11-14 23:30:57 +08:00
Mark Riedesel 92ff6c5164 Implement OS.get_screen_orientation() for Android 2020-11-13 10:14:06 -05:00
Tomasz Chabora 98774000e2
Add append_array() method to Array class
(cherry picked from commit 9f23a94b8a)
2020-11-11 15:44:14 +01:00
Aaron Franke 1bb81488bb
Minor clamp and float fixes
(cherry picked from commit ee79fc627c)
2020-11-11 15:30:57 +01:00
Rémi Verschelde 2652f6fc69
doc: Override default value for RandomNumberGenerator.seed
It's non-deterministic so it's better to show a fixed value like 0 instead of
having it potentially change whenever `randomize()` is called.

Fixes #43317.

(cherry picked from commit 35e6070a35)
2020-11-11 15:30:56 +01:00
Hugo Locurcio 7db872b55a
Add Image.load_bmp_from_buffer() for run-time BMP image loading
This partially addresses
https://github.com/godotengine/godot-proposals/issues/676.

(cherry picked from commit 0209e3790e)
2020-11-11 15:30:55 +01:00
Hugo Locurcio 2c6b3074fc
Increase the default HTTPClient download chunk size to 64 KiB
This improves download speeds at the cost of increased memory usage.

This change also effects HTTPRequest automatically.

See #32807 and #33862.

(cherry picked from commit 13357095ee)
2020-11-11 15:30:55 +01:00
Rémi Verschelde 1dd2cf7914
Merge pull request #40747 from RandomShaper/improve_packed_fs_api_3.2
Improve/fix packed data API (3.2)
2020-11-10 10:59:59 +01:00
Rémi Verschelde f7d99c9a1f
Merge pull request #43259 from lyuma/get_parent_class_reentrancy_3.2
3.2: Backport Avoid reentrant OBJTYPE_RLOCK in ClassDB
2020-11-01 12:56:56 +01:00
Lyuma d3be8477f0 Avoid reentrant OBJTYPE_RLOCK in ClassDB
Fixes #43020 when a thread uses ClassDB while main thread calls is_parent_class().
2020-11-01 00:50:46 -07:00
Pedro J. Estébanez 1e9a774ac2 Make Variant aware that an Object may be a Reference 2020-10-29 21:04:57 +01:00
Andrii Doroshenko (Xrayez) 943db2ca34
Make randbase member protected in RandomNumberGenerator
Allows to extend `RandomNumberGenerator` via C++ modules.

(cherry picked from commit 1923f0d302)
2020-10-28 14:05:42 +01:00
Tomasz Chabora c2a7df79ce
Favor project.binary over project.godot
(cherry picked from commit 37d515e99c)
2020-10-28 14:05:40 +01:00
Yuri Roubinsky 374253242d [3.2] Shows ColorRect in Color constants autocompletion 2020-10-28 12:39:41 +03:00
Rémi Verschelde 438e4f1e1a
Merge pull request #42981 from lyuma/command_queue_fix_3.2
[3.2] Backport Command queue fix
2020-10-22 09:55:49 +02:00
Lyuma f994666bbe core/command_queue_mt: Fix crash/hang when buffer fills up
This patch fixes two related issues. One is the race condition in issue #42107..
The other is a crash which happens when the reader is lapped near the end of the buffer.

Backport of 48e8da4 to 3.2
2020-10-21 16:39:54 -07:00
Lyuma 074a098df6 core/command_queue_mt: Customizable size
Partial backport of 9f654b4 to 3.2
2020-10-21 16:39:52 -07:00
Rémi Verschelde 04fb41a0f3
Merge pull request #42531 from BastiaanOlij/add_get_native_handle
Add get native handle
2020-10-20 13:27:07 +02:00
Bastiaan Olij 1ea7358405 Add get_native_handle to OS 2020-10-20 20:23:37 +11:00
Haoyu Qiu 9119560d4d
Fixes HTTPClient::poll crash after connection is self-assigned
(cherry picked from commit 8226cee8d8)
2020-10-19 16:10:00 +02:00
Tomasz Chabora 11cbe99ccc
Cancel rename if file does not exist
(cherry picked from commit bb2684f4a7)
2020-10-19 16:09:58 +02:00
Maganty Rushyendra a46fd28ae3
Fix natural sort comparison for strings with large numbers
Fix errors when comparing strings with large numbers (> INT64_MAX).
Comparisons now occur by comparing individual digits, instead of
converting to int64_t first.

(cherry picked from commit de46c92711)
2020-10-19 15:12:11 +02:00
Aaron Franke b2897f1f7b
Check for global script class information before clearing it
(cherry picked from commit 1ca501d7d4)
2020-10-05 22:09:49 +02:00
Rémi Verschelde 6c03ac6625
Improve format version mismatch error in binary loader
(cherry picked from commit e35bb04c53)
2020-10-05 20:32:31 +02:00
Aaron Franke fcaf17824f
Don't write global script class information if there is none
(cherry picked from commit 3163611f0c)
2020-10-04 20:53:50 +02:00
Serhat 09a8dd7b3b
Fixed padding bug of sprintf function
(cherry picked from commit 9f2cdfea82)
2020-10-04 20:51:58 +02:00
Wilson E. Alvarez 5766547e33
Make "function" a property of FuncRef
(cherry picked from commit b4e7edabf3)
2020-10-01 16:00:47 +02:00
Wilson E. Alvarez eb78d4e883
Allow retrieval of FuncRef function string
(cherry picked from commit 75154e64a9)
2020-10-01 16:00:46 +02:00
Rémi Verschelde 4ad74609ce
Merge pull request #40205 from bruvzg/click-through-3
[3.2] Add mouse event pass-through support for window.
2020-10-01 13:58:24 +02:00
Rémi Verschelde df2dcf5742
Merge pull request #41866 from RandomShaper/fix_41179
Disable decayment of freed Objects to null in debug builds
2020-10-01 13:43:08 +02:00
Rémi Verschelde 66cbcc1b7e
Merge pull request #41123 from lawnjelly/octree_fix
Optimize octree and fix leak
2020-09-30 23:11:31 +02:00
Rémi Verschelde 904773149d
Merge pull request #42341 from nekomatata/x11-events-thread-3.2
[3.2] Fix issues related to delay when processing events on Linux
2020-09-30 16:39:55 +02:00
Tomasz Chabora b3a23b2efb
Remove unnecessary empty line from Dictionaries
(cherry picked from commit 7b1ad6fbe0)
2020-09-29 13:57:56 +02:00
Rémi Verschelde a99879ba6c
MessageQueue: Change default queue size to 4096 KB
1024 KB was low enough that many users seem to hit it, which can lead to the
editor freezing.

The proper fixed as described in #35653 would be to implement a page allocator
to prevent this overflow, but as a stop-gap measure, we can increase the
default value to a more lenient 4096 KB which should be high enough for the
vast majority of use cases.

The default size can be brought down again if/when #35653 is properly fixed,
and if it's actually relevant from a memory point of view.

(cherry picked from commit 5009ba54b2)
2020-09-29 08:54:39 +02:00
PouleyKetchoupp f725d9cb73 Fix issues related to delay when processing events on Linux
3.2 backport of PR #41910:
Fix general keyboard input lag on X11 display server
Fix delay to process clipboard content from Godot in other programs
2020-09-26 15:32:40 +02:00
Rémi Verschelde 64b0f5db40
zstd: Update to upstream version 1.4.5
(cherry picked from commit 914591c9ae)
2020-09-24 14:43:11 +02:00
Andrii Doroshenko (Xrayez) 2bfb83c702
Make Object::to_string virtual
Allows to override printing via C++, not only via script.

(cherry picked from commit cfead57d1d)
2020-09-24 14:43:10 +02:00
Yilin Ma d571de5f81
added load resource pack with offset feature
(cherry picked from commit c524d50444)
2020-09-24 14:43:09 +02:00
Aaron Franke 1dcbcaaa0d
Change inequality comparison operators to use exact equality
(cherry picked from commit d0a1399a1b)
2020-09-24 14:43:08 +02:00
Tomasz Chabora 13d7404cd7
Check for null in InputMap::_find_event
(cherry picked from commit f4e34ac353)
2020-09-24 14:43:08 +02:00
Hugo Locurcio e04855ce00
Fix crash when opening a ZIP data pack
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
(cherry picked from commit 0b65342fd2)
2020-09-24 14:43:07 +02:00
Andrii Doroshenko (Xrayez) 1f42a8a073
Fix List swap behavior on front, back and adjacent elements
- immediately return if A == B;
- first and last elements (front, back) are updated upon relinking;
- handles a special case of forward and backward adjacent elements.

(cherry picked from commit ac69f092fc)
2020-09-24 14:43:07 +02:00
Marcel Admiraal 564d7101b4
Add missing reference to const T Vector::get().
(cherry picked from commit 4feba93630)
2020-09-24 14:43:06 +02:00
Rémi Verschelde c8859f0463
Fix typos with codespell
Using codespell 1.17.1.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2020-09-18 14:09:51 +02:00
Rémi Verschelde cb78a5d7ae
Linux/BSD: Fix support for NetBSD
Add __NetBSD__ to `platform_config.h` so that it can find `alloca`
and use the proper `pthread_setname_np` format.

Rename RANDOM_MAX to avoid conflict with NetBSD stdlib.

Fixes #42145.

(cherry picked from commit 5f4d64f4f3)
2020-09-18 10:29:52 +02:00
bruvzg e51fed9d1b
[3.2] Add window click-through support. 2020-09-17 12:36:01 +03:00
Pedro J. Estébanez ddd869135b Disable decayment of freed objects to null in debug builds 2020-09-08 19:47:39 +02:00
Marcel Admiraal 3697cc479d
Initialise Basis elements with a default Basis in the declaration.
Ensures a valid Basis is created with all constructors.

(cherry picked from commit 9149fb760c)
2020-09-08 15:04:54 +02:00
Marcel Admiraal c6cccdf0c6 Ensure header guards enclose entire header.
(cherry picked from commit f6ad1954f7)
2020-09-04 08:48:35 +02:00
Hugo Locurcio ee97e45a69 Improve the resource loading error message to mention the need to import
This is a common pitfall when setting up projects in a headless
environment.

(cherry picked from commit 58ed3037c0)
2020-09-04 08:48:17 +02:00
Yakov Borevich 63b2f69c7f
[funexpected] clear missed remaps on deinitialization, fixes godotengine/godot#34221
(cherry picked from commit 604bd75438)
2020-08-31 15:29:46 +02:00
Rémi Verschelde 5a96c24243
Revert "Check if global class file still exists before registering it"
And revert follow-up regression fix "Remap script path when registering class."

After the regression fix, the original issue is valid again so it's better
to go back to the previous state.

This reverts commits e264ae20d2 and
fceb64827e.

(cherry picked from commit f13207254c)
2020-08-25 14:33:46 +02:00
Rémi Verschelde 42dca43c50
Merge pull request #41029 from masi456/fix/40888
Make sure that Image is not locked before creation
2020-08-21 02:27:22 +02:00
lawnjelly 667c970b77 Optimize octree and fix octree leak
Prevents adding new octants until a limiting number of elements have been added to the current octant. This enables balancing the benefits of brute force against the benefits of spatial partitioning. The limit can be set per octree.

Project settings are added for rendering octree to set the best balance per project depending on number of tests per frame / tick, and the amount of editing of the octree.

Fixes octants being leaked when removing elements.

Optimize octree with cached linear lists

Storing elements in octants using linked lists is efficient for housekeeping but very slow for testing. This optimization stores additional local_vectors with Element pointers and AABBs which are cached and only updated when a dirty flag is set on the octant.

This is selectable with 2 versions of Octree : Octree and Octree_CL, Octree being the old behaviour. At present the cached list version is only used for the visual server octree (rendering) as it has only been demonstrated to be faster there so far.

This uses slightly more memory (probably a few kb in most cases) but can be significantly faster during testing (culling etc).

Co-authored-by: Sergey Minakov <naithar@icloud.com>
2020-08-18 11:02:21 +01:00
Rémi Verschelde e283d4b5c8 Update AUTHORS and DONORS list
New contributors added to AUTHORS:
@hinlopen, @naithar, @rrcore, @SkyLucilfer, @TwistedTwigleg

Thanks to all contributors and donors for making Godot possible!

---

Also changes to relevant code that parses the DONORS.md to match
the new tiers.

(cherry picked from commit d2d4c1c957)
2020-08-14 00:32:05 +02:00
Fabio Alessandrelli a97b84378c Remap script path when registering class.
Was causing `class_name`-defined scripts to not being loaded in exported
games due to the remap from `*.gd` to `*.gdc`/`*.gde`.

(cherry picked from commit fceb64827e)
2020-08-14 00:32:04 +02:00
bruvzg 8dab067c01
Add missing NULL termination to the String::repeat function. 2020-08-11 17:23:44 +03:00
Marcel Schneider c62ce03679 Make sure that a new image can only be created when the buffer is not currently locked 2020-08-05 20:55:31 +02:00
Wilson E. Alvarez 4f9ca00294 Check if global class file still exists before registering it
(cherry picked from commit e264ae20d2)
2020-07-29 18:23:03 +02:00
Nathan Franke b9e1db7e03
Revert "Fix Directory Open Check"
This reverts commit 3f898f5207.
2020-07-28 13:54:13 -04:00
Nathan Franke 9de0439a45
Revert "Follow-Up Fix Directory Open"
This reverts commit ec787f0134.
2020-07-28 13:53:57 -04:00
Nathan Franke 4c100a593f
Revert "Fix Directory make_dir and make_dir_recursive"
This reverts commit 9b36357544.
2020-07-28 13:53:30 -04:00
Wilson E. Alvarez 993a421333 Show errors on Object.call_deferred
(cherry picked from commit 1cd02ef600)
2020-07-28 00:40:07 +02:00
Pedro J. Estébanez fa08b0f377 Improve/fix packed data API
- Enhance directory API
- Fix `FileAccess::exists()` not checking for PackedData being disabled
- Fix moving to the parent directory (`..`)
- Allow absolute paths in existence checks
2020-07-27 11:24:00 +02:00
Rémi Verschelde a2edf04fd2
Merge pull request #40469 from nekomatata/virtual-keyboard-enter-fixes-3.2
[3.2] Fix Return key events in LineEdit & TextEdit on Android
2020-07-26 20:26:02 +02:00
Rémi Verschelde b40f3f9740 Style: Sync other changes from new fix_style.sh and clang_format.sh 2020-07-24 10:39:18 +02:00
Adam Bates b35970b9a5 issue-40396 - Added missing error strings to JSON parsing when array or object is never closed.
(cherry picked from commit 8f84dfa91d)
2020-07-24 10:31:57 +02:00
Nathan Franke 9b36357544 Fix Directory make_dir and make_dir_recursive
(cherry picked from commit 210ccb3a75)
2020-07-24 10:31:57 +02:00
Aaron Franke 3ab5183ffa
[3.2] Backport core documentation changes to 3.2
Also add AABB.abs()
2020-07-21 21:22:54 -04:00
PouleyKetchoupp c0b394572f Fix Return key events in LineEdit & TextEdit on Android
Depending on the device implementation, editor actions could be
received with different action ids or not at all for multi-line.

Added a parameter to virtual keyboards to properly handle single-line
and multi-line cases in all situations.

Single-line:
Input type set to text without multiline to make sure actions are sent.
IME options are set to DONE action to force action id consistency.

Multi-line:
Input type set to text and multiline to make sure enter triggers new lines.
Actions are disabled by the multiline flag, so '\n' characters are
handled in text changed callbacks.
2020-07-17 18:25:40 +02:00
Fabio Alessandrelli 468a1c0271 UDPServer handles PacketPeerUDP-client association
UDPServer now uses a single socket which is shared with the
PacketPeerUDP it creates and has a new `poll` function to read incoming
packets on that socket and delivers them to the appropriate peer.
PacketPeerUDP created this way never reads from the socket, but are
allowed to write on it using sendto.

This is needed because Windows (unlike Linux/BSD) does not support
packet routing when multiple sockets are bound on the same address/port.

(cherry picked from commit 147bbe2155)
2020-07-15 12:48:18 +02:00
Rémi Verschelde a06ee5e763 PO loader: Fix unclosed files and error messages
Fixes #40324.

(cherry picked from commit 47cc202972)

Also removes empty `p_path` as done in 4857648a16.
2020-07-15 12:48:18 +02:00
Andrii Doroshenko (Xrayez) 813fab55d8 Fix overriding compression related settings
(cherry picked from commit 1f73469b50)
2020-07-13 15:15:40 +02:00
Hugo Locurcio c2a4ce9380 Enable file logging by default on desktops to help with troubleshooting
- Use the `.log` file extension (recognized on Windows out of the box)
  to better hint that generated files are logs. Some editors provide
  dedicated syntax highlighting for those files.
- Use an underscore to separate the basename from the date and
  the date from the time in log filenames. This makes the filename
  easier to read.
- Keep only 5 log files by default to decrease disk usage in case
  messages are spammed.

(cherry picked from commit 20af28ec06)
2020-07-10 11:03:32 +02:00
Nathan Franke ec787f0134 Follow-Up Fix Directory Open
(cherry picked from commit 6952458538)
2020-07-10 10:21:39 +02:00
PouleyKetchoupp fe0adc4f77 Keep debug & verbose options after loading project from project manager
(cherry picked from commit b2d27214aa)
2020-07-10 08:51:21 +02:00
Nathan Franke 3f898f5207 Fix Directory Open Check
(cherry picked from commit 09aeb7706b)
2020-07-08 09:01:57 +02:00
bruvzg e9ab41b71d
[macOS, 3.2] Implement seamless display scaling. 2020-07-07 22:54:33 +03:00
Rémi Verschelde 07b24de868
Merge pull request #38724 from madmiraal/fix-8368-3.2
[3.2] Support SDL2 half axes and inverted axes mappings.
2020-07-06 23:10:47 +02:00
Maganty Rushyendra 7670e1fc79 Fix errors in overflow checks for String conversion to int
Current error checks for to_int and to_int64 do not issue overflow error
messages for INT64_MAX + 1, INT64_MAX + 2, and others close to the
limits. Likewise, error checks for hex_to_int, hex_to_int64 and bin_to_int64
issue false positive error messages for INT64_MIN or INT32_MIN. This commit
fixes these error checks.
2020-07-06 08:44:18 +08:00
Rémi Verschelde 8e6dd3191f Image: Improve error messages for invalid creation size
(cherry picked from commit b5488def47)
2020-07-03 15:34:30 +02:00
Paul Herman 850f07a4d9 Expose loading TGA images in Image.
(cherry picked from commit 7d4b3e6587)
2020-07-03 13:17:57 +02:00
Marcel Admiraal 50d69a5a3d Call CRASH_COND_MSG if key not found in HashMap get function.
(cherry picked from commit 1b05f449f0)
2020-07-03 13:17:57 +02:00
Fabio Alessandrelli dc8b7b3b17 Move frame delaying functions from Main to OS.
Will allow specific platforms to override it and avoid blocking on the
main/GUI thread.

(cherry picked from commit 1b6e3458b2)
2020-07-02 13:52:02 +02:00
Maganty Rushyendra cd3a3eb3eb Fix weekday calculation in get_datetime_from_unix_time for negative times
Fix calculation for negative times to ensure Sundays are wrapped around to '0'
instead of '7', making it consistent with the output for positive times.

(cherry picked from commit aae5f246ff)
2020-06-29 10:58:41 +02:00
Rémi Verschelde 94eaeb5e84
Merge pull request #39903 from RandomShaper/fix_object_rc_leak
Fix leaked ObjectRCs on object Variant reassignment
2020-06-28 09:53:32 +02:00
Pedro J. Estébanez b02e0b0c4b Fix debugger error when Dictionary key is a freed Object 2020-06-28 02:36:13 +02:00
Pedro J. Estébanez dca653cc3a Fix leaked ObjectRCs on object Variant reassignment
Bonus:
- Add some (un)likely magic
- Use memdelete() instead of memfree() (not strictly needed, but more correct)
2020-06-28 01:31:00 +02:00
Marcel Admiraal ebff150680 Support SDL2 half axes and inverted axes mappings. 2020-06-26 06:28:56 +01:00
Maganty Rushyendra afac2514f8 Fix upscaling image with bilinear interpolation option specified
Fix error in calculation of 4 nearest points in source image when
resizing image with bilinear interpolation.

(cherry picked from commit f24ec3878e)
2020-06-24 22:52:05 +02:00
Rémi Verschelde 571a0c60c0 Revert "Implement Skew in Node2D"
This reverts commit 7f61710183.

See #38868, in its current implementation a small skew value might end up
serialized to scene files due to floating point precision errors, which is
detrimental to VCS.

This can be cherry-picked anew once a fix for #38868 has been found.
2020-06-22 10:26:06 +02:00
Sergey Minakov af1788baf3 Variant: Fix potential crash when stringifying deleted Object
Fixes #38597.
2020-06-22 08:53:47 +02:00
Andy Maloney 7f18163ea6 [3.2] Ensure FileAccessBuffered structs are properly initialized 2020-06-19 11:32:53 -04:00
Aaron Franke 6e3a1074ce Simplify Transform2D get_rotation
(cherry picked from commit 0fa478a050)
2020-06-18 11:29:28 +02:00
Andrea Catania 74d10e766e - Added more euler rotation orders support.
- Fixed floating point issue on the old one.
- Fixed the equation on the get_euler_yxz function.
- Added unit tests.

This work has been kindly sponsored by IMVU.

(cherry picked from commit 2331300989)
2020-06-18 11:29:28 +02:00
bruvzg 2256946f79
[3.2] Add keyboard layout enumeration / set / get functions (macOS, Windows, Linux/X11). 2020-06-13 11:01:49 +03:00
Rémi Verschelde 362193db6a String: Use ABS macro in padding code
Follow-up to #39261.

(cherry picked from commit cbcc0eacd5)
2020-06-11 11:44:06 +02:00
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