Commit graph

245 commits

Author SHA1 Message Date
Rémi Verschelde
e63252b421
Merge pull request #90705 from AThousandShips/foreach_list
Reduce and prevent unnecessary random-access to `List`
2024-05-07 09:04:44 +02:00
Shashank C
7a6f8452bd add timer node tests 2024-05-06 09:39:27 +05:30
A Thousand Ships
955d5affa8
Reduce and prevent unnecessary random-access to List
Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when
accessing a single element)

* Removed subscript operator, in favor of a more explicit `get`
* Added conversion from `Iterator` to `ConstIterator`
* Remade existing operations into other solutions when applicable
2024-05-04 16:08:55 +02:00
kit
0162683da4 Fix TextEdit crash with multiple carets disabled 2024-05-02 09:26:08 -04:00
kit
773a473807 Overhaul multiple caret editing in TextEdit.
Use a multicaret edit to delay merging overlapping carets until the end.
2024-04-26 14:26:10 -04:00
Rémi Verschelde
a37db390e0
Merge pull request #90229 from Santoss1809/master
Fix error message when removing only child from GraphNode
2024-04-26 11:08:25 +02:00
João Santos
eb9e193477
Fix error message when removing only child from GraphNode
Fixes #89695.
2024-04-26 10:45:45 +02:00
Rémi Verschelde
7b0bd873f0
Merge pull request #91103 from smix8/navregion_test_err
NavigationRegion test suppress warning about visual meshes
2024-04-24 18:55:16 +02:00
smix8
61c099a41f NavigationRegion test suppress warning
Suppresses warning about source geometry parsing from visual meshes in NavigationRegion test.
2024-04-24 11:32:45 +02:00
Lyuma
bb9674c1b1 Set animation step from importers. Increase default step from 10 to 30 FPS. 2024-04-19 03:02:20 -07:00
smix8
cbf881432c Update NavigationRegion test rid function
Updates NavigationRegion test rid function from deprecated get_region_rid() to use newer get_rid().
2024-04-16 11:49:23 +02:00
Rémi Verschelde
66cf38ec7c
Tests: Remove NavigationRegion3D race condition that fails on CI
As the comment pointed it out, it's a race condition, and evidently no,
"it's [not] fine" ;)
2024-04-13 10:22:44 +02:00
Hugo Locurcio
3469fb06b6
Add unit tests for GradientTexture1D and GradientTexture2D
Co-authored-by: ArthyChaux <53626057+ArthyChaux@users.noreply.github.com>
2024-04-10 20:48:43 +02:00
Rémi Verschelde
4b813386d2
Merge pull request #88614 from ramadm/test-camera-2d
Add unit tests for Camera2D
2024-04-10 14:21:43 +02:00
Markus Sauermann
48ea019322 Fix a special case for button masks
In certain situations it is possible that in a `Viewport` the same
mouse button is pressed twice in series without releasing it in
between.
In this case, focus stealing should happen to ensure, that the
mouse button is not sent unintentionally to the previously focused
Control node.
2024-03-28 20:22:49 +01:00
Christophe Andral
c988bec4b3 Add 'Skip to next (text) occurrence' feature to text editor
Adds `ui_text_skip_selection_for_next_occurrence` action and related implementation to text editor.
This action is bound `Ctrl+Alt+D` shorcut.

Used in conjonction with `ui_add_skip_selection_for_next_occurrence`, it gives the user the ability to select many occurrences of a selection
and avoid some of them.
Used without a previous selection, the action jumps to the next occurrence of the current word under the caret.
2024-03-25 11:12:28 +01:00
Rafael Chuva
8c36282feb Fix region section not ignoring #region and #endregion when in a string
When using the script editor, if the keywords #region and #endregion where
in a string and ate the start of the line, the editor would not ignore them
and count them as the actual keywords, which when folded, would only fold
until the first #endregion in a string, for example.

By checking if these keywords were in a string, this commit now ensures the
editor ignores strings and fold the section correctly.

Fixes #89115.
2024-03-11 00:04:39 +00:00
smix8
35dafc9fa8 Split monolithic physics class files
Splits monolithic physics class files.
2024-02-27 11:18:16 +01:00
Aaron Franke
c399424db9
Move 3D-only resources to their own folder 2024-02-26 05:23:04 -06:00
Aaron Franke
1cb531ddb6
Move 2D-only resources to their own folder 2024-02-26 05:22:45 -06:00
A Thousand Ships
3a707b1f54
Fix some additional errors with 3D disabled
* Disabled 2D navigation tests as they do not work
* Disabled tests for primitive meshes
* Unbound some `Mesh` methods that rely on 3D resources
* Unexposed `World3D` as it depends on physics (and isn't useful)
* Unexposed some `Viewport` vrs related properties that had unexposed
  methods
2024-02-23 20:58:56 +01:00
Rama Del Maestro
4f06ddfeae Add unit tests for Camera2D 2024-02-21 16:55:16 -08:00
b
6dbbc24bdf Added ImageTexture unit tests 2024-02-19 11:15:04 -06:00
Silc Lizard (Tokage) Renew
67e38709fd Avoid unqualified-id "near" and "far" in Node3DEditor/Viewport 2024-02-13 18:53:21 +09:00
Pawel Lampe
c2cfc0d409 Expose is_baking method in navigation servers and region nodes. 2024-02-05 22:04:22 +01:00
Markus Sauermann
689dfd7452 Test global transform when adding detached tree
Global transform should be correct after attaching a detached tree.
2024-01-18 00:25:55 +01:00
Rémi Verschelde
0a7579b161
Fix #if *_ENABLED inconsistencies, should check if defined
Co-authored-by: Caroline Joy Bell <halotroop2288@proton.me>
2024-01-17 10:30:15 +01:00
Rémi Verschelde
b88eddb682
Merge pull request #78378 from 0xafbf/curve-evaluate-correct-transform
Changed the way the rotation of a curve at a point is evaluated to match PathFollow2D
2024-01-04 16:38:38 +01:00
Rémi Verschelde
8ac674287c
Merge pull request #80819 from sepTN/test-packed-scene-v3
Improve PackedScene unit test by covering more methods
2024-01-04 14:24:46 +01:00
Yuri Sizov
02bc2a37dd Merge pull request #86118 from TheSofox/complex-undo-select-fix
Fix so undoing complex operations in `TextEdit` will restore selections
2023-12-20 15:07:52 +01:00
Yuri Sizov
40e7192393 Merge pull request #85191 from HolonProduction/off-by-one-code-edit
Fix updating delimiter cache of `CodeEdit` when typing on the first line
2023-12-20 15:07:44 +01:00
Sofox
4b82cacc21 Fix so undoing complex operations in TextEdit will restore selections. 2023-12-20 00:12:52 +00:00
Yuri Sizov
921c400db6 Merge pull request #84826 from chocola-mint/master
Add unit tests for Camera3D
2023-12-19 13:01:19 +01:00
HolonProduction
d5847fa54e Fix updating delimiter cache of CodeEdit when typing on the first line 2023-12-18 14:07:46 +01:00
Yuri Sizov
6269341461 Merge pull request #85054 from miv391/highlight-minimap-error-lines
Highlight error lines in minimap
2023-12-08 18:45:54 +01:00
Mika Viskari
609eb8bc01 Highlight error lines in minimap 2023-12-07 16:26:08 +02:00
Aaron Franke
6ee9edb946
Reduce minimum capsule/cylinder mesh rings to 0 2023-12-05 22:27:23 -06:00
CHM
2e35ecce9c Add tests for Camera3D 2023-11-13 19:04:50 +08:00
kit
d24d73ba31 Make mouse-enter/exit notifications match mouse event propagation
`NOTIFICATION_MOUSE_ENTER` and `NOTIFICATION_MOUSE_EXIT` now includes
the areas of children control nodes if the mouse filters allow it.

In order to check if a Control node itself was entered/exited, the newly
introduced `NOTIFICATION_MOUSE_ENTER_SELF` and
`NOTIFICATION_MOUSE_EXIT_SELF` can be used.

Co-authored-by: Markus Sauermann <6299227+Sauermann@users.noreply.github.com>
2023-11-09 09:11:59 -05:00
Andrés Botero
acae382010 Changed the way the rotation of a curve at a point is evaluated to match PathFollow2D 2023-10-28 01:23:38 -05:00
Bronson Holden
b15dd3e145 Add test justifying change to expected horizontal scroll position 2023-10-13 12:22:50 -07:00
Danil Alexeev
881fe67d94
Code Editor: Fix regression with using doc comments for code regions 2023-10-13 09:38:03 +03:00
Adam Scott
25cbb682f5
Fix code completion override of home and end keys 2023-10-06 14:48:45 -04:00
Rémi Verschelde
aa554e8278
Merge pull request #82694 from BrianMacIntosh/master
"Whole Words" search can detect word boundaries inside the search term.
2023-10-05 10:08:58 +02:00
Rémi Verschelde
b11309ddb6
Merge pull request #81633 from matorin57/code-completion-popup
Avoid resetting the code completion popup excessively
2023-10-03 17:20:49 +02:00
Brian MacIntosh
676627e1d1 "Whole Words" search can detect word boundaries inside the search term.
For example, searching for ".func" will now match in "a.func" even with Whole Words enabled.
2023-10-02 13:47:59 -07:00
PucklaMotzer09
d2e651f403 Add Duplicate Lines shortcut to CodeTextEditor
This keyboard shortcut has been made with inspiration from the VS Code keyboard shortcut editor.action.copyLinesDownAction. It duplicates all selected lines and inserts them below no matter where the caret is within the line.
2023-09-25 23:41:31 +02:00
DESKTOP-UT43QTQ\Garrigan-Desktop
303d0994e9 Avoid resetting the code completion popup excessively 2023-09-20 15:49:25 -05:00
Ryan Hitchman
734b9d2379 Fix Curve3D baking up vectors for nontrivial curves.
The code was modified in 42aa539 to have a different basis vector, but
this line was missed and caused up vectors to invert sometimes.

Fixes #81879
2023-09-18 18:50:36 -06:00
Rémi Verschelde
77623d0a36
Merge pull request #81354 from MJacred/textedit_pixel_pos_fix
Fix `TextEdit.get_rect_at_line_column returning` negative pos even though cursor is in viewable area of the control
2023-09-18 10:37:59 +02:00
Jean-Michel Bernard
67dce301aa Add code region folding to CodeEdit 2023-09-11 18:36:40 +02:00
MJacred
6170381bd7 Fix TextEdit.get_rect_at_line_column returning negative pos even though cursor is in viewable area of the control 2023-09-11 12:32:36 +02:00
Rémi Verschelde
11518665b7
Codestyle: Don't use auto where not warranted
We allow using auto for lambdas or complex macros where a return type
may change based on the parameters. But where the type is clear, we
should be explicit.

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2023-09-07 16:15:18 +02:00
Rémi Verschelde
d013fc3f03
Merge pull request #81304 from ajreckof/Change-precedence-in-rules-to-make-location-after-proper-casing-
Change precedence in rules to make location after proper casing.
2023-09-07 13:52:08 +02:00
ajreckof
19632eaf50 Change precedence in rules to make location after proper casing. 2023-09-05 16:16:21 +02:00
Yuri Sizov
4328ffcc79 Fix ThemeDB initialization in tests
Also fixes class name shadowing in Viewport/Window tests.
2023-09-04 18:07:16 +02:00
Rémi Verschelde
75bc6866a4
Merge pull request #81037 from AThousandShips/openxr_register
Ensure OpenXR classes are declared properly
2023-08-28 12:09:47 +02:00
Rémi Verschelde
2c0a74a149
Merge pull request #80105 from Sauermann/fix-global-transform
Fix global transform validity for `Node2D` and `Control`
2023-08-28 12:03:53 +02:00
A Thousand Ships
c23bd8b143 Ensure OpenXR classes are declared properly
Co-authored-by: Bastiaan Olij <mux213@gmail.com>
2023-08-28 09:37:04 +02:00
Septian
a31120b6f6 Improve PackedScene unit test by covering more methods 2023-08-20 20:56:27 +07:00
Rémi Verschelde
b51ee8b029
Merge pull request #80650 from bruvzg/comp_char_fix
[TextServer] Fix system font fallback and caret/selection behavior for composite characters.
2023-08-18 17:24:54 +02:00
Rémi Verschelde
3907e53ff6
SCons: Disable C++ exception handling
Upon investigating the extremely slow MSVC build times in #80513, I noticed
that while Godot policy is to never use exceptions, we weren't enforcing it
with compiler flags, and thus still included exception handling code and
stack unwinding.

This is wasteful on multiple aspects:

- Binary size: Around 20% binary size reduction with exceptions disabled
  for both MSVC and GCC binaries.
- Compile time:
  * More than 50% build time reduction with MSVC.
  * 10% to 25% build time reduction with GCC + LTO.
- Performance: Possibly, needs to be benchmarked.

Since users may want to re-enable exceptions in their own thirdparty code
or the libraries they compile with Godot, this behavior can be toggled with
the `disable_exceptions` SCons option, which defaults to true.
2023-08-16 10:23:34 +02:00
Rémi Verschelde
a7dc4c22a9
Merge pull request #80334 from Sauermann/fix-window-out-of-viewport-events
Fix nodes receiving mouse events in black bars of `Window`
2023-08-16 09:12:42 +02:00
bruvzg
5d3fcc5766
[TextServer] Fix system font fallback and caret/selection behavior for composite characters. 2023-08-15 11:42:40 +03:00
Markus Sauermann
59c13fea5d Fix nodes receiving mouse events in black bars of Window
Previously for InputEvents there was no distinction between
Window-area and Viewport-area.
This was problematic in cases where stretching was used and the Window
contained black bars at the sides of the Viewport.
This PR separates the area of Window and Viewport regarding InputEvents.
2023-08-09 12:34:22 +02:00
Septian
56d7ff6e93 Improve PackedScene unit test for complex scene 2023-08-09 00:28:53 +07:00
Markus Sauermann
152572ac38 Fix global transform validity for Node2D and Control
Set global transform to invalid when changing transform
2023-08-08 12:22:55 +02:00
Rémi Verschelde
3532661a66
Merge pull request #79440 from sepTN/test-packed-scene
Add unit tests for PackedScene
2023-08-07 14:46:38 +02:00
Rémi Verschelde
40f116f489
Merge pull request #73477 from Sauermann/fix-viewport-picking-unittest
Add Unit tests for viewport.cpp Physics 2D Picking
2023-08-07 14:43:13 +02:00
Rémi Verschelde
faaf27f284
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>
2023-08-07 13:09:47 +02:00
Markus Sauermann
9014e9e424 Add Unit tests for viewport.cpp Physics 2D Picking 2023-08-07 09:06:19 +02:00
Septian
cd94f9ad08 Add unit tests for PackedScene 2023-08-06 23:51:31 +07:00
Markus Sauermann
1e9d241809 Actually store safe-rect in embedder
`sw` is a copy and not a reference.
Add unit-test for this case.
2023-08-02 17:51:52 +02:00
Mikko Ankkala
96b26574b9 Don't override SubViewport's cursor with SubViewportContainer's cursor
Add a warning for having a non-default value of `mouse_default_cursor_shape` in SubViewportContainer

Add test
2023-07-23 22:27:55 +03:00
Hendrik Brucker
a29a680920 Extract StyleBoxFlat, StyleBoxTexture and StyleBoxLine in their own file 2023-07-17 13:25:00 +02:00
Hendrik Brucker
7e21eb7e00 Extract and reorganize texture resource classes 2023-07-14 20:04:21 +02:00
Rémi Verschelde
cce100a840
Merge pull request #75459 from kleonc/node-fix-find-children
Fix recursive `Node.find_children`
2023-06-19 22:33:46 +02:00
Rémi Verschelde
6fb391bc23
Fix various typos with codespell
And ignore some false positives introduced by recent versions of codespell.
2023-06-16 08:45:35 +02:00
Rémi Verschelde
95a9089fdd
Merge pull request #74813 from bruvzg/text_edit_autowrap
[TextEdit] Expose all auto-wrap modes.
2023-06-15 16:08:21 +02:00
Pawel Lampe
b54c3e7e5e Add initial 'NavigationObstacle' and 'NavigationRegion' tests 2023-06-14 22:24:37 +02:00
bruvzg
75e6ec8874
[TextEdit] Expose all auto-wrap modes. 2023-06-13 10:28:27 +03:00
Marius Hanl
60a17ba78d Tests for node (physics) processing and process priority 2023-06-13 00:19:43 +02:00
Rémi Verschelde
577ab3c565
Merge pull request #75746 from ajreckof/order_autocomplete
Sort code autocompletion with rules
2023-06-08 18:14:31 +02:00
Markus Sauermann
479f359ac4 Add unit test: mouse movement after slider release 2023-06-05 13:51:28 +02:00
Markus Sauermann
a9bf3de08e Fix InputEvent being used twice
A single mouse click can cause multiple actions, which contradicts
the paradigm that a single Input Event should cause only a single
action.

The solution consists of two parts:
1. Physics Picking as the last step during viewport input event
handling, currently doesn't set the event as handled. This PR sets
the event as handled in the case of physics picking.
2. After an InputEvent is processed by a SubVieportContainer, it is
sent to its parent, even if it set as handled within the SubViewport.
This PR adds an additional test to check if the event is handled
before propagating the event to the parent Control.
2023-05-29 02:39:09 +02:00
Silc Renew
42aa5398d9 Fix Pathfollow direction
Co-authored-by: aaronfranke <arnfranke@yahoo.com>
2023-05-24 17:37:00 +09:00
ajreckof
006e899bb3 sort code completions with rules
Fixups

Add levenshtein distance for comparisons, remove kind sort order, try to improve as many different use cases as possible

Trying again to improve code completion

Sort code autocompletion options by similarity based on input

To make it really brief, uses a combination `String.similiary`, the category system introduced in a previous PR, and some filtering to yield more predictable results, instead of scattering every completion option at seemingly random.

It also gives much higher priority to strings that contain the base in full, closer to the beginning or are perfect matches.

Also moves CodeCompletionOptionCompare to code_edit.cpp

Co-Authored-By: Micky <66727710+Mickeon@users.noreply.github.com>
Co-Authored-By: Eric M <41730826+EricEzaM@users.noreply.github.com>
2023-05-23 05:12:34 +02:00
Biggles Bristol
c920a4f051 [Fixed] for "off-by-1" bug when sampling "baked" curve data towards the end of the curve.
[Fixed] Failing test "[Curve] Custom curve with free tangents" by setting the curve's `bake_resolution` to 11.
[Fixed] test messages in "[Curve] Custom curve with free tangents" to match sample offset used in each test
[Added] New test "[Curve] Straight line offset test" in response to pull request feedback.
Update tests/scene/test_curve.h

Co-authored-by: kleonc <9283098+kleonc@users.noreply.github.com>
2023-05-20 11:28:09 +01:00
Alex Drozd
cdf9c33c35 add unit tests for Curve3D 2023-05-10 19:12:06 +02:00
RedworkDE
8e7afec479 Fix various errors when running the unit tests
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2023-05-09 18:40:56 +02:00
Paulb23
0b3fba45c6 Move convert_indent into CodeEdit 2023-05-07 13:08:37 +01:00
Silc Renew
fac8a918f9 Expose interpolation methods for 3D track in Animation class 2023-04-25 01:45:14 +09:00
Manuel Dun
fa7e6ddb83 Fix auto-indentation in typed arrays, comments, and after colon
Now the editor won't add indentation when pressing enter, is
declaring typed variables and there is a colon in the comment

example:
var a:=0#:[press enter]
no indentation
2023-04-20 18:48:21 -04:00
kleonc
d159123633 Fix recursive Node.find_children 2023-04-09 09:15:21 +02:00
Rémi Verschelde
1e0f7a12f7
Merge pull request #73121 from Scony/add-initial-navi-tests
Add initial navigation tests
2023-03-16 10:46:34 -07:00
Paulb23
60161cbe7d Fix ctrl+backspace crash with multicarets on the same line 2023-02-19 12:04:14 +00:00
Pawel Lampe
e92adba19c Add initial navigation tests 2023-02-13 21:39:09 +01:00
Markus Sauermann
ce6c290528 Add Unit Tests for Viewport InputEvent handling 2023-02-09 14:53:04 +01:00
Markus Sauermann
1b2ba353dc Remove m_object parameter from unit test Macros
This serves no longer any purpose and can be removed.
2023-02-09 00:20:25 +01:00
Markus Sauermann
39d79ce217 Fix mouse-button-mask on button release in unit test
On mouse-button release, the mask is 0.
2023-02-08 01:17:40 +01:00