Commit Graph

482 Commits

Author SHA1 Message Date
Aaron Franke c60ac64e8f
Fix big negative numbers printing incorrect decimals in num_real 2022-10-15 17:57:54 -05:00
jbcolli2 ad16187a4a PrimitiveMesh unit tests. 2022-10-14 12:23:36 -04:00
kobewi 072f6feaba Make some Image methods static 2022-10-14 14:34:15 +02:00
Rémi Verschelde f12c4e8b9a Merge pull request #67251 from groud/simplify_path_solve_urls
Make String.simplify_path keep the protocol identifier for urls
2022-10-13 15:24:18 +02:00
Gilles Roudière bf1a40c168 Make String.simplify_path keep the protocol identifier for urls 2022-10-13 12:23:49 +02:00
jbcolli2 92a466c162 Unit tests for Path2D module.
Co-authored-by: Matthew-Tave <tavematthew@gmail.com>
2022-10-12 22:00:34 -04:00
Paulb23 f3eb543e67 Fix select word under caret using caret col instead of line 2022-10-11 20:32:06 +01:00
Rémi Verschelde 58eff50bf1 Merge pull request #64268 from timothyqiu/is-finite
Add `is_finite` method for checking built-in types
2022-10-11 09:25:46 +02:00
Rémi Verschelde 4be5660223 Merge pull request #67145 from Paulb23/tab_textedit
Fix inserting tabs in TextEdit
2022-10-10 13:52:42 +02:00
Haoyu Qiu eac9adf7a1 Don't allow removing TextEdit's main caret 2022-10-10 08:30:23 +08:00
Paulb23 7333aa68f4 Handle tab in TextEdit 2022-10-09 17:46:40 +01:00
Haoyu Qiu 5da515773d Add `is_finite` method for checking built-in types 2022-10-08 13:25:08 +08:00
Paulb23 4a9d4e3dad Add mutliple Caret support to TextEdit 2022-10-05 17:19:26 +01:00
Rémi Verschelde 54418ea659 Remove NO_THREADS fallback code, Godot 4 requires thread support
This also removes `OS::can_use_threads` from the public API since it's always
true.
2022-10-03 11:23:26 +02:00
Rémi Verschelde d9a3888cea Merge pull request #66133 from aaronfranke/set-all
Delete `set_all`, `set_axis`, and `get_axis` methods from Vector2/3/3i/4/4i
2022-10-03 09:23:46 +02:00
Rémi Verschelde cf6978f286 Merge pull request #64833 from MarcusElg/naninfprinting
Improve string formatting (%f and %v) for inf and nan
2022-10-03 09:23:12 +02:00
Rémi Verschelde 166df0896c Fix typos with codespell
Using codespell 2.3-dev from current git.

And fix typo in `methods.py` for `vsproj=yes` option (still won't work
though).
2022-09-30 14:23:36 +02:00
bruvzg 8f5d56e04a
[GDExtension] Use function names with underscore for TextServer extension, add macros to generate wrappers for module functions. 2022-09-28 10:04:11 +03:00
Rémi Verschelde 7562932eb2 Merge pull request #66160 from dpalais/double_time
Use double instead of real_t type for time-related parameters and variables
2022-09-27 10:04:10 +02:00
Dave Palais 0c46068af0 Change time parameters and variables to double type
Addresses #65313
2022-09-26 13:52:54 -05:00
Micky ef8fbae929
Add more tests for Vector* types 2022-09-25 22:58:58 -05:00
Aaron Franke fd8bd27657
Remove set_axis and get_axis methods from Vector2/2i/3/3i/4/4i 2022-09-19 15:08:50 -05:00
fabriceci 9f1a57d48b Test, refactor and fix a bug in Basis.get_axis_angle 2022-09-14 12:05:22 +02:00
Haoyu Qiu f5760ed65d Fix parsing of XML CDATA and add test cases 2022-09-09 09:42:24 +08:00
bruvzg 6f4d233062
Fix key mapping changes when moving from macOS to other platform
Removes separate `Command` key (use `Meta` instead).
Adds an event flag to automatically remap `Command` <-> `Control` (cannot be set alongside `Control` or `Meta`).
2022-09-07 18:45:35 +02:00
Ricardo Buring 532e378cd9 Expose registration of physics servers to GDExtension
This exposes PhysicsServer2DManager and PhysicsServer3DManager.
2022-09-07 15:05:46 +02:00
Rémi Verschelde 3515382390 Merge pull request #64361 from Mickeon/rename-caret-blink
Rename every instance of `caret_blink_speed` to `caret_blink_interval`
2022-09-07 08:51:02 +02:00
Micky 6dbd283ae5 Rename every instance of `caret_blink_speed` to `caret_blink_interval`
It's been changed in EditorSettings, LineEdit, TextEdit.

Affects setters and getters, and passed parameters, too.
2022-09-06 18:37:17 +02:00
Aaron Franke 995b9f94e8
Replace Rect2(i) has_no_area with has_area 2022-09-04 23:03:36 -05:00
Aaron Franke 817ae95667
Replace AABB has_no_volume with has_volume
Also replace has_no_surface with has_surface
2022-09-04 23:03:36 -05:00
Rémi Verschelde 33b4153764
Merge pull request #64917 from Tim-Fronsee/fix/add-gutter-total-width 2022-09-02 20:52:11 +02:00
Rémi Verschelde c82bbc38a5 Merge pull request #64952 from Chaosus/vs_rename_uniform_to_param 2022-09-02 13:49:53 +02:00
Hendrik Brucker ea0472fecf Refactor BitMap and add tests
Co-authored-by: Resul Çelik <resul_celik@hotmail.com>
2022-09-01 18:39:17 +02:00
Rémi Verschelde f02134a8c0
Merge pull request #55617 from madmiraal/fix-55384 2022-09-01 18:20:01 +02:00
Rémi Verschelde 41156a1e83
Merge pull request #63968 from KoBeWi/finding_stuff_in_a_dictionary 2022-09-01 17:38:39 +02:00
Yuri Rubinsky 8191b3c110 Rename `uniform` to `parameter` across the engine 2022-09-01 11:42:57 +03:00
Tim Fronsee e5c183b01e Fix TextEdit::gutters_width (total gutter width) when adding & removing a gutter by calling TextEdit::_update_gutter_width in TextEdit::add_gutter & TextEdit::remove_gutter
Update TextEdit gutters subcase, gutter add and remove to ensure gutter total width is correct

Fix test_code_edit symbol lookup test case to include padding (+2)
2022-08-31 10:01:40 +09:00
Hugo Locurcio ae18928748
Rename Curve/Curve2D/Curve3D/Gradient `interpolate()` to `sample()`
"sampling" is a more accurate term than "interpolating" for what's
happening when using that function.
2022-08-30 22:08:38 +02:00
Marcel Admiraal 0046d320bb Fix Geometry3D::get_closest_points_between_segments() returns NaN
Also fix:
- Geometry3D::get_closest_distance_between_segments() returning
  incorrect values.
- Test for Geometry3D::get_closest_distance_between_segments() testing for
  an incorrect value.
2022-08-30 12:13:11 +01:00
Danil Alexeev d4555ef5fb
Add `String.to_{camel,pascal,snake}_case` methods 2022-08-30 12:36:24 +03:00
Aaron Franke 10a56981dc
Rename String `plus_file` to `path_join` 2022-08-29 19:38:13 -05:00
Rémi Verschelde e60086f98b
Merge pull request #64119 from YuriSizov/theme-init-database 2022-08-29 14:02:21 +02:00
Rémi Verschelde fd6453c45e Revert "Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED"
This reverts commit 4b817a565c.

Fixes #64988.
Fixes #64997.

This caused several regressions (#64988, #64997,
https://github.com/godotengine/godot/issues/64997#issuecomment-1229970605)
which point at a flaw in the current logic:

- `Control::NOTIFICATION_ENTER_TREE` triggers a *deferred* notification with
  `NOTIFCATION_THEME_CHANGED` as introduced in #62845.
- Some classes use their `THEME_CHANGED` to cache theme items in
  member variables (e.g. `style_normal`, etc.), and use those member
  variables in `ENTER_TREE`, `READY`, `DRAW`, etc. Since the `THEME_CHANGE`
  notification is now deferred, they end up accessing invalid state and this
  can lead to not applying theme properly (e.g. for EditorHelp) or crashing
  (e.g. for EditorLog or CodeEdit).

So we need to go back to the drawing board and see if `THEME_CHANGED` can be
called earlier so that the previous logic still works?

Or can we refactor all engine code to make sure that:
- `ENTER_TREE` and similar do not depend on theme properties cached in member
  variables.
- Or `THEME_CHANGE` does trigger a general UI update to make sure that any
  bad theme handling in `ENTER_TREE` and co. gets fixed when `THEME_CHANGE`
  does arrive for the first time. But that means having a temporary invalid
  (and possibly still crashing) state, and doing some computations twice
  which might be heavy (e.g. `EditorHelp::_update_doc()`).
2022-08-29 11:11:29 +02:00
Aaron Record 4b817a565c Remove NOTIFICATION_ENTER_TREE when paired with NOTIFICATION_THEME_CHANGED 2022-08-27 11:52:29 -06:00
Yuri Sizov 6320a0fc18 Add ThemeDB, expose previously static Theme methods 2022-08-26 19:23:05 +03:00
Micky 59e11934d8 Rename `str2var` to `str_to_var` and similar
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too.

- `var2str` -> `var_to_str`
- `str2var` -> `str_to_var`
- `bytes2var` -> `bytes_to_var`
- `bytes2var_with_objects` -> `bytes_to_var_with_objects`
- `var2bytes` -> `var_to_bytes`
- `var2bytes_with_objects` -> `var_to_bytes_with_objects`
- `linear2db` -> `linear_to_db`
- `db2linear` -> `db_to_linear`
- `deg2rad` -> `deg_to_rad`
- `rad2deg` -> `rad_to_deg`

- `dict2inst` -> `dict_to_inst`
- `inst2dict` -> `inst_to_dict`
2022-08-26 14:58:22 +02:00
Rémi Verschelde 88145e81e2
Merge pull request #64804 from Mickeon/rename-path-progress 2022-08-25 18:35:48 +02:00
Marcus Elg b21460981d Improve string formatting for %f and %v for inf and nan 2022-08-25 07:41:21 +02:00
Marcus Elg acd9736fc9 Formatting changes to string test comments 2022-08-24 16:23:53 +02:00
Micky bb936b2e27 Rename PathFollow's `offset`s to `progress` & `progress_ratio`
Applies for both PathFollow2D and PathFollow3D
2022-08-24 01:56:03 +02:00
Rémi Verschelde 08d8f884cd
Merge pull request #63728 from MarcusElg/%v
Add %v for formatting vectors
2022-08-24 00:42:47 +02:00
Rémi Verschelde 649e76aa38
Merge pull request #64639 from Geometror/test-quickadd-script 2022-08-23 18:17:24 +02:00
Marcus Elg dbc165715b Add %v for formatting vectors 2022-08-23 17:26:06 +02:00
kobewi 8be27dc59e Replace Array return types with TypedArray 2022-08-22 22:42:36 +02:00
Rémi Verschelde 0cea7e3f64
Merge pull request #62545 from yedpodtrzitko/yed/pytest-builders 2022-08-22 19:32:11 +02:00
Hendrik Brucker 3168a6a303 Add a Python script to create new test suites more quickly
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2022-08-20 14:41:05 +02:00
Jiri Suchan 388d35b74d ci: add basic test pipeline for shader builders 2022-08-19 20:32:13 +09:00
Yuri Sizov 980f5f32f4 Make `property_*_revert` methods multilevel and expose them for scripting 2022-08-18 00:03:53 +03:00
kobewi cc424bcb18 Add Dictionary.find_key() 2022-08-16 13:48:59 +02:00
antonWetzel 40a1d6d100 vector4 distance_squared_to and update csharp 2022-08-09 01:59:17 +02:00
Yuri Sizov 1362bc22bd Add tests for empty/unnamed arguments to ClassDB, Variant, GDScript 2022-08-08 16:36:01 +03:00
Hendrik Brucker 36061c5dca Vector4/Vector4i: Add missing methods, tests and fix change of sign operator 2022-08-07 12:25:05 +02:00
bruvzg 4b155b939b
[Text Server] Prevent composite glyphs which incorporate kashida from being used for justification. Update TextServer tests to clean up on fail. 2022-08-05 19:35:38 +03:00
Rémi Verschelde 62423b691e Tests: Silence some intentional errors
Also fix printing messages in ClassDB test.
2022-08-04 22:03:44 +02:00
jtorre39 667faa68e9 Add unit tests for all public methods in the SpriteFrames class 2022-08-04 14:27:14 +02:00
Rémi Verschelde 426240f18a
Merge pull request #50907 from codepatzer/quaternion_ut 2022-08-04 14:26:46 +02:00
Rémi Verschelde 29afda3fd5
Merge pull request #60736 from StrawbDev/audio-stream-sample-unit-test 2022-08-04 13:56:53 +02:00
codepatzer d0cb0ff248 Add tests file for Quaternion unit tests, with initial UTs
- Test constructors and quaternion product.
- Add test case for Axis-Angle construction about Y-axis.
- Add test case for xform of i-, j-, & k-unit vectors.
- Add test case for construction from Basis.
- Add test case for xform of arbitrary vector.
- Add stress test case: many Quaternions xform many vectors.
- Make comments consistent with style guide.
2022-08-04 13:56:04 +02:00
StrawbDev 3c252d5c6d Add test cases for AudioStreamWAV 2022-08-04 13:24:33 +02:00
Timon Bestebreur 997f18f686 Add Unit Tests for InputEventKey 2022-08-04 12:59:13 +02:00
Rémi Verschelde 255e0770c4
Merge pull request #54325 from skimmedsquare/test-add-rid 2022-08-04 12:51:53 +02:00
Timon Bestebreur 92b392e3db Add unit tests for Shortcut
Next to that, add entry for the test file in test_main.cpp.

These test cases test the basic functionality of the shortcut module.
2022-08-04 12:18:36 +02:00
Sean Kim 4706b975b6 Add unit tests for RID class. 2022-08-04 12:05:25 +02:00
Fabian Keller f242f9c738 Fix consistency of translated/scaled/rotated in Transform2D and Transform3D 2022-08-02 23:38:14 +02:00
Rémi Verschelde 33258d850c
Merge pull request #61315 from lawnjelly/variant_bucket_pools
Variant memory pools
2022-08-02 15:54:18 +02:00
bruvzg 5aa48b6ae5
[TextServer] Implement ICU/UAX 31 based `is_valid_identifier` function. 2022-08-02 08:30:20 +03:00
Rémi Verschelde 44f1e540f6
Merge pull request #63733 from akien-mga/file-get_as_text-skip-CR
File: Re-add support to skip CR (`\r`) in `File::get_as_text`
2022-08-01 07:54:20 +02:00
Juan Linietsky 0dd65378e7 Add support for command-line user arguments.
Implements the standard Unix double dash (--) commandline argument:
* Arguments after a double dash (--) are ignored by Godot and stored for the user.
* User can access them via `OS.get_cmdline_user_args()`

Example:

`godot.exe scene_to_run.tscn --fullscreen -- --start-level 2`
2022-08-01 00:56:59 +02:00
Rémi Verschelde 1418f97c70 File: Re-add support to skip CR (`\r`) in `File::get_as_text`
This was removed in #63481, and we confirmed that it's better like this,
but we add back the possibility to strip CR as an option, to optionally
restore the previous behavior.

For performance this is done directly in `String::parse_utf8`.

Also fixes Android `FileAccess::get_line()` as this one _should_ strip CR.

Supersedes #63717.
2022-08-01 00:40:35 +02:00
Rémi Verschelde 5c6744ae54
Merge pull request #42069 from Calinou/test-add-os
Add a test suite for OS
2022-07-30 09:45:00 +02:00
kobewi c3606cb5f3 Swap arguments of ResourceSaver.save() 2022-07-29 19:53:09 +02:00
Juan Linietsky d4433ae6d3 Remove Signal connect binds
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind().
Changed all uses of it to Callable.bind()
2022-07-29 16:26:13 +02:00
Hugo Locurcio 208435fb90
Add a test suite for OS 2022-07-29 01:55:43 +02:00
Rémi Verschelde 14d021287b
Merge pull request #63049 from Faless/mp/4.x_as_module 2022-07-28 20:46:31 +02:00
Hugo Locurcio 4b42379c8f
Rename RenderingServer global shader uniform methods to be more explicit
The `global_shader_uniform` name is longer, but it makes it much
easier to find the methods when searching in the class reference.
2022-07-28 18:46:59 +02:00
Fabio Alessandrelli ca7d572908 [Net] Modularize multiplayer, expose MultiplayerAPI to extensions.
- RPC configurations are now dictionaries.
- Script.get_rpc_methods renamed to Script.get_rpc_config.
- Node.rpc[_id] and Callable.rpc now return an Error.
- Refactor MultiplayerAPI to allow extension.
- New MultiplayerAPI.rpc method with Array argument (for scripts).
- Move the default MultiplayerAPI implementation to a module.
2022-07-26 09:31:12 +02:00
Rémi Verschelde 90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
reduz 67a260d63f Implement a Worker ThreadPool
This PR implements a worked thread pool. It uses a fixed amount of threads in a pool and allows scheduling tasks
that can be run on threads (and then waited for). It satisfies the following use cases:

* HTML5 thread count is fixed (and similar restrictions are known in consoles) so we need to reuse threads.
* Thread spawning is slow in general, so reusing threads is faster anyway.
* This implementation supports recursive waiting for tasks, making it less prone to deadlocks if threads from the pool also run tasks.

After this is approved and merged, subsequent PRs will be needed to replace the ThreadWorkPool usage by this class.
2022-07-22 11:46:48 +02:00
bruvzg 8823eae328
Rename OSX to macOS and iPhoneOS to iOS. 2022-07-21 09:37:52 +03:00
FireForge 84431bd782 Use integer types in Image and ImageTexture methods
- Image.blit_rect()
- Image.blit_rect_mask()
- Image.blend_rect()
- Image.blend_rect_mask()
- Image.fill_rect()
- Image.get_used_rect()
- Image.get_rect()
- ImageTexture.set_size_override()
2022-07-18 19:43:32 -05:00
Marcel Admiraal 438b706d43 Fix TextEdit test dependency on SceneTree's initial process time > 0 2022-07-17 08:50:12 +01:00
Rémi Verschelde 1e553e34fb
Merge pull request #62108 from bruvzg/font_config_v3 2022-07-07 12:22:49 +02:00
bruvzg 0c5431644d
Allows parsing of invalid UTF-16 surrogates (can be encountered in Windows filenames) and some non-standard UTF-8 variants, makes Unicode parse errors more verbose. 2022-07-07 11:07:18 +03:00
bruvzg 344ba0ffaf
Refactor Font configuration and import UI, and Font resources. 2022-07-06 14:12:36 +03:00
reduz 5ac42cf576 Implement a BitField hint
Allows to specify the binder that an enum must be treated as a bitfield.
2022-07-05 22:13:37 +02:00
cabinboy1031 7730001390 Implemented tests for Plane getters and setters.
Added tests for intersection and plane-point methods.
2022-07-05 12:55:05 +02:00
lawnjelly b221eab426 Variant memory pools
Memory pools via PagedAllocator for Transform2D, Transform3D, Basis and AABB.
2022-07-04 12:01:46 +01:00
bruvzg 860e24683f
Make enum/constant binds 64-bit. 2022-06-17 16:36:26 +03:00
Yuri Rubinsky 7da2a21425 Make AStar to use 64-bit logic 2022-06-16 16:43:41 +03:00
Rémi Verschelde 9923851370 Fix typos with codespell
Using codespell 2.2-dev from current git.
2022-05-23 21:32:19 +02:00