Commit graph

402 commits

Author SHA1 Message Date
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
reduz
45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
Rémi Verschelde
eb9fd57f76 doctest: Update to 2.4.8 2022-05-17 21:53:32 +02:00
Haoyu Qiu
3094e739f5 Create onready variables when dropping nodes and holding Ctrl 2022-05-17 11:51:22 +08:00
reduz
746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
reduz
8b7c7f5a75 Add a new HashMap implementation
Adds a new, cleaned up, HashMap implementation.

* Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing).
* Keeps elements in a double linked list for simpler, ordered, iteration.
* Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much
  for performance vs keeping the key, but helps replace old code).
* Uses a more modern C++ iterator API, deprecates the old one.
* Supports custom allocator (in case there is a wish to use a paged one).

This class aims to unify all the associative template usage and replace it by this one:
* Map<> (whereas key order does not matter, which is 99% of cases)
* HashMap<>
* OrderedHashMap<>
* OAHashMap<>
2022-05-12 11:21:29 +02:00
Rémi Verschelde
afc49732ba
Merge pull request #59643 from kneejuicer/geometry2D-tests
Add extra unit tests for Geometry2D
2022-05-10 14:45:36 +02:00
Paweł Fertyk
d1aed90976 Fix backspace when selection reaches left edge
Fixes #60866.
2022-05-09 14:16:28 +02:00
Nicholas Huelin
8409d92282 Fix inconsistent naming in Time 2022-05-05 16:00:37 +02:00
Aaron Franke
fa7a7795f0
Rename Basis get_axis to get_column, remove redundant methods 2022-05-03 09:37:47 -05:00
Hugo Locurcio
180e5d3028
Remove RES and REF typedefs in favor of spelled out Ref<>
These typedefs don't save much typing compared to the full `Ref<Resource>`
and `Ref<RefCounted>`, yet they sometimes introduce confusion among
new contributors.
2022-05-03 01:43:50 +02:00
Rémi Verschelde
5c52b30471
Merge pull request #60529 from timothyqiu/theme-validation 2022-05-02 10:49:14 +02:00
Haoyu Qiu
ad1a8777bd Fix left aligned integer sign in string formatting 2022-05-01 12:42:48 +08:00
Rémi Verschelde
65aacd6b0a
Merge pull request #60519 from nathanfranke/fix-newline-indent
fix lines with ':' that end in comments causing auto indent
2022-04-29 14:08:31 +02:00
Nathan Franke
bdd7b558b6
remove escapes in gdscript test output 2022-04-28 22:21:26 -05:00
Nathan Franke
925e54ad65
fix lines ending in comments causing auto indent 2022-04-28 20:07:10 -05:00
bruvzg
6ab672d1ef Implement text-to-speech support on Android, iOS, HTML5, Linux, macOS and Windows.
Implement TextServer word break method.
2022-04-28 14:35:41 +03:00
Aaron Franke
0ae00a07d6
Rename variable names for some singletons 2022-04-26 22:53:50 -05:00
Rémi Verschelde
e9e2aaf812
Merge pull request #60513 from Calinou/default-font-add-msdf-mipmap
Add MSDF and mipmap generation project settings for the default font
2022-04-26 22:39:55 +02:00
Haoyu Qiu
d8c04cda3a Validate theme type/item names 2022-04-26 19:54:43 +08:00
Hugo Locurcio
43c34bf611
Add MSDF and mipmap generation project settings for the default font
This can be used to improve Label3D and scaled Control appearance
in prototypes.
2022-04-25 16:47:44 +02:00
Paulb23
c1d445f1e5 Add inital TextEdit UnitTests 2022-04-22 21:09:48 +01:00
Paulb23
5e4e4967fe Use Input::push_input for tests plus extra mouse testing 2022-04-22 17:39:12 +01:00
Rémi Verschelde
46ef52162e Color: Rename to_srgb/to_linear to include base color space
This helps reduce confusion around sRGB <> Linear conversions by making
both input and output color spaces explicit.
2022-04-13 11:45:52 +02:00
bruvzg
9381acb6a4
Make FileAccess and DirAccess classes reference counted. 2022-04-11 13:28:51 +03:00
Rémi Verschelde
c99a1af0fb Remove unused legacy tests
They haven't been updated for years and still use the old MainLoop
basic framework instead of the new doctest one.

They're of dubious quality and best redone from scratch using the
new framework.
2022-04-07 00:38:44 +02:00
Rémi Verschelde
f8ab79e68a Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
2022-04-04 19:49:50 +02:00
kneejuicer
113579cec8 Add extra unit tests for Geometry2D 2022-03-29 00:58:55 +02:00
Hugo Locurcio
1c343cd54d Expose Color's to_linear() and to_srgb() to scripting 2022-03-28 12:17:55 +02:00
reduz
09b951b99b Refactor Object metadata
* API kept the same (Although functions could be renamed to set_metadata/get_metadata in a later PR), so not much should change.
* Metadata now exposed as individual properties.
* Properties are editable in inspector (unless metadata name begins with _) under the metadata/ namespace.
* Added the ability to Add/Remove metadata properties to the inspector.

This is a functionality that was requested very often, that makes metadata work a bit more similar to custom properties in Blender.
2022-03-24 14:21:52 +01:00
Yuri Roubinsky
7913e04950 Rename AStar to AStar3D 2022-03-20 17:34:40 +03:00
Rémi Verschelde
5c8bd6fd71
Merge pull request #58233 from bruvzg/gde_ts 2022-03-18 14:29:58 +01:00
taigi100
bd247fa315 Update color constants to use HEX codes 2022-03-17 11:36:23 +02:00
bruvzg
f19cd44346
Unify TextServer built-in module and GDExtension code. 2022-03-17 08:15:29 +02:00
Aaron Franke
89c4990274
Fix Slerp C# docs and add test cases for vectors in the same direction 2022-03-12 13:20:55 -06:00
Rémi Verschelde
26fd6fe2b2
Merge pull request #58485 from aaronfranke/time-offset 2022-03-10 21:13:29 +01:00
reduz
21637dfc25 Remove VARIANT_ARG* macros
* Very old macros from the time Godot was created.
* Limited arguments to 5 (then later changed to 8) in many places.
* They were replaced by C++11 Variadic Templates.
* Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard.
* Also added a dereference check for Variant*. Helped catch a couple of bugs.
2022-03-09 18:39:13 +01:00
Rémi Verschelde
9b05f29894 Remove unused GDNative code
This has been superseded by GDExtension so this code is no longer useful
nor usable.

There's still some GDNative-related stuff in platform export code which
needs to be adapted for GDExtension (e.g. to include GDExtension libraries
in exports).
2022-03-09 13:59:03 +01:00
Aaron Franke
55aabb8b06
Add offset string from minutes conversion method to Time singleton 2022-02-23 22:12:02 -06:00
Rémi Verschelde
b8b4580448
Style: Cleanup single-line blocks, semicolons, dead code
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
2022-02-16 14:06:29 +01:00
bruvzg
29199579f7
Add sub-pixel glyph positioning support. 2022-02-12 19:55:52 +02:00
Hendrik Brucker
b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
Rémi Verschelde
1bdb82c64e
Fix typos with codespell
Using codespell 2.2-dev from current git.

Added `misc/scripts/codespell.sh` to make it easier to run it once in a
while and update the skip and ignore lists.
2022-02-10 12:30:19 +01:00
Rémi Verschelde
fc076ece3d
Revert "Add missing SNAME macro optimization to all theme methods call"
This reverts commit a988fad9a0.

As discussed in #57725 and clarified in #57788, `SNAME` is not meant to be used
everywhere but only in critical code paths. For theme methods specifically, it
was by design that only getters use `SNAME` and not setters.
2022-02-08 10:17:25 +01:00
Rémi Verschelde
bc1a3d791d
Merge pull request #57490 from Calinou/test-add-animation 2022-02-07 13:27:12 +01:00
jmb462
a988fad9a0 Add missing SNAME macro optimization to all theme methods call 2022-02-06 23:06:11 +01:00
Hugo Locurcio
a6e8cdae66
Add a unit test suite for Animation 2022-02-06 21:33:22 +01:00
Rémi Verschelde
a0c87d4c11
Merge pull request #57620 from Haydoggo/expression-exp-fix
Fix Expression's parsing of positive exponent literals
2022-02-05 10:14:10 +01:00
Hayden
1305ff92f7 Make parser treat all exponent literals as float 2022-02-05 16:34:26 +13:00
Rémi Verschelde
e223bad86d
Core: Move Vector2i to its own vector2i.h header
Also reduce interdependencies and clean up a bit.
2022-02-04 16:32:21 +01:00
Rémi Verschelde
5f56d385b0
Core: Move Rect2i to its own rect2i.h header
And take the opportunity to improve interdependencies a bit with forward
declares where possible.
2022-02-04 14:17:30 +01:00
bruvzg
244db37508
Cleanup and move char functions to the char_utils.h header. 2022-02-04 11:35:01 +02:00
Anilforextra
adbe948bda String: Add contains(). 2022-02-04 01:28:02 +05:45
Rémi Verschelde
8c7cd904f5
Merge pull request #57469 from Sauermann/fix-rect2i-intersect 2022-02-01 00:05:02 +01:00
Markus Sauermann
23a4fe5b27 Fix incorrect Rect2i calculations: intersects and encloses
Clarify expand documentation
2022-01-31 19:03:57 +01:00
Igor Kordiukiewicz
f170d6a171 With auto_brace_complete enabled, selected text now gets wrapped by braces 2022-01-30 17:33:13 +01:00
Nathan Franke
8a0a3accee
simplify formatting scripts, add a clang-tidy script, and run clang-tidy 2022-01-29 04:41:03 -06:00
Rémi Verschelde
e6caaf4c80
Merge pull request #57205 from TechnoPorg/variant-template-cast
Allow method binds to take Object subclasses as arguments
2022-01-27 23:46:37 +01:00
Rémi Verschelde
899cd34426
Merge pull request #57281 from Rubonnek/rename-subsequence 2022-01-27 11:03:13 +01:00
Wilson E. Alvarez
3eb5e0ac50
Rename String::is_subsequence_ofi to String::is_subsequence_ofn 2022-01-26 18:03:56 -05:00
TechnoPorg
051ef479c9 Allow method binds to take Object subclasses as arguments
This commit adds a condition to VariantCaster that casts Variants of type OBJECT to any type T, if T is derived from Object.
This change enables a fair bit of code cleanup. First, the Variant implicit cast operators for Node and Control can be removed, which allows for some invalid includes to be removed. Second, helper methods in Tree whose sole purpose was to cast arguments to TreeItem * are no longer necessary.
A few small changes also had to be made to other files, due to the changes cascading down all the includes.
2022-01-25 09:03:36 -07:00
Preslavb
6f1089af86 Fix selection being deleted and indentation not being accounted for 2022-01-23 23:14:35 +00:00
Rémi Verschelde
668d6a1c5c
Merge pull request #56337 from cdemirer/fix-array-dictionary-id 2022-01-23 00:46:53 +01:00
kobewi
1422c756ed Rename request_code_completion signal 2022-01-22 14:04:35 +01:00
Hugo Locurcio
84a69d7429 Improve the default project theme
The new default project theme uses StyleBoxFlat extensively for
a more modern design and better scalability to multiple resolutions.

SVG icons are now used in place of PNG icons. While this does not
allow for true vector-based icon drawing (icons are still rasterized
at load-time), this makes the design work easier for contributors
and opens the door to vector drawing in the future (e.g. with polygons
or SDFs).

Like for editor icons, the SVG header file is now built automatically
when a SVG file is changed. This removing the need for running
`make_header.py` manually (TODO).

The "Use Hidpi" project setting has been removed in favor of a
"Default Theme Scale" project setting, which allows creating the
default theme at a higher/lower scale than the default.
This can be used when designing GUIs with a high base resolution
to ensure crisp visuals.

Co-authored-by: Yuri Sizov <yuris@humnom.net>
2022-01-19 18:46:01 +03:00
Rémi Verschelde
9912492e93
Merge pull request #56668 from akien-mga/array-slice-nicer-bound-checks 2022-01-18 13:22:35 +01:00
Yuri Roubinsky
36a82c8c69 Unify variable and array declarations in shaders 2022-01-18 12:42:39 +03:00
Aaron Franke
13939734e0
Replace String::num_real code with a wrapper around String::num 2022-01-15 00:21:49 -06:00
Aaron Franke
d9506cade1
Add tests for Vector2/Vector2i/Vector3/Vector3i 2022-01-14 01:59:55 -06:00
luz paz
858bcd5058 Fix various typos
Found via `codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,expct,fave,findn,gird,hist,inh,inout,leapyear,lod,nd,numer,ois,ony,paket,ro,seeked,sinc,switchs,te,uint,varn,vew`
2022-01-13 23:20:01 -05:00
bruvzg
baec983d8a
[TextServer] Improvements for line breaking, "Fill" alignment, overrun, and interaction between these modes.
Fix "Fill" alignment processing wrong side of the text if overrun trim was applied.
Improve "Fill" alignment to avoid adding excessive subsequent spaces or elongations.
Add font detection to the overrun, to correctly add ellipsis (was using last glyph font, which doesn't necessary have dot character).
Improve line breaking to avoid adding excessive subsequent soft break points for languages without word separator.
Port missing overrun/justification code to the Fallback text server.
Fix inferred text direction detection by controls.
Add tests for "Fill" alignment and line breaking glyph flags.
2022-01-13 08:53:28 +02:00
Rémi Verschelde
c6cefb1b79
Array: Relax slice bound checks to properly handle negative indices
The same is done for `Vector` (and thus `Packed*Array`).

`begin` and `end` can now take any value and will be clamped to
`[-size(), size()]`. Negative values are a shorthand for indexing the array
from the last element upward.

`end` is given a default `INT_MAX` value (which will be clamped to `size()`)
so that the `end` parameter can be omitted to go from `begin` to the max size
of the array.

This makes `slice` works similarly to numpy's and JavaScript's.
2022-01-10 22:42:03 +01:00
Haoyu Qiu
c0d3bdc0ca Add list initialization support for Vector & LocalVector 2022-01-05 20:42:09 +08:00
Rémi Verschelde
fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
luz paz
a124f1effe Fix various typos
Found via ` codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,expct,fave,findn,gird,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint,varn`
Update editor/import/resource_importer_layered_texture.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update doc/classes/TileSetScenesCollectionSource.xml

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/graph_edit.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/rich_text_label.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Revert previously committed change
2022-01-02 01:03:58 -05:00
cdemirer
e2ed9d13eb Fix Array and Dictionary id() and dictionary test bug 2021-12-30 13:14:09 +08:00
Yuri Roubinsky
e8a457ba89 Refactor render_mode in shaders, forbid declaring duplicates 2021-12-21 22:20:09 +03:00
Haoyu Qiu
e4e4e475f8 Make --doctool locale aware
* Adds `indent(str)` to `String`:
    * Indent the (multiline) string with the given indentation.
    * This method is added in order to keep the translated XML correctly
      indented.
* Moves the loading of tool/doc translation into
  `editor/editor_translation.{h,cpp}`.
    * This will be used from both `EditorSettings` and the doc tool from
      `main`.
* Makes use of doc translation when generating XML class references, and
  setup the translation locale based on `-l LOCALE` CLI parameter.

The XML class reference won't be translated if `-l LOCALE` parameter is
not given, or when it's `-l en`.
2021-12-16 17:49:22 +08:00
Nathan Franke
49403cbfa0
Replace String comparisons with "", String() to is_empty()
Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
2021-12-09 04:48:38 -06:00
Nathan Franke
41a20171eb
align to horizontal_alignment, valign to vertical_alignment, related 2021-12-09 01:38:46 -06:00
Yuri Roubinsky
76f6c0849c Make compile shader function to use struct instead long parameter list 2021-12-08 11:34:40 +03:00