Commit Graph

703 Commits

Author SHA1 Message Date
Rémi Verschelde
cb1d6140be
Merge pull request #90866 from Repiteo/core/variant-initalizer-lists
Core: Utilize initalizer lists in Variant constructors
2024-04-23 19:11:29 +02:00
Haoyu Qiu
941e5c4820 Use compatible text resource format when possible 2024-04-23 12:04:44 +08:00
A Thousand Ships
ec29c3e784
[Core] Fix property access on read-only Dictionary 2024-04-22 13:57:34 +02:00
Aaron Franke
b1f5e9fe3a
Rename internal is_ascii_char to is_ascii_alphabet_char 2024-04-20 02:36:41 -07:00
Thaddeus Crews
b95e7fcecd
Core: Integrate initalizer lists for Variant 2024-04-19 08:52:17 -05:00
A Thousand Ships
80cb914e06
[Core] Fix incorrect comparison for Array const iterator 2024-04-13 17:32:33 +02:00
Thaddeus Crews
127025679b
Core: Use <type_traits> where applicable 2024-04-11 13:13:59 -05:00
Rémi Verschelde
8764769ee8
Merge pull request #89186 from groud/save_byte_arrays_as_base64_encoded
Save PackedByteArrays as base64 encoded
2024-04-10 17:49:24 +02:00
A Thousand Ships
64146cb7f3
[Core] Add iteration support to Array 2024-04-10 14:49:34 +02:00
clayjohn
c0d0bdc160
Clarify bounce and reflect docs and update param names 2024-04-10 14:07:08 +02:00
David Snopek
927f2e1e53 Use likely() in PtrToArg<T *> when checking for null Object *s 2024-04-08 11:06:56 -05:00
kobewi
f0cbd388dc Ignore ERR_FILE_CANT_OPEN error when loading scene 2024-04-05 17:51:27 +02:00
Thaddeus Crews
bbb3eb3a1a
Update lingering do/while(0) defines 2024-04-04 14:17:22 -05:00
Thaddeus Crews
b0cda1f85f
Core: Use fixed-width integer types in Variant 2024-04-04 08:54:11 -05:00
Rémi Verschelde
9335b83a32
Merge pull request #87831 from Riteo/bitfield-xor
Core: Implement a XOR operator for BitField
2024-03-26 13:45:02 +01:00
A Thousand Ships
2cbf469912
Fix sorting of files/dirs in dialogs
Sorts leading `_` before other characters except `.`.
2024-03-20 13:45:47 +01:00
Rémi Verschelde
453485aede
Merge pull request #89270 from Repiteo/enforce-typename-in-templates
Enforce template syntax `typename` over `class`
2024-03-14 22:34:37 +01:00
Rémi Verschelde
a1c476f9d7
Merge pull request #87680 from AThousandShips/the_angry_count
Add methods to get argument count of methods
2024-03-13 22:16:43 +01:00
A Thousand Ships
400f438e72
Fix rpc call from name based Callables 2024-03-10 20:20:08 +01:00
A Thousand Ships
59bcc2888c
Add methods to get argument count of methods
Added to:
* `Callable`s
* `Object`s
* `ClassDB`
* `Script(Instance)`s
2024-03-10 11:02:43 +01:00
Thaddeus Crews
9903e6779b
Enforce template syntax typename over class 2024-03-07 22:39:09 -06:00
kobewi
eb0a624902 Allow returning Dictionary after merging 2024-03-06 14:49:35 +01:00
Gilles Roudière
de5073519e Save PackedByteArrays as base64 encoded 2024-03-06 10:17:31 +01:00
Rémi Verschelde
7434f8b4e3
Merge pull request #88959 from akien-mga/pre-commit-clang-17.0.6-black-24.2.0
Pre-commit: Update to clang-format 17.0.6 and black 24.2.0
2024-02-29 13:54:38 +01:00
Rémi Verschelde
9278856ff7
Merge pull request #88948 from dalexeev/core-add-callable-create
Core: Add `Callable.create` static method for `Variant` callables
2024-02-29 13:54:22 +01:00
Rémi Verschelde
1cc9190c70
Merge pull request #81822 from nlupugla/nodepath-slice
Add `NodePath::slice` method
2024-02-29 13:53:34 +01:00
Danil Alexeev
d90c9db27f
Core: Add Callable.create static method for Variant callables 2024-02-29 10:45:00 +03:00
Rémi Verschelde
3a08c646ee
Pre-commit: Update to clang-format 17.0.6 and black 24.2.0 2024-02-28 14:25:35 +01:00
Robert Yevdokimov
13e82094ee Remove word duplicates in comments and strings, and fix casing and punctuation 2024-02-23 17:28:28 -05:00
Aaron Franke
1a6cabc0bf
Make Callable bind method const 2024-02-22 00:14:02 -06:00
Muller-Castro
a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 -03:00
A Thousand Ships
684752e75b
Replace error checks against size with is_empty 2024-02-09 12:50:15 +01:00
Rémi Verschelde
deda5f799b
Merge pull request #87992 from allenwp/87991-typed-array-additions
Added newer Variant types to `typed_array.h`
2024-02-07 11:04:01 +01:00
Rémi Verschelde
dd2699be19
Merge pull request #67226 from Mickeon/typed-packing
Use `Packed*Array` over `Vector<T>` in TypedArray
2024-02-07 10:56:45 +01:00
Rémi Verschelde
b41403db71
Merge pull request #67220 from Mickeon/variant-packing
Use `Packed*Array` over `Vector<T>` in Variant
2024-02-07 10:56:21 +01:00
Micky
2c98783359 Use Packed*Array over Vector<T> in TypedArray
Same as #67220 but for `typed_array.h`
2024-02-06 20:50:02 +01:00
Micky
3edb671b8a Use Packed*Array over Vector<T> in Variant
Also shuffles some method definitions and declarations to be more consistent with the way the Variant types are ordered across the codebase.

And removes an unnecessary JSON assign (`JSON::stringify` can now be accessed statically)
2024-02-06 12:53:19 +01:00
Allen Pestaluky
f4134fd9b0 Added newer Variant types to typed_array.h
Fixes #87991
2024-02-05 16:37:11 -05:00
vittorioromeo
55ed34e37c Use '_v' shorthand for type traits and 'if constexpr' where appropriate 2024-02-02 15:43:21 +01:00
Riteo
7739940202 Core: Implement a XOR operator for BitField 2024-02-01 20:44:40 +01:00
Rémi Verschelde
fa48a51183
Merge pull request #87688 from AThousandShips/what_is_this
Remove unnecessary `this->` expressions
2024-01-29 13:18:09 +01:00
A Thousand Ships
15369fdb1d
Remove unnecessary this-> expressions 2024-01-29 09:59:18 +01:00
Mel Collins
8406e60522 Add InputEventKey.location to tell left from right
This adds a new enum `KeyLocation` and associated property
`InputEventKey.location`, which indicates the left/right location of key
events which may come from one of two physical keys, eg. Shift, Ctrl.

It also adds simulation of missing Shift KEYUP events for Windows.
When multiple Shifts are held down at the same time, Windows natively
only sends a KEYUP for the last one to be released.
2024-01-26 14:42:28 +01:00
Rémi Verschelde
0bcc0e92b3
Merge pull request #86730 from reduz/64-bit-cowdata
Promote CowData to 64 bits
2024-01-19 18:46:11 +01:00
Juan Linietsky
24fe0715b5 Promote CowData to 64 bits
Fixes a lot of bugs, please help me fill the list.
2024-01-19 17:41:10 +01:00
kobewi
0e8f90f4c8 Update deferred calls to use Callables 2024-01-09 16:11:47 +01:00
Muller-Castro
96a95cb974 Add const lvalue ref to container parameters 2024-01-05 14:49:57 -03:00
Rémi Verschelde
2bffa3cbc5
Merge pull request #82639 from golfinq/gdscript-improve-indexing-error
GDScript: Improve error messages for invalid indexing
2024-01-04 16:38:58 +01:00
Rémi Verschelde
18e9133d5a
Merge pull request #86364 from aaronfranke/basis-divide
Add and expose Basis/Transform2D/3D division by float operator
2024-01-04 14:26:16 +01:00
Rémi Verschelde
22e880ad20
Merge pull request #83163 from Chubercik/vectorXi_dist_methods
Implement `Vector2i/3i/4i` methods: `distance_to` and `distance_squared_to`
2024-01-03 09:58:36 +01:00
Rémi Verschelde
b5c6e870e8
Merge pull request #82264 from dalexeev/core-builtin-methods-as-callables
Core: Allow methods of built-in `Variant` types to be used as Callables
2024-01-02 18:05:05 +01:00
Aaron Franke
c77ae051d5
Add and expose Basis/Transform2D/3D division by float operator 2023-12-20 18:24:03 -06:00
Yuri Sizov
3a8524dd92
Merge pull request #83452 from RandomShaper/rd_common
Split `RenderingDevice` into API-agnostic and `RenderingDeviceDriver` parts
2023-12-20 20:09:18 +01:00
Aaron Franke
3f469ee485
Add PackedRealArray as an alias for Vector<real_t> 2023-12-18 11:37:43 -06:00
Aaron Franke
d48d3ea4eb
Rename VariantZeroAssigner to VariantDefaultInitializer
And the method zero() is now init()
2023-12-17 14:00:30 -06:00
Yuri Sizov
d02b368fd6 Merge pull request #78095 from aaronfranke/dict-get-or-set-default
Add a `get_or_add` method to Dictionary
2023-12-16 17:49:10 +01:00
Yuri Sizov
ca19d34bde Merge pull request #73896 from vnen/object-null-boolean-consistency
Make freed object different than null in comparison operators
2023-12-16 17:49:05 +01:00
Pedro J. Estébanez
fec76d0c22 BitField: allow chained set_flag(), make constructors constexpr 2023-12-15 13:14:59 +01:00
nlupugla
cd221c1816 Added NodePath::slice method. 2023-12-13 13:30:28 -05:00
Aaron Franke
437586bf31
Add a get_or_add method to Dictionary 2023-12-06 11:43:58 -06:00
kobewi
1de0415118 Don't abort loading when ext_resource is missing 2023-11-22 12:13:32 +01:00
Rémi Verschelde
6ae6cc0bf5
Merge pull request #84815 from TokageItLab/array-animation
Rework blending method in `Variant` animation for `Int`/`Array`/`String`
2023-11-16 14:52:00 +01:00
Silc Lizard (Tokage) Renew
80c9533810 Rework blending method in Variant animation for Int/Array/String 2023-11-16 21:37:18 +09:00
Alistair Leslie-Hughes
5b6f641e99 Fix sizeof usage for Variant pointers in alloca
Coverity report this as a non portable usage of sizeof
2023-11-16 07:13:14 +11:00
kobewi
275e9d7028 Keep Variant type after zero() 2023-11-08 12:13:36 +01:00
Danil Alexeev
b04263644c
Core: Allow methods of built-in Variant types to be used as Callables 2023-10-25 15:53:52 +03:00
Yuri Sizov
4952d37f4b Fix StringName leaks in VariantParser 2023-10-19 17:13:15 +02:00
Danil Alexeev
0c2202c56e
GDScript: Fix incorrect error message for utility functions 2023-10-16 14:09:57 +03:00
Jakub Marcowski
cb954c6bab Implement Vector2i/3i/4i methods: distance_to and distance_squared_to 2023-10-12 13:46:49 +02:00
Rémi Verschelde
a1d7c62df7
Merge pull request #83003 from AThousandShips/null_check_extra
Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable
2023-10-09 15:37:14 +02:00
Rémi Verschelde
35ede42d1d
Merge pull request #82695 from maiself/object-less-callables-fixes
Fixes to allow object-less callables throughout Godot
2023-10-09 15:32:38 +02:00
A Thousand Ships
f18aa00e85 Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-10-08 17:23:33 +02:00
Mai Lavelle
5e15586ec2 Fixes to allow object-less callables throughout Godot
This fixes #81887
2023-10-06 16:31:35 -04:00
Rémi Verschelde
a6a2d0d159
Merge pull request #82794 from dsnopek/gdextension-validated-call
GDExtension: Convert `validated_call()` to `ptrcall()` (rather than `call()`)
2023-10-06 16:50:57 +02:00
kobewi
09b30be86d Add vararg call() method to C++ Callable 2023-10-05 11:35:29 +02:00
David Snopek
55596eaac6 GDExtension: Convert validated_call() to ptrcall() (rather than call()) 2023-10-04 10:53:17 -05:00
Rémi Verschelde
5efbed51cc GDScript: Improve error messages for invalid indexing
These errors are very common when using an invalid property name
or calling on an object of the wrong type, and the previous message
was a bit cryptic for users.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
Co-authored-by: golfinq <golfinqz@gmail.com>
2023-10-02 14:23:11 -04:00
Jakub Janšta
74c937079c Add type_string() utility 2023-10-02 17:41:20 +02:00
Rémi Verschelde
e95b7e84a4
Merge pull request #80844 from dalexeev/fix-callable-expected-argc
Fix expected argument count for `Callable` call errors
2023-10-02 13:15:53 +02:00
etti
3a39de4e2f Add rotate_toward and angle_difference to GDScript and C# 2023-10-01 22:19:42 +02:00
Danil Alexeev
aff767ef07
Fix expected argument count for Callable call errors 2023-09-29 20:00:10 +03:00
Rémi Verschelde
737c308dcc
Merge pull request #74588 from puchik/float-variant-nan-inequality
Support numeric/binary hash comparison for floats derived from Variants (as well as existing semantic comparison)
2023-09-27 14:03:34 +02:00
Rémi Verschelde
3ec673085b
Merge pull request #79523 from aaronfranke/is-conformal
Add `is_conformal` method to Basis and Transform2D
2023-09-26 13:44:41 +02:00
Rémi Verschelde
7bb80b1525
Merge pull request #81741 from KoBeWi/vectoring_to_the_MAXXX
Add `Vector2/3/4i.MAX` and `MIN`
2023-09-17 14:47:52 +02:00
Rémi Verschelde
61df1deb61
Merge pull request #80075 from Bromeon/gdextension/optimize-ptrcalls
GDExtension: `PtrToArg::convert()` uses const-reference where possible
2023-09-17 14:46:13 +02:00
kobewi
adc930baee Add Vector2/3/4i.MAX and MIN 2023-09-16 21:52:13 +02:00
Aaron Franke
56806ffeed
Add is_conformal method to Basis and Transform2D 2023-09-13 17:20:30 -05:00
A Thousand Ships
893f889d74 [Core] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-11 19:45:49 +02:00
Aaron Franke
6f7eccc758
Add a type conversion method to Variant Utility and expose to scripting 2023-09-08 10:12:48 -05:00
Yuri Sizov
d8ff69d53c Extract ScriptInstance to simplify includes
This allows to include script_instance.h directly in the
generated gdvirtual.gen.inc, and remove excessive includes
from the codebase.

This should also allow Resource to use GDVIRTUAL macros,
which wasn't possible previously due to a circular dependency.
2023-09-06 22:54:38 +02:00
Daylily-Zeleen
67e1401891 Set builtin varrarg ptrcalls, called without arg. 2023-09-02 00:34:16 +08:00
Rémi Verschelde
bbdd1aaa38
Merge pull request #81131 from AThousandShips/callable_fix
Fix comparison of `Callable`s with binds
2023-09-01 16:02:35 +02:00
Jcrespo
528a76486c Add inverse hyperbolic functions asinh(), acosh() & atanh()
GDScript has the following built-in trigonometry functions:

- `sin()`
- `cos()`
- `tan()`
- `asin()`
- `acos()`
- `atan()`
- `atan()`
- `sinh()`
- `cosh()`
- `tanh()`

However, it lacks the hyperbolic arc (also known as inverse
hyperbolic) functions:

- `asinh()`
- `acosh()`
- `atanh()`

Implement them by just exposing the C++ Math library, but clamping
its values to the closest real defined value.
For the cosine, clamp input values lower than 1 to 1.
In the case of the tangent, where the limit value is infinite,
clamp it to -inf or +inf.

References #78377
Fixes godotengine/godot-proposals#7110
2023-09-01 01:27:56 +02:00
Arman Elgudzhyan
ee27254602 Support both semantic (by default) and numeric Variant hash comparison
Hash comparison for Variant continues to perform semantic/logical comparison with NaN's considered equal by default (to prevent #16114, #7354, #6947, #8081), but now optionally allows for numeric comparison that does not consider NaN's equal to support proper value comparison (for #72222)
2023-08-31 09:29:48 -07:00
A Thousand Ships
2caf5ae453 Fix comparison of Callables with binds 2023-08-29 16:10:14 +02:00
Danil Alexeev
5d689ad560
Core: Fix recursion level check for VariantWriter::write() with objects 2023-08-29 15:05:53 +03:00
George Marques
150b50cfcd
Make freed object different than null in comparison operators
This is so everything is consistent, as a freed object is not equivalent
to `null` in general. The booleanization of a freed object still returns
`false` to work as an easy check for validity of objects. Similarly, the
negation of a freed object returns `true`.

Also makes freed objects different from each other (if they are not the
same reference).
2023-08-21 10:45:26 -03:00
Thaddeus Crews
c82bdef2fc
Undefine typed array templates after use 2023-08-19 12:30:43 -05:00
Rémi Verschelde
1d70968e9a
Merge pull request #79370 from dalexeev/core-array-recursion-check
Core: Fix recursion level check for array stringification
2023-08-18 15:43:29 +02:00
Rémi Verschelde
20e24bd2bb
Merge pull request #78529 from Chaosus/string_reverse
Add `String.reverse` method
2023-08-16 16:53:40 +02:00