Commit graph

3787 commits

Author SHA1 Message Date
Hugo Locurcio 76f1f9b3c5
Don't allow negative values for OS.delay_usec()/OS.delay_msec()
This closes #46190.
2021-02-18 23:01:45 +01:00
andybarcia 476df5e198 Fixes some inconsistent ISO-639 language codes
And also adds tmz (Central Atlas Tamazight) as a language
2021-02-18 22:58:43 +01:00
Rémi Verschelde 247b7e2448
Merge pull request #46131 from bruvzg/move_tablet_to_ds
Move tablet driver API from OS to DisplayServer
2021-02-18 20:36:46 +01:00
Rémi Verschelde 310496a89f
Merge pull request #45617 from RandomShaper/modernize_atomics
Modernize atomics (and fix `volatile`)
2021-02-18 19:40:31 +01:00
Pedro J. Estébanez 8e128726f0 Modernize atomics
- Based on C++11's `atomic`
- Reworked `SafeRefCount` (based on the rewrite by @hpvb)
- Replaced free atomic functions by the new `SafeNumeric<T>`
- Replaced wrong cases of `volatile bool` by the new `SafeFlag`
- Platform-specific implementations no longer needed

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2021-02-18 17:12:46 +01:00
Eric M 49714b0963 Removed hardcoded shortcuts from /scene and converted to input actions
This removes hardcoded actions from things like LineEdit and TextEdit.

Previously, things like copy, paste, etc were all hardcoded to Ctrl+C, Ctrl+V, etc. They could not be changed. This allows the possibility of them being changed, by making them use the action map. This has the added benefit of greatly simplifying the input handling logic in those controls. The logic which was previously in a huge and hard to follow switch statement has been extracted to individual methods.
2021-02-18 16:22:51 +01:00
Eric M 074f53563d Added ability to override built-in actions for the editor
This adds the ability to add overrides for built-in actions (i.e. ui_*) in the editor. Also added a number of additional built-in actions for various text-related actions, gui-generic actions (like copy and paste) and graph-related actions (duplicate nodes), etc. Moved the definition of input actions to input_map, rather than in project_settings so the editor can make use of these actions as well.
2021-02-18 16:22:50 +01:00
Eric M ca1abc7352 Added convenience create_reference methods for Key and JoyButton inputs 2021-02-18 16:22:39 +01:00
bruvzg 3e0262509f
Move tablet driver API from OS to DisplayServer. 2021-02-18 17:12:24 +02:00
reduz 64140eaf42 Reorganize Project Settings
-Advanced Settings toggle also hides advanced properties when disabled
-Simplified Advanced Bar (errors were just plain redundant)
-Reorganized rendering quality settings.
-Reorganized miscelaneous settings for clean up.
2021-02-18 11:23:34 -03:00
Aaron Franke 7d9ad2b845
Use Vector3.UP as a default value for look_at's up vector 2021-02-16 18:33:23 -05:00
JestemStefan 2c71ff1119
Added signed_angle_to for Vector3 2021-02-16 05:07:33 -05:00
Rémi Verschelde 52964fdd3f
Merge pull request #44355 from EricEzaM/PR/fix-action-false-positives-and-allow-checking-exact-matches
Allow checking for exact matches with Action events.
2021-02-15 14:52:17 +01:00
Henry Conklin c6a911f037 Add support for numeric XML entities to XMLParser
* Add support for decimal numeric entities to String::xml_unescape
* Add more error checks to String::xml_unescape
* Refactor XMLParser to use String::xml_unescape instead of an internal
implementation
2021-02-14 11:00:25 -06:00
kobewi 4db47eb32e Don't save project settings when not necessary 2021-02-13 18:51:48 +01:00
Rémi Verschelde 041cccc287
Merge pull request #44396 from Calinou/add-file-flush-method
Expose a `File.flush()` method to scripting
2021-02-13 13:40:06 +01:00
Hugo Locurcio ab397460e9
Expose a File.flush() method to scripting
This can be used to ensure a file has its contents saved
even if the project crashes or is killed by the user
(among other use cases).

See discussion in #29075.
2021-02-13 01:37:16 +01:00
reduz 5ae9051771 Add ability to change Icon Saturation
-Allows for more theme freedom
-Allows for entirely B&W themes.
2021-02-12 12:16:37 -03:00
reduz f8d03b98e7 Improve resource load cache
-Added a new method in Resource: reset_state , used for reloading the same resource from disk
-Added a new cache mode "replace" in ResourceLoader, which reuses existing loaded sub-resources but resets their data from disk (or replaces them if they chaged type)
-Because the correct sub-resource paths are always loaded now, this fixes bugs with subresource folding or subresource ordering when saving.
2021-02-11 15:44:28 -03:00
reduz 1aa2823fa3 Removed _change_notify
-For inspector refresh, the inspector now detects if a property change by polling a few times per second and then does update the control if so. This process is very cheap.
-For property list refresh, a new signal (property_list_changed) was added to Object. _change_notify() is replaced by notify_property_list_changed()
-Changed all objects using the old method to the signal, or just deleted the calls to _change_notify(<property>) since they are unnecesary now.
2021-02-10 19:31:24 -03:00
PouleyKetchoupp 333f184734 Cylinder support in Godot Physics 3D
Cylinder collision detection uses a mix of SAT and GJKEPA.
GJKEPA is used to find the best separation axis in cases where finding
it analytically is too complex.

Changes in SAT solver:
Added support for generating separation axes for cylinder shape.
Added support for generating contact points with circle feature.

Changes in GJKEPA solver:
Updated from latest Bullet version which includes EPA fixes in some
scenarios.
Setting a lower EPA_ACCURACY to fix accuracy problems with cylinder vs.
cylinder in some cases.
2021-02-10 10:00:53 -07:00
reduz 8b19ffd810 Make Servers truly Thread Safe
-Rendering server now uses a split RID allocate/initialize internally, this allows generating RIDs immediately but initialization to happen later on the proper thread (as rendering APIs generally requiere to call on the right thread).
-RenderingServerWrapMT is no more, multithreading is done in RenderingServerDefault.
-Some functions like texture or mesh creation, when renderer supports it, can register and return immediately (so no waiting for server API to flush, and saving staging and command buffer memory).
-3D physics server changed to be made multithread friendly.
-Added PhysicsServer3DWrapMT to use 3D physics server from multiple threads.
-Disablet Bullet (too much effort to make multithread friendly, this needs to be fixed eventually).
2021-02-10 13:21:46 -03:00
Rémi Verschelde b1c60c757f
Merge pull request #31747 from KoBeWi/scene_stalking
Detect external modification of scenes
2021-02-10 14:31:29 +01:00
Gilles Roudière 25c4dacb88 Fixes crash when exiting with --verbose with leaked resources 2021-02-09 17:34:49 +01:00
kobewi c390c82014 Detect external modification of project.godot 2021-02-09 14:44:44 +01:00
kleonc ad0943e3d3 Make String::ends_with don't use String::rfind 2021-02-09 00:31:28 +01:00
Rémi Verschelde 5eb46ab616
Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@f72b68b8b0.

Partial revert of #45790.
2021-02-08 16:16:29 +01:00
Rémi Verschelde c31bceb5f5
Merge pull request #45797 from madmiraal/add-new-sdl-keywords
Add support for new SDL gamecontroller keywords.
2021-02-08 13:47:01 +01:00
Marcel Admiraal 3d479d086c Add support for new SDL gamecontroller keywords. 2021-02-07 16:09:32 +00:00
Rémi Verschelde 4956d93ce6
Fix issues in last GameControllerDB sync
We don't support 'misc1' as an output string yet (seems used for PS5 controller).
Yet another broken CSV line with 'CO.,LTD'.
2021-02-07 11:47:40 +01:00
Rémi Verschelde c843efa5b7
Merge pull request #45756 from Faless/js/4.x_gamepads_db
Add some HTML5 controllers mapping.
2021-02-06 13:33:35 +01:00
Fabio Alessandrelli 27b78f13b9 Add some HTML5 controllers mapping. 2021-02-06 11:08:32 +01:00
Rémi Verschelde 2c2fffcb02
Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@c7cf1397c1.
2021-02-06 01:06:57 +01:00
kobewi fb83d905da Change sort_custom/bsearch_custom to use Callables 2021-02-04 14:37:52 +01:00
Rémi Verschelde 3a3af0279b
Merge pull request #45658 from RandomShaper/fix_frozen_peak
Make audio bus channels' peak volume consistent
2021-02-03 10:05:34 +01:00
Pedro J. Estébanez a2b3a73e2d Make audio bus channels' peak volume consistent
Channels that are inactive -or when playback has not started yet- will report -200 dB as their peak value (which is also the lowest value possible during playback).
2021-02-02 11:30:32 +01:00
Aaron Franke f55445079a
Replace ColorN and from HTML with a string constructor 2021-02-01 17:27:19 -05:00
Rémi Verschelde d2e1216504
Merge pull request #37547 from aaronfranke/tau
Use Math_TAU and deg2rad/etc in more places and optimize code
2021-02-01 20:55:25 +01:00
Rémi Verschelde 5525cd85c6
Merge pull request #45315 from RandomShaper/modernize_thread
Modernize Thread
2021-01-31 15:24:56 +01:00
Pedro J. Estébanez 99fe462452 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-01-29 12:02:13 +01:00
Aaron Franke e829b7aee4
Unify URI encoding/decoding and add to C#
http_escape and percent_encode have been unified into uri_encode, and http_unescape and percent_decode have been unified into uri_decode.
2021-01-28 07:45:01 -05:00
Aaron Franke a3e3bf8227
Make hex_to_int and bin_to_int handle the prefix automatically
Also add BinToInt to C#
2021-01-28 07:43:53 -05:00
Rémi Verschelde 976e768e71
Merge pull request #45489 from aaronfranke/core
Type consistencies in core
2021-01-27 21:16:20 +01:00
Aaron Franke 1be0d6b30e
Type consistencies in core 2021-01-26 13:04:22 -05:00
Yuri Roubinsky 38a5d22079 Renamed String.ord_at to unicode_at 2021-01-26 20:36:12 +03:00
George Marques fa498f6105
Merge pull request #45373 from aaronfranke/gdnative-sizeof
Define GDNative sizes using sizeof(godot_real) and sizeof(int32_t)
2021-01-26 14:00:32 -03:00
Rémi Verschelde d6765c8d8b
Merge pull request #44732 from Calinou/os-add-get-thread-caller-id
Add an `OS.get_thread_caller_id()` method
2021-01-26 15:54:25 +01:00
Rémi Verschelde 1940197ac7
Merge pull request #45309 from VedatGunel/fix-string-ends-with
Fix String.ends_with() for empty string arguments
2021-01-26 15:23:59 +01:00
Marcel Admiraal 8b983bddfb Remove Quat set methods in favour of constructors 2021-01-26 06:52:04 +00:00
Aaron Franke 6c197cf259
Define GDNative sizes using sizeof(godot_real_t) and sizeof(int32_t) 2021-01-25 16:42:14 -05:00
Rémi Verschelde d39f6386ce
Merge pull request #45314 from RandomShaper/modernize_rwlock
Modernize RWLock
2021-01-22 14:51:05 +01:00
Rémi Verschelde 8a6d4dd5ed
Merge pull request #45023 from reduz/optimize-shader-vgpr1
Shader optimizations to reduce VGPR usage and increase occupancy
2021-01-20 00:10:21 +01:00
reduz 099dee35f4 Added GPU based cluster builder
Clustering is now GPU based, uses an implementation based on the Activision algorithm.
2021-01-19 23:31:06 +01:00
PouleyKetchoupp 356d0fccc2
Remove useless "else" statements from vector3.h 2021-01-19 16:36:29 -05:00
Vedat Günel 1d0437c95b Fix String.ends_with() for empty string arguments 2021-01-19 15:33:41 +03:00
Pedro J. Estébanez 8ed259b792 Modernize RWLock
- Based on C++14's `shared_time_mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
2021-01-19 11:53:10 +01:00
Fabio Alessandrelli bab20c6e09 [HTML5] Custom Gamepad library to allow remapping.
No longer use emscripten functions for gamepads, implement them as
library functions in library_godot_display.js instead.
This allows us to do a better job at "guessing" vendorId, productId, OS,
etc. thus allowing us to better find the remapping for the controller.
2021-01-18 12:30:38 +01:00
Fabio Alessandrelli a1533f2c44 Better gamepad axis event injection.
In the core input handling code we have checks to make sure that if axis
rapidly change sign we inject mid-points to release any pending inputmap
action.

The function though, did not correctly insert the mid-point causing
dpads mapped to an axis that behaves like tri-state buttons (-1,0,1) to
not be released correctly.

This commit fixes that by including in the check the case where the axis
swtiches from abs(1) to 0.
2021-01-18 12:30:38 +01:00
Rémi Verschelde 70a70a4f2b
Merge pull request #45161 from Xrayez/bind-emit-changed
Expose `Resource.emit_changed()` to script
2021-01-14 15:56:26 +01:00
Rémi Verschelde 0b409d89d0
Merge pull request #45136 from akien-mga/clang-format-11
CI: Update to clang-format 11 and apply ternary operator changes
2021-01-13 16:10:44 +01:00
Andrii Doroshenko (Xrayez) e94f46dcdb Expose Resource.emit_changed() to script
Also known as `emit_signal("changed")`.
2021-01-13 16:27:58 +02:00
Rémi Verschelde d2148692bc
Merge pull request #45125 from aaronfranke/poly-lib
Update PolyPartition / Triangulator library
2021-01-12 21:40:10 +01:00
Aaron Franke ddd6fb37e8
Update PolyPartition / Triangulator library 2021-01-12 13:46:16 -05:00
Rémi Verschelde af878716f2
CI: Update to clang-format 11 and apply ternary operator changes 2021-01-12 19:32:53 +01:00
Rémi Verschelde 1218441b16
Merge pull request #44514 from madmiraal/split-os-execute
Split OS::execute into two methods
2021-01-12 16:17:04 +01:00
Gilles Roudière 831247b39c Improve UndoRedo class 2021-01-12 14:34:46 +01:00
Rémi Verschelde c26510359a
Merge pull request #42270 from AndreaCatania/AndreaCatania-patch-4
Added the function `remove_unordered` to the LocalVector container.
2021-01-11 14:48:00 +01:00
Rémi Verschelde f6be114d02
Merge pull request #44427 from briansemrau/fix-variant-bitand-validated-eval
Fix bitwise-and eval not updating return type
2021-01-11 13:53:27 +01:00
AndreaCatania 5ba60c17dd Add function LocalVector::remove_unordered
Added LocalVector unit tests.
2021-01-11 13:47:31 +01:00
Marcel Admiraal 2a74b388d0 Split OS::execute into two methods
1. execute(): Executes a command and returns the results.
2. create_process(): Creates a new process and returns the new process' id.
2021-01-09 10:03:23 +00:00
Aaron Franke 1d5042c9e2
Use Math_TAU and deg2rad/rad2deg in more places and optimize code 2021-01-09 03:47:14 -05:00
Rémi Verschelde 9349a5507f
Merge pull request #35505 from dalexeev/rtl_colors
Unified named colors in RichTextLabel
2021-01-08 09:03:55 +01:00
Rémi Verschelde 8fd3545753
Merge pull request #44904 from maiself/fix-plane-xform_inv
Fix xform_inv of Plane, intermediate results were ignored
2021-01-05 15:15:17 +01:00
Juan Linietsky d8a0dc9fcc
Merge pull request #44838 from reduz/renderer-reorganization
Reorganize renderer code + cache and threading optimizations.
2021-01-05 11:07:56 -03:00
Rémi Verschelde eea3287c2d
Merge pull request #44661 from AndreaCatania/AndreaCatania-patch-5
Fixes: GDscript min and max are inverted
2021-01-05 13:42:08 +01:00
reduz 77bc3e9ac3 Threaded optimizations to cull and render
-Reorganize thread work pool for rendering
-Fixes to make secondary command buffers to work (disabled because they need more testing)
2021-01-05 08:50:18 -03:00
reduz 5d2a1d7892 Rewrite render code to be more cache and thread friendly. 2021-01-05 08:50:18 -03:00
reduz 9a2f18f8e7 Reorganize renderer code.
So it can hopefully be made more cache efficient afterwards.
2021-01-05 08:50:18 -03:00
Joshua Dahl 453ef0ba89 Remove Unnecessary Double List
_OS::print_resources_by_type had two of the exact same list, one of which was never used.
2021-01-04 12:24:18 -08:00
Mai Lavelle 4cb070e590 Fix xform_inv of Plane, intermediate results were ignored 2021-01-03 23:49:39 -05:00
Rémi Verschelde cc416b0304
Merge pull request #44848 from mrushyendra/disconnect_err_msg
Issue correct error when disconnecting nonexistent connection with a valid signal
2021-01-01 23:02:58 +01:00
Rémi Verschelde b5334d14f7
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 🎆
2021-01-01 20:19:21 +01:00
Maganty Rushyendra 6c026a6814 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.
2021-01-01 13:08:10 +08:00
Marcus Brummer e455ca2f2f Added Geometry2D unit tests 2020-12-30 21:11:09 +01:00
Marcel Admiraal b4a190e0bc Consistently use normal_map 2020-12-29 08:04:19 +00:00
Rémi Verschelde 6cebb8c117
Merge pull request #44586 from madmiraal/rename-stepify
Rename Math::stepify to snapped
2020-12-28 21:46:43 +01:00
Rémi Verschelde 058f3fe069
Merge pull request #44149 from madmiraal/rename-tangent-orthogonal
Rename Vector2.tangent() to Vector2.orthogonal()
2020-12-28 16:00:12 +01:00
Rémi Verschelde 9addcb7603
Merge pull request #44751 from madmiraal/rename-rect-grow_margin
Rename Rect2 and Rect2i grow_margin() to grow_side()
2020-12-28 15:56:14 +01:00
Rémi Verschelde e4c0572385
Merge pull request #44593 from madmiraal/rename-mainloop-methods
Rename MainLoop methods to match Node methods
2020-12-28 14:44:28 +01:00
Marcel Admiraal b743a2ef3c Rename Math::stepify to snapped 2020-12-28 13:01:30 +00:00
Marcel Admiraal b628912af0 Rename Rect2 and Rect2i grow_margin() to grow_side() 2020-12-28 12:47:33 +00:00
Marcel Admiraal 5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
Hugo Locurcio 35b046ddf7
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>
2020-12-27 16:54:18 +01:00
George Marques d66a58a4d4
Add helper count function to Variant
To get counts of items before getting the list, which is useful for
GDNative so users can pre-allocate the buffer with the correct size
without having to get the list twice.
2020-12-27 11:14:29 -03:00
reduz 548524152e Rewrite culling to be more cache/thread friendly.
-Uses a single array with all data
-Massive performance improvement
-Does not support threads yet, but code is now thread friendly
2020-12-26 19:11:33 -03:00
reduz 2e66e5d599 Use page allocator for BVH 2020-12-24 14:08:03 -03:00
Andrea Catania 7c6506e028
Fixes: GDscript min and max are inverted 2020-12-24 18:03:50 +01:00
reduz 1bebb2ba05 Cull fixes and optimizations 2020-12-24 12:18:28 -03:00
lawnjelly 6d687de9b8 Fix BVH to world_aabb, and call update
The calls to the BVH need to use the world space AABB, rather than local space for it to work. Also, update was not being called which is required to update the AABB as objects move.
2020-12-24 11:19:50 +00:00
Juan Linietsky 3fdf4bfe71
Merge pull request #44623 from reduz/rewrite-renderer-indexer
Replace Octree by DynamicBVH in cull code
2020-12-24 00:20:45 -03:00