Commit graph

3247 commits

Author SHA1 Message Date
Rémi Verschelde
19ff78c528
Merge pull request #45530 from lawnjelly/bvh_pair_aabb_fix
BVH fix pairing AABB init and mask checks
2021-01-29 15:44:49 +01:00
Aaron Franke
226528097e
[3.2] Backport hex_to_int/bin_to_int zero check and C# changes 2021-01-28 09:24:44 -05:00
lawnjelly
df18f72384 BVH fix pairing AABB init and mask checks
Fix bug whereby AABBs were reused from previous items due to use of a pool, resulting in missed collisions.
Also use full mask collision checks for all cases except generic update.
2021-01-28 14:01:03 +00:00
lawnjelly
ba5e4d8baa BVH fix stale changed items, causing dangling pairs
In the octree collisions are flushed as objects are moved, whereas in the BVH they are usually flushed once per frame.

This was causing problems in the render tree in some rare situations where objects were being created (perhaps deleted and recreated using the same handle in the same frame). This PR flushes the collisions before creating objects, and set_pairable.

set_pairable may not be necessary but it is done for safety until proven not necessary.

Also a small potential for a bug is closed in remove_unordered use.
2021-01-27 16:14:32 +00:00
Hugo Locurcio
eb0ca31ac1
Add an OS.get_thread_caller_id() method
This can be used to print thread IDs in logs. This can make it easier
to debug multi-threaded applications.

Co-authored-by: Khaos <khaos@khaos-coders.org>
(cherry picked from commit 35b046ddf7)
2021-01-26 22:10:30 +01:00
Vedat Günel
39cf22a9c7
Fix String.ends_with() for empty string arguments
(cherry picked from commit 1d0437c95b)
2021-01-26 17:00:17 +01:00
Rémi Verschelde
6d5daac3e4
Merge pull request #45312 from qarmin/remove_thread_lightmapper
Remove thread after use to prevent memory leak
2021-01-20 10:43:03 +01:00
Rafał Mikrut
d025194602 Remove thread after use to prevent memory leak 2021-01-20 09:37:25 +01:00
lawnjelly
4954a869bb BVH render tree new updating scheme
Change render BVH update scheme from once per update_dirty_instances to a new update_scenarios function called once per draw.

Fix lights not being properly unpaired.
Fixed bug in add_changed_item where AABBs were not being updated due to more than one update per tick.
2021-01-19 14:24:32 +00:00
lawnjelly
a241aeb289 Fix BVH set_pairable and masks.
Calling set_pairable now will update collisions (rather than waiting for the next item_move).

Mask behaviour used for pairing now (hopefully) matches octree.
2021-01-17 15:00:49 +00:00
Andrii Doroshenko (Xrayez)
b124c0c466
Expose Resource.emit_changed() to script
Also known as `emit_signal("changed")`.

(cherry picked from commit e94f46dcdb)
2021-01-15 16:49:46 +01:00
JFonS
7d7d7ef16d CPU lightmapper formatting and minor fixes. 2021-01-14 18:08:33 +01:00
JFonS
112b416056 Implement new CPU lightmapper
Completely re-write the lightmap generation code:
- Follow the general lightmapper code structure from 4.0.
- Use proper path tracing to compute the global illumination.
- Use atlassing to merge all lightmaps into a single texture (done by @RandomShaper)
- Use OpenImageDenoiser to improve the generated lightmaps.
- Take into account alpha transparency in material textures.
- Allow baking environment lighting.
- Add bicubic lightmap filtering.

There is some minor compatibility breakage in some properties and methods
in BakedLightmap, but lightmaps generated in previous engine versions
should work fine out of the box.

The scene importer has been changed to generate `.unwrap_cache` files
next to the imported scene files. These files *SHOULD* be added to any
version control system as they guarantee there won't be differences when
re-importing the scene from other OSes or engine versions.

This work started as a Google Summer of Code project; Was later funded by IMVU for a good amount of progress;
Was then finished and polished by me on my free time.

Co-authored-by: Pedro J. Estébanez <pedrojrulez@gmail.com>
2021-01-14 18:05:56 +01:00
lawnjelly
7b33050b3d BVH - fix physics expecting plus one based IDs.
Godot physics relies on ID zero being invalid, whereas BVH 0 is a valid ID.
2021-01-14 13:26:44 +00:00
Rémi Verschelde
b9c5e2f9eb
doc: Sync classref with current source
And fix copyright headers in new code.
2021-01-13 16:55:27 +01:00
Rémi Verschelde
49646383f1
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Rémi Verschelde
188609e5ab
CI: Update to clang-format 11 and apply ternary operator changes
(cherry picked from commit af878716f2)
2021-01-13 16:14:35 +01:00
lawnjelly
690e07b509 Dynamic BVH for rendering and godot physics
Complete rewrite of spatial partitioning using a bounding volume hierarchy rather than octree.

Switchable in project settings between using octree or BVH for rendering and physics.
2021-01-12 12:12:10 +00:00
Andrii Doroshenko (Xrayez)
47899e67c5 Add ability to restore RandomNumberGenerator state
3.2 version of b5107715f1.

`get_seed()` still returns the previous state and not the initial seed,
because users may rely on this behavior for resetting the state in 3.2.
Documented this is going to be fixed in 4.0.

Co-authored-by: MidZik <matt.idzik1@gmail.com>
2021-01-08 15:02:02 +02:00
Rémi Verschelde
d6fecf7686
Main: Create user data dir in setup()
Custom backport of #39563 with preliminary change to make
`OS::ensure_user_data_dir()` public as done in f8a79a9.

Fixes #32488.
2021-01-08 10:24:48 +01:00
Mai Lavelle
43910510e0
Fix xform_inv of Plane, intermediate results were ignored
(cherry picked from commit 4cb070e590)
2021-01-05 21:33:33 +01:00
Rémi Verschelde
66bfe855a8
Revert "Add a project setting to enable stdout flushing in release builds"
This reverts commit 341b9cf15a.

This makes the logger crash when used during cleanup: #44850.
2021-01-05 21:33:33 +01:00
Joshua Dahl
0239337475
Remove Unnecessary Double List
_OS::print_resources_by_type had two of the exact same list, one of which was never used.

(cherry picked from commit 453ef0ba89)
2021-01-05 21:33:32 +01:00
Maganty Rushyendra
bc564cd661
Issue more precise error when disconnecting a nonexistent connection
Checks whether the signal exists when issuing an error message when
disconnecting a nonexistent connection. Also prints the callable name.

(cherry picked from commit 6c026a6814)
2021-01-05 21:33:28 +01:00
Rémi Verschelde
3032b38b52
Merge pull request #44690 from lawnjelly/transform_snap2
[3.2] Improve 2d snapping
2021-01-05 17:19:44 +01:00
Andy Savage
d097c0213c
Quick fix to incorrect error messages when writing to compressed or encrypted files.
(cherry picked from commit c65f097ebd)
2020-12-29 16:02:00 +01:00
Hugo Locurcio
f5f04a10f5
Add a project setting to enable stdout flushing in release builds
This can be used in server builds for journalctl compatibility.

(cherry picked from commit 341b9cf15a)
2020-12-29 16:02:00 +01:00
Alf Kraus
70fc0d45f7
wrong double quote output with .csv fixed
(cherry picked from commit 68fdd753a7)
2020-12-29 15:12:10 +01:00
Andrii Doroshenko (Xrayez)
e95c24d783
Make property_list_changed_notify protected in Object
Alternative to `_change_notify()` to be called from within C++ classes.

Achieves low-level consistency with scripting, where this method is
exposed for updating the editor (inspector) with new values.

(cherry picked from commit 9aa06c3e65)
2020-12-29 13:52:13 +01:00
lawnjelly
a237c671bb Improve 2d snapping
Partially revert change allowing sprite get_rect snapping to be controlled by `pixel_snap` again rather than `transform_snap` (to prevent breaking compatibility). Adds a final `use_camera_snap` project setting to allow snapping viewports as in reduz original PR.
2020-12-25 18:53:00 +00:00
Fredia Huya-Kouadio
94aa09a854 Fix the String::get_base_dir() logic to properly check for top level directories on Windows. 2020-12-23 00:43:03 -08:00
Rémi Verschelde
9c3293b844
Merge pull request #44306 from Demindiro/fix-conv-to-32bit-float
Fix Variant conversion to float instead of double
2020-12-21 01:36:18 +01:00
Theogen Ratkin
8f6a6ac8d0 Add interpolation parameter to resize_to_po2()
Image::resize_to_po2() now takes an optional p_interpolation parameter
that it passes directly to resize() with default value INTERPOLATE_BILINEAR.

GLES2: call resize_to_po2() with interpolate argument

Call resize_to_po2() in GLES2 rasterizer storage with either
INTERPOLATE_BILINEAR or INTERPOLATE_NEAREST depending on TEXTURE_FLAG_FILTER.

This avoids filtering issues with non power of two pixel art textures.
See #44379
2020-12-18 14:02:38 -04:00
Pedro J. Estébanez
4dafa5b21e Fix crash parsing a serialized Reference 2020-12-17 12:24:55 +01:00
Marcel Admiraal
e21adf2bc6 Don't handle BaseException in build scripts 2020-12-12 10:10:23 +00:00
David Hoppenbrouwers
708336531c
Fix Variant conversion to float instead of double
Closes #44303
2020-12-11 23:19:30 +01:00
Fabio Alessandrelli
f73c9e555f
Remove now unused FileAccessBuffered.
(cherry picked from commit 781efc26e0)
2020-12-09 11:36:58 +01:00
Hugo Locurcio
8542d6ecd5
Tweak log file names for consistency between Mono and non-Mono logs
- Avoid spaces in Mono log file names.
- Use a `.log` extension for Mono logs, just like non-Mono logs.
- Use periods to separate hours/minutes/seconds for non-Mono logs.

(cherry picked from commit 4d81776fc9)
2020-12-09 11:22:05 +01:00
bruvzg
cc86b11858
Fix .pck lookup for extensionless binary in macOS resources.
(cherry picked from commit 7be8759991)
2020-12-02 16:08:29 +01:00
Jummit
deda90bad7
add root_node as property of MultiplayerAPI
(cherry picked from commit d4c4d2db4c)
2020-12-01 09:00:54 +01:00
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