Commit Graph

6256 Commits

Author SHA1 Message Date
Pedro J. Estébanez
ff6229e794 Support loading of translations on threads
(cherry picked from commit 5301bbb3a5)
2023-10-19 21:06:12 +02:00
Rémi Verschelde
aae20e5b10
Fix various typos with codespell
Also includes typo fixes from #79993, #80068, #80276, and #80303.

Co-authored-by: betalars <contact@betalars.de>
Co-authored-by: spaceyjase <429978+spaceyjase@users.noreply.github.com>
Co-authored-by: Swarkin <102416174+Swarkin@users.noreply.github.com>
Co-authored-by: Raul Santos <raulsntos@gmail.com>

(cherry picked from commit faaf27f284)
2023-10-03 20:45:35 +02:00
Ricardo Subtil
788ee7938b Ensure joy_connection_changed is emitted on the main thread
(cherry picked from commit 1bb73b0689)
2023-09-21 15:28:23 +02:00
Ninni Pipping
4734295fd1 Fix version check for GDExtension
(cherry picked from commit 97ef4a0536)
2023-09-21 15:14:04 +02:00
bruvzg
88afb1a8ba [String] Fix string conversion for -0.0 float values.
(cherry picked from commit 2b3bbde6da)
2023-09-21 14:57:13 +02:00
Eoin O'Neill
58ff96b8b7 Prevent double input events on gamepad when running through steam input
During GDC and general testing on Steam Deck units, we found that single
gamepads would often register inputs twice under certain circumstances.
This was caused by SteamInput creating a new virtual device, which Godot
registers as a second gamepad. This resulted in two gamepad devices
reporting the same button presses, often leading to buggy input response
on games with no multi-device logic and other-wise could cause intended
Steam rebindings to not work as intended (for example, swapping o and x
on a playstation pad if that feature isn't supported by the game.)

SDL gets around this by taking in a list of devices that are to be
ignored. When valve sees a controller that wants to be rebound via
SteamInput, they push a new VID/PID entry onto the environment
variable `SDL_GAMECONTROLLER_IGNORE_DEVICES` for the original gamepad
so that all game inputs can be read from the virtual gamepad instead.

This leverages the same logic as we are already using SDL gamepad
related HID mappings.

(cherry picked from commit 8de98dbf21)
2023-09-21 14:57:13 +02:00
A Thousand Ships
485d53133d Add check to ensure registered classes are declared
Checks that all classes registered to `ClassDB` have been properly
declared with `GDCLASS`

(cherry picked from commit c638238fae)
2023-09-21 13:50:25 +02:00
Rémi Verschelde
cdce948473 Fix GCC -Wmaybe-uninitialized warnings
(cherry picked from commit efdff9cbc2)
2023-09-20 22:44:04 +02:00
Danil Alexeev
6d5127d34b Core: Fix recursion level check for VariantWriter::write() with objects
(cherry picked from commit 5d689ad560)
2023-09-20 22:44:04 +02:00
Danil Alexeev
c57d6c9371 Core: Fix recursion level check for array stringification
(cherry picked from commit bb40bd9aaa)
2023-09-20 22:44:03 +02:00
Ninni Pipping
5641ad49e9 Fix root_node_layout_direction setting not enum
(cherry picked from commit 1cac72999b)
2023-08-31 20:19:30 +02:00
Ninni Pipping
a31b866793 Fix range error for Array.slice
(cherry picked from commit 7752a0d8d1)
2023-08-31 19:48:16 +02:00
bruvzg
9ed12c884a FreeType: Update to version 2.13.1
(cherry picked from commit 008d3de1e9)
2023-08-31 19:26:48 +02:00
Pedro J. Estébanez
b3a56228b1 Fix zero-sized WorkerThreadPool not processing group tasks
(cherry picked from commit 28d0d56a69)
2023-07-10 18:09:58 +02:00
MewPurPur
a4547db15b Fix erroneous pad_zeros warning
(cherry picked from commit cc5500f7de)
2023-07-10 17:46:09 +02:00
Ninni Pipping
fb8e21bd6d Fix rpc calls with binds
(cherry picked from commit 7d174c8dfe)
2023-07-10 17:46:09 +02:00
Angad Kambli
cdeddffee7 Check parameter validity in Object::set_script
Fixes #46120.

(cherry picked from commit 9c6c2f09e0)
2023-07-10 17:46:08 +02:00
Hugo Locurcio
ac87b5df75 Mention Xbox menu button by name in Start button description
Microsoft officially calls it the Menu button:

https://support.xbox.com/en-US/help/hardware-network/controller/get-to-know-your-xbox-series-x-s-controller
(cherry picked from commit 1621b4e2b1)
2023-07-10 17:46:08 +02:00
Haoyu Qiu
a8bfdd8bea Fix error when non-ASCII characters in resource pack path
(cherry picked from commit df5c68af99)
2023-07-10 17:11:22 +02:00
Rémi Verschelde
da1e511f11 Linux: Allow unbundling brotli to use system library
(cherry picked from commit 153c4a4c4f)
2023-07-10 17:11:22 +02:00
Daylily-Zeleen
71d5827228 Fixed the fallback logic of OS::shell_show_in_file_manager
(cherry picked from commit 9dd9818c88)
2023-07-10 17:11:21 +02:00
Rémi Verschelde
cdd2313ba2
Merge pull request #78977 from RandomShaper/workaround_tls_shutdown
Workaround resource loading crashes due to buggy TLS
2023-07-03 19:43:07 +02:00
Rémi Verschelde
03f0e5eb15
Merge pull request #78974 from RandomShaper/fix_wtp_safe_flag
Fix management of safe-for-nodes flag in ResourceLoader and WorkerThreadPool
2023-07-03 15:26:28 +02:00
Pedro J. Estébanez
41c0785636 Workaround resource loading crashes due to buggy TLS 2023-07-03 13:54:55 +02:00
Pedro J. Estébanez
30925fcfb0 Fix management of safe-for-nodes flag in ResourceLoader and WorkerThreadPool 2023-07-03 12:27:57 +02:00
Gabor Koncz
a2ede8c4da Fix GDVIRTUAL_NATIVE_PTR
This commit fixes the usage of GDExtensionPtr and GDExtensionConstPtr
in GDExtension by introducing the required VariantInternalAccessor
specializations.

Sponsored by Migeran (https://migeran.com)
2023-07-03 10:52:02 +02:00
Valery Zhuk
818cee6184 add explicit default initialization for flag in undo redo operation 2023-06-28 21:57:47 +03:00
Rémi Verschelde
de3d4e3cec
Merge pull request #78517 from AThousandShips/callable_serialize
Ensure `RID`, `Callable`, and `Signal` are stored as strings
2023-06-22 18:30:51 +02:00
Rémi Verschelde
100082b3ac
Merge pull request #74760 from lassade/unicode-err-uses-replacement-char
Don't append non unicode scalar values on the string, instead use the unicode replacement char
2023-06-22 18:30:04 +02:00
Ninni Pipping
9159208ed1 Ensure RID, Callable, and Signal are stored as strings
Prevents parser errors in `.tscn` and `.tres` files where the assignment
would otherwise be empty.
2023-06-22 17:01:08 +02:00
Yuri Sizov
b0299c9ad1
Merge pull request #76586 from rcorre/register-language-race
Fix a race condition in ScriptServer
2023-06-22 12:44:25 +02:00
Ryan Roden-Corrent
731a13a1ba
Fix race in ScriptServer.
Fixes #76581.

TSAN flagged this issue on starting the editor:

1. main calls register_core_types, which calls IP::create(), which calls Thread::start on the resolver thread
2. Thread::callback calls ScriptServer::thread_enter(), as "Scripts may need to attach a stack."
3. ScriptServer::thread_enter() accesses ScriptServer::_languages, which is still being initialized on the main thread by initialize_gdscript_module

This fixes the issue by skipping thread enter/exit notifications if languages have not finished initializing yet.
I'm assuming that notifying un-initialized languages of thread starts/stops would have been pointless anyways. If we need to somehow notify languages of threads before the languages initialize, we'll need a different solution.

```
Godot Engine v4.0.2.stable.custom_build.7a0977ce2 - https://godotengine.org
==================
WARNING: ThreadSanitizer: data race (pid=9426)
  Write of size 4 at 0x55615b187cd0 by main thread:
    #0 ScriptServer::register_language(ScriptLanguage*) /home/rcorre/src/godot/godot/core/object/script_language.cpp:177:28 (godot.linuxbsd.editor.x86_64.llvm.san+0x9e52ab9) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048)
    #1 initialize_gdscript_module(ModuleInitializationLevel) /home/rcorre/src/godot/godot/modules/gdscript/register_types.cpp:118:3 (godot.linuxbsd.editor.x86_64.llvm.san+0x36f9c6f) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048)
    #2 initialize_modules(ModuleInitializationLevel) /home/rcorre/src/godot/godot/modules/register_module_types.gen.cpp:93:2 (godot.linuxbsd.editor.x86_64.llvm.san+0x2f50499) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048)
    #3 Main::setup2(unsigned long) /home/rcorre/src/godot/godot/main/main.cpp:1961:2 (godot.linuxbsd.editor.x86_64.llvm.san+0x2f1d40d) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048)
    #4 Main::setup(char const*, int, char**, bool) /home/rcorre/src/godot/godot/main/main.cpp:1879:10 (godot.linuxbsd.editor.x86_64.llvm.san+0x2f16370) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048)
    #5 main /home/rcorre/src/godot/godot/platform/linuxbsd/godot_linuxbsd.cpp:61:14 (godot.linuxbsd.editor.x86_64.llvm.san+0x2e67e1f) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048)

  Previous read of size 4 at 0x55615b187cd0 by thread T1:
    #0 ScriptServer::thread_enter() /home/rcorre/src/godot/godot/core/object/script_language.cpp:244:22 (godot.linuxbsd.editor.x86_64.llvm.san+0x9e54aed) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048)
    #1 Thread::callback(unsigned long, Thread::Settings const&, void (*)(void*), void*) /home/rcorre/src/godot/godot/core/os/thread.cpp:61:2 (godot.linuxbsd.editor.x86_64.llvm.san+0x9464ab0) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048)
    #2 void std::__invoke_impl<void, void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*>(std::__invoke_other, void (*&&)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long&&, Thread::Settings&&, void (*&&)(void*), void*&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:61:14 (godot.linuxbsd.editor.x86_64.llvm.san+0x9465283) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048)
    #3 std::__invoke_result<void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*>::type std::__invoke<void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*>(void (*&&)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long&&, Thread::Settings&&, void (*&&)(void*), void*&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:96:14 (godot.linuxbsd.editor.x86_64.llvm.san+0x9465283)
    #4 void std:🧵:_Invoker<std::tuple<void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*>>::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:258:13 (godot.linuxbsd.editor.x86_64.llvm.san+0x9465283)
    #5 std:🧵:_Invoker<std::tuple<void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*>>::operator()() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:265:11 (godot.linuxbsd.editor.x86_64.llvm.san+0x9465283)
    #6 std:🧵:_State_impl<std:🧵:_Invoker<std::tuple<void (*)(unsigned long, Thread::Settings const&, void (*)(void*), void*), unsigned long, Thread::Settings, void (*)(void*), void*>>>::_M_run() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:210:13 (godot.linuxbsd.editor.x86_64.llvm.san+0x9465283)
    #7 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:82:18 (libstdc++.so.6+0xd72c2) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963)

  Location is global 'ScriptServer::_language_count' of size 4 at 0x55615b187cd0 (godot.linuxbsd.editor.x86_64.llvm.san+0xbf46cd0)

  Thread T1 (tid=9431, running) created by main thread at:
    #0 pthread_create <null> (godot.linuxbsd.editor.x86_64.llvm.san+0x2de5776) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048)
    #1 __gthread_create /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663:35 (libstdc++.so.6+0xd73a9) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963)
    #2 std:🧵:_M_start_thread(std::unique_ptr<std:🧵:_State, std::default_delete<std:🧵:_State>>, void (*)()) /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:147:37 (libstdc++.so.6+0xd73a9)
    #3 IP::IP() /home/rcorre/src/godot/godot/core/io/ip.cpp:347:19 (godot.linuxbsd.editor.x86_64.llvm.san+0x962cbcd) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048)
    #4 IPUnix::IPUnix() /home/rcorre/src/godot/godot/drivers/unix/ip_unix.cpp:261:9 (godot.linuxbsd.editor.x86_64.llvm.san+0x4aee599) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048)
    #5 IPUnix::_create_unix() /home/rcorre/src/godot/godot/drivers/unix/ip_unix.cpp:258:9 (godot.linuxbsd.editor.x86_64.llvm.san+0x4aee599)
    #6 IP::create() /home/rcorre/src/godot/godot/core/io/ip.cpp:339:9 (godot.linuxbsd.editor.x86_64.llvm.san+0x962ca5e) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048)
    #7 register_core_types() /home/rcorre/src/godot/godot/core/register_core_types.cpp:279:7 (godot.linuxbsd.editor.x86_64.llvm.san+0x93e2333) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048)
    #8 Main::setup(char const*, int, char**, bool) /home/rcorre/src/godot/godot/main/main.cpp:690:2 (godot.linuxbsd.editor.x86_64.llvm.san+0x2f08a49) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048)
    #9 main /home/rcorre/src/godot/godot/platform/linuxbsd/godot_linuxbsd.cpp:61:14 (godot.linuxbsd.editor.x86_64.llvm.san+0x2e67e1f) (BuildId: 780a9db7c37d88e78d5ee659c4fa1cd378abd048)

SUMMARY: ThreadSanitizer: data race /home/rcorre/src/godot/godot/core/object/script_language.cpp:177:28 in ScriptServer::register_language(ScriptLanguage*)
```

Co-authored-by: Pedro J. Estébanez <RandomShaper@users.noreply.github.com>
2023-06-21 09:52:10 -04:00
Jan Haller
9ddd3c2af6 GDExtension @since attribute
All GDExtension function pointer types are versioned using a `@since` attribute, denoting the Godot minor version in
which they were introduced. This allows bindings to query if a feature is available for a target API version, or provide
a polyfill/fallback for it. It also serves as documentation for humans giving a feeling about recency of features.
2023-06-21 12:47:48 +02:00
Yuri Sizov
329652b6fe
Merge pull request #78392 from Gallilus/master
Fix `Ref<>.is_valid()` for ScriptInstanceExtension
2023-06-20 21:19:20 +02:00
David Cambré
ceed30c442 Fix Ref<>.is_valid() for ScriptInstanceExtension
Only check the reference not the value.
2023-06-20 19:45:47 +02:00
Rémi Verschelde
248e5245e4
Merge pull request #73540 from mashumafi/fix-typed-array-add
Fix: Typed arrays aren't working with +
2023-06-20 15:12:39 +02:00
Ninni Pipping
e344bab8af Handle RID validator overflow 2023-06-20 13:20:17 +02:00
Rémi Verschelde
217a20a8a0
Merge pull request #78448 from akien-mga/black-23.3.0
CI: Update static checks to black 23.3.0
2023-06-20 00:05:39 +02:00
Rémi Verschelde
fa971b7b5e
Merge pull request #77361 from jpcerrone/fix_pck_path_inconsistencies
Fix PCK file path inconsistencies
2023-06-20 00:02:22 +02:00
Rémi Verschelde
e4deaa2727
Merge pull request #76787 from RedworkDE/avoid-localvector-copy
Avoid making unnecessary copies of `LocalVector`
2023-06-20 00:01:55 +02:00
Rémi Verschelde
c9c941e339
CI: Update static checks to black 23.3.0
And apply it to the codebase, removing empty lines at the start of blocks.
2023-06-19 23:33:02 +02:00
Rémi Verschelde
867ea7fe59
Merge pull request #74730 from MarioLiebisch/fix-74726
Fix read-only dictionaries adding missing keys
2023-06-19 21:38:38 +02:00
Rémi Verschelde
92ca08311c
Merge pull request #47996 from madmiraal/fix-17430
Fix `OS.find_scancode_from_string()` not working with modifiers
2023-06-19 15:39:06 +02:00
andybarcia
553f4f8dce
Improve error reporting when parsing CSV translation file
Fixes #46682.

Also fix unit test suite to separate generic FileAccess CSV testing
from using CSV as translation. And add more CSV translation tests.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-06-19 12:47:44 +02:00
Rémi Verschelde
914cc1d6f5
Merge pull request #78419 from Bromeon/bugfix/uninit-ptr-signature
GDExtension: `Uninitialized*Ptr` for constructors/converters using placement new
2023-06-19 10:28:31 +02:00
Rémi Verschelde
b8bf28e2b6
Merge pull request #75758 from Pylgos/fix-gdextension-variant-construction
Fix GDExtension Variant type conversion
2023-06-19 10:27:20 +02:00
Jan Haller
618507eb89 GDExtension: Uninitialized*Ptr for constructors/converters using placement new
These methods construct their destination in-place, but the parameters are not declared using the `Uninitialized*Ptr` pointer types.
2023-06-18 23:14:10 +02:00
Rémi Verschelde
127e9d65cf
Merge pull request #78368 from MatthewLJensen/delaunay-fixes
Consider all triangles for retention in Delaunay Triangulation
2023-06-18 16:33:04 +02:00
Rémi Verschelde
fc42065281
Merge pull request #76548 from komugi1211s/tilemap-ctrl-shift-edit-crash-fix
Fix crashes due to stack overflow when painting a large area in tile map
2023-06-18 16:29:23 +02:00
Rémi Verschelde
1a62f1e4fc
Merge pull request #74741 from vnen/variant-not-for-everyone
Allow boolean operators for all Variant types
2023-06-18 16:28:10 +02:00