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 Callable
s 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
Jan Haller
38334fdc11
PtrToArg::convert() returns const-references where possible, avoids unnecessary copies
2023-08-07 20:40:23 +02:00
Rémi Verschelde
4ed08409b0
Merge pull request #78108 from aaronfranke/variant-util-header
...
Make a header for VariantUtilityFunctions
2023-08-03 14:46:29 +02:00
Joseph Davies
510de82f43
Fix typo in modulo error message.
2023-08-01 04:47:18 -07:00
Yuri Sizov
3d04a22d7c
Merge pull request #79103 from AThousandShips/array_slice_range
...
Fix range error for `Array.slice`
2023-07-17 16:48:48 +02:00
Danil Alexeev
bb40bd9aaa
Core: Fix recursion level check for array stringification
2023-07-12 14:59:44 +03:00
Rémi Verschelde
0c1442f82a
Merge pull request #78551 from AThousandShips/call_rpc
...
Fix `rpc` calls with binds
2023-07-08 18:15:41 +02:00
Ninni Pipping
7752a0d8d1
Fix range error for Array.slice
2023-07-07 23:19:42 +02:00
Gabor Koncz
a2ede8c4da
Fix GDVIRTUAL_NATIVE_PTR
...
This commit fixes the usage of GDExtensionPtr and GDExtensionConstPtr
in GDExtension by introducing the required VariantInternalAccessor
specializations.
Sponsored by Migeran (https://migeran.com )
2023-07-03 10:52:02 +02:00
Ninni Pipping
9159208ed1
Ensure RID
, Callable
, and Signal
are stored as strings
...
Prevents parser errors in `.tscn` and `.tres` files where the assignment
would otherwise be empty.
2023-06-22 17:01:08 +02:00
Ninni Pipping
7d174c8dfe
Fix rpc
calls with binds
2023-06-22 11:07:53 +02:00
Yuri Roubinski
230385b587
Add String.reverse
method
2023-06-21 20:40:48 +03:00
Rémi Verschelde
248e5245e4
Merge pull request #73540 from mashumafi/fix-typed-array-add
...
Fix: Typed arrays aren't working with +
2023-06-20 15:12:39 +02:00
Rémi Verschelde
867ea7fe59
Merge pull request #74730 from MarioLiebisch/fix-74726
...
Fix read-only dictionaries adding missing keys
2023-06-19 21:38:38 +02:00
Rémi Verschelde
b8bf28e2b6
Merge pull request #75758 from Pylgos/fix-gdextension-variant-construction
...
Fix GDExtension Variant type conversion
2023-06-19 10:27:20 +02:00
Rémi Verschelde
1a62f1e4fc
Merge pull request #74741 from vnen/variant-not-for-everyone
...
Allow boolean operators for all Variant types
2023-06-18 16:28:10 +02:00
Aaron Franke
7e9b5e59d4
Make a header for VariantUtilityFunctions
2023-06-12 11:29:42 -05:00
Aaron Franke
5654d40367
Don't use a const reference for the enum constructor in Variant
2023-06-11 15:13:05 -05:00
Pylgos
d7eb7108f0
Fix gdextension variant type conversion
2023-06-10 10:52:17 +09:00
David Snopek
77733faede
Attempt to standardize Object ptrcall encoding on Object **
2023-05-25 21:46:22 -05:00
Juan Linietsky
5fdc1232ef
Add the ability to look-at in model-space.
...
This is a much simpler attempt to solve the same problem as #76060 , but without breaking any compatibility.
* Adds a description of what model space is in the Vector3 enums (MODEL_* constants). This has the proper axes laid out for imported 3D assets.
* Adds the option to `look_at` using model_space, which uses Vector3.MODEL_FRONT as forward vector.
The attempt of this PR is to still break the assumption that there is a single direction of forward (which is not the case in Godot)
and make it easier to understand where 3D models are facing, as well as orienting them via look_at.
2023-05-24 10:10:24 +09:00
Emmanuel Leblond
e785dd9dd9
Improve user-friendliness of "return value as function param" pattern in GDExtension API
...
This commit introduce separate types (e.g. GDNativeStringPtr vs GDNativeUninitializedStringPtr)
depending on if the pointed data is already initialized (C++ style where constructor is alway
called when create a variable even if it is to be passed as return value) or not (C style).
On top of that, small changes has been made to `GDNativeInterface` so that it methods are
consistent on using uninitialized return value.
2023-05-15 17:14:57 +02:00
clayjohn
f83a90192f
Revert "Add API for HSL conversion"
...
This reverts commit 0b7fd664c1
.
2023-05-10 17:45:56 -03:00
Rémi Verschelde
0f444f101a
Merge pull request #76661 from bonjorno7/hsl
...
Add API for HSL conversion
2023-05-09 19:28:35 +02:00
Rémi Verschelde
5ade250c7d
Merge pull request #76735 from AThousandShips/natural_cmp
...
Add `naturalcasecmp_to` function to `String`
2023-05-09 17:44:37 +02:00