Commit graph

3729 commits

Author SHA1 Message Date
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
Rémi Verschelde 210ebb04d3
Merge pull request #44609 from m4gr3d/fix_top_level_android_export
Fix the `String::get_base_dir()` logic to properly check for top level directories on Windows
2020-12-23 23:56:45 +01:00
reduz 83058597cf Replace Octree by DynamicBVH in cull code
-Much greater pairing/unpairing performance
-For now, using it for culling too, but this will change in a couple of days.
-Added a paged allocator, to efficiently alloc/free some types of objects.
2020-12-23 19:31:30 -03:00
Fredia Huya-Kouadio 8edacea04a Fix the String::get_base_dir() logic to properly check for top level directories on Windows. 2020-12-23 00:48:18 -08:00
Marcel Admiraal 4b8b803931 Rename Control margin to offset 2020-12-23 06:25:56 +00:00
Marcel Admiraal d9e9eb8d04 Rename MainLoop methods to match Node methods 2020-12-22 12:34:57 +00:00
Marco Cognetta 900e55eb70 simplify randi_range 2020-12-21 20:25:58 -05:00
reduz 37c6434e16 Add a paged array template
Used for reusable stacks, or filling arrays from multiple threads efficiently.
2020-12-21 15:06:50 -03:00
Rémi Verschelde 6532596d97
Merge pull request #44472 from winterpixelgames/PR-duplicate-packedarrays
Add support for duplicate() for Packed*Array, and they are pass by ref in godot 4.0
2020-12-21 17:30:01 +01:00
Rémi Verschelde fa9332a0e7
Merge pull request #43414 from Xrayez/pi-type-string
Expose `PROPERTY_HINT_TYPE_STRING` to scripting
2020-12-20 21:18:11 +01:00
Rémi Verschelde bf088da339
Merge pull request #43196 from Xrayez/property-list-changed-notify-protected
Make `property_list_changed_notify()` protected in `Object`
2020-12-20 21:16:14 +01:00
Juan Linietsky fc4d90e70d
Merge pull request #44531 from reduz/add-dynamic-bvh
Add a Dynamic BVH implementation.
2020-12-20 13:22:05 -03:00
Pedro J. Estébanez b7367ac426 Add animation reset track feature
As a bonus, to have consistency between use Beziers and create insert tracks, use Beziers also gets a default via editor settings that is used when the confirmation dialog is disabled, instead of just falling back to creating non-Bezier tracks.
2020-12-20 12:45:08 +01:00
Pedro J. Estébanez 1f52782bbb Extend UndoRedo handling of Resource to every Reference 2020-12-20 10:59:23 +01:00
reduz 5ff89931c7 Add a Dynamic BVH implementation.
-Based on Bullet Dbvh, has style and functional changes.
-Provides efficient pairing
-Needed to optimize rendering
-Needed to optimize physics

This PR is up for others to review the implementation.
2020-12-19 20:23:37 -03:00
Marcel Admiraal 2df9a8ccad Rename Rect2 and Rect2i clip() to intersection() 2020-12-19 12:59:08 +00:00
Rémi Verschelde 16524d4ae1
Merge pull request #44445 from theogen-ratkin/master
Add interpolation parameter to resize_to_po2()
2020-12-19 09:34:41 +01:00
Theogen Ratkin 46ea6750b4 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.
2020-12-18 14:05:07 -04:00
reduz d2302f53d6 Implement automatic LOD (Level of Detail)
-Happens on import by default for all models
-Just works (tm)
-Biasing can be later adjusted per node or per viewport (as well as globally)
-Disabled AABB.get_support test because its broken
2020-12-18 15:48:03 +01:00
Rémi Verschelde c7b53c03ae
SCons: Add explicit dependencies on thirdparty code in cloned env
Since we clone the environments to build thirdparty code, we don't get an
explicit dependency on the build objects produced by that environment.

So when we update thirdparty code, Godot code using it is not necessarily
rebuilt (I think it is for changed headers, but not for changed .c/.cpp files),
which can lead to an invalid compilation output (linking old Godot .o files
with a newer, potentially ABI breaking version of thirdparty code).

This was only seen as really problematic with bullet updates (leading to
crashes when rebuilding Godot after a bullet update without cleaning .o files),
but it's safer to fix it everywhere, even if it's a LOT of hacky boilerplate.
2020-12-18 10:29:34 +01:00
Jordan Schidlowsky 2d56e09276 packed*arrays are pass by ref now. support duplicate and update documentation 2020-12-17 16:09:32 -06:00
Pedro J. Estébanez 1b745c7bae Fix crash parsing a serialized Reference 2020-12-17 12:24:57 +01:00
Rémi Verschelde f3dccf5891
Merge pull request #44393 from Calinou/add-stdout-flush-project-setting
Add a project setting to enable stdout flushing in release builds
2020-12-17 10:06:50 +01:00
Brian Semrau bb4d44102d Fix bitwise-and eval not updating return type 2020-12-16 08:59:06 -05:00
Rémi Verschelde cb42bf113c
Merge pull request #44406 from vnen/variant-ptr-construct
Add PtrConstruct template to use in Variant constructors
2020-12-15 22:59:32 +01:00
George Marques b3f452b1d2
Change template order in method_ptrcall.h
To be consistent with the enum in Variant so missing types can be more
easily spotted.
2020-12-15 17:02:50 -03:00
George Marques 35e7490c95
Add PtrConstruct template to use in Variant constructors
Since the PtrToArg::encode requires the value to be constructed
previously. With PtrConstruct this is not required.
2020-12-15 16:57:44 -03:00
Rémi Verschelde 94b15bfb89
Merge pull request #44275 from vnen/variant-function-arg-pointers
Use pointer parameters in Variant function pointers
2020-12-15 20:52:03 +01:00
Andy Savage c65f097ebd Quick fix to incorrect error messages when writing to compressed or encrypted files. 2020-12-15 17:00:39 +00:00
Hugo Locurcio 341b9cf15a
Add a project setting to enable stdout flushing in release builds
This can be used in server builds for journalctl compatibility.
2020-12-15 16:40:52 +01:00
EricEzaM b2f032e1a5 Allow checking for exact matches with Action events.
Added additional param to action related methods to test for exactness.
If "p_exact_match" is true, then the action will only be "matched" if the provided input event *exactly* matches with the action event.

Before:
* Action Event = KEY_S
* Input Event = KEY_CONTROL + KEY_S
* Is Action Pressed = True

Now:
You can still do the above, however you can optionally check that the input is exactly what the action event is:
* Action Event = KEY_S
* Input Event = KEY_CONTROL + KEY_S
* p_exact_match = True
* Is Action Pressed = False
* If the Input Event was only KEY_S, then the result would be true.

Usage:

```gdscript
Input.is_action_pressed(action_name: String, exact_match: bool)
Input.is_action_pressed("my_action", true)

InputMap.event_is_action(p_event, "my_action", true)

func _input(event: InputEvent):
  event.is_action_pressed("my_action", false, true) # false = "allow_echo", true = "exact_match"
  event.is_action("my_action", true)
```
2020-12-15 09:14:18 +10:00
EricEzaM 5c15461df2 Fixed mistakes in InputEvent as_text and to_string implementations. 2020-12-14 12:42:42 +10:00
Rémi Verschelde 2760f5d0b4
Merge pull request #44315 from madmiraal/fix-handles-baseexception
Don't handle BaseException in build scripts
2020-12-12 12:23:07 +01:00
Marcel Admiraal 8ef5e3201c Don't handle BaseException in build scripts 2020-12-12 10:05:42 +00:00
Alf Kraus 68fdd753a7 wrong double quote output with .csv fixed 2020-12-11 11:42:43 +01:00
Rémi Verschelde 9263f8eb4b
Image: Rename PVRTC{2,4} to PVRTC1_{2,4}, drop COMPRESS_PVRTC2
We haven't had a proper implementation for COMPRESS_PVRTC2 (which is PVRTC1 2-bpp) in years,
so let's drop it instead of keeping a compress type which doesn't work.

The other enum values were renamed to clarify that our PVRTC2 and PVRTC4 are respectively
PVRTC1 2-bpp and PVRTC1 4-bpp. PVRTC2 2-bpp and 4-bpp are not implemented yet.
2020-12-10 23:14:04 +01:00
George Marques 0abacae2d3
Fix object check on Variant key checker 2020-12-10 18:18:52 -03:00
George Marques e4e9231420
Use pointer parameters in Variant function pointers
Instead of references. This is needed because those function pointers
are used in GDNative which needs to work with plain C, which doesn't
support passing parameters by reference.
2020-12-10 18:18:47 -03:00
Andrii Doroshenko (Xrayez) 9aa06c3e65 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.
2020-12-10 14:27:41 +02:00
Rémi Verschelde 114f97ff11
Merge pull request #44128 from KoBeWi/🧹
Cleanup unused engine code
2020-12-09 13:01:50 +01:00
Tomasz Chabora 2c048ea164 Cleanup unused engine code 2020-12-09 12:12:36 +01:00
Rémi Verschelde 92c001ef09
Merge pull request #43931 from bruvzg/ctl_comp_font
[Complex Text Layouts] Add compatibility for legacy Font resources.
2020-12-09 11:28:11 +01:00
Rémi Verschelde 0c5d3b838c
Merge pull request #44199 from bruvzg/pvs_fixes_1
PVS-Studio static analyzer fixes
2020-12-09 10:23:21 +01:00
bruvzg 644f739660
Static analyzer fixes:
Removes unused code in OS.
Fixes return types.
Fixes few typos.
2020-12-09 10:17:53 +02:00
Rémi Verschelde e5e1277ecd
Merge pull request #44161 from Faless/fix/fa_buffered_remove
Remove unused FileAccessBuffered
2020-12-09 09:14:14 +01:00
Rémi Verschelde 2034a1cca0
Merge pull request #44089 from Xrayez/rng-state
Add ability to restore `RandomNumberGenerator` state
2020-12-08 21:40:38 +01:00
Rémi Verschelde 90bdba576a
Merge pull request #43742 from qarmin/editor_modules_default_values
Initialize class/struct variables with default values in platform/ and editor/
2020-12-08 15:53:42 +01:00
Emmanuel Leblond a211812932
Constify ScriptLanguage.can_inherit_from_file 2020-12-08 13:06:15 +01:00
Rémi Verschelde a834055c63
Merge pull request #44148 from Calinou/tweak-log-file-names
Tweak log file names for consistency between Mono and non-Mono logs
2020-12-08 09:42:54 +01:00
Andrii Doroshenko (Xrayez) b5107715f1 Add ability to restore RandomNumberGenerator state
- added `state` as a property to restore internal state of RNG;
- `get_seed()` returns last seed used to initialize the state rather than the current state.

Co-authored-by: MidZik <matt.idzik1@gmail.com>
2020-12-07 13:50:46 +02:00
Aaron Franke 5465e604bb
Improve argument names for core types 2020-12-07 05:01:33 -05:00
Hugo Locurcio 4d81776fc9
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.
2020-12-06 20:17:02 +01:00
Fabio Alessandrelli 781efc26e0 Remove now unused FileAccessBuffered. 2020-12-06 19:37:11 +01:00
Marcel Admiraal a24c38d1a8 Rename Vector2.tangent() to Vector2.orthogonal() 2020-12-06 18:16:06 +00:00
Aaron Franke 1b348b3c17
Remove connect *_compat methods 2020-12-05 17:56:47 -05:00
Rémi Verschelde 1287ea63c1
Merge pull request #44084 from vnen/float-is-real
Rename TYPE_REAL to TYPE_FLOAT
2020-12-04 14:26:22 +01:00
George Marques 02f60812ed
Rename TYPE_REAL to TYPE_FLOAT
To be consistent with the naming everywhere else.
2020-12-04 09:47:26 -03:00
reduz e93b2242c2 Reorganize rendering server.
-Made RenderingServerScene abstract, allowing reimplementation
-RenderingServerRaster -> RenderingServerDefault, but this class is going away soon.
2020-12-03 19:01:01 -03:00