Commit Graph

724 Commits

Author SHA1 Message Date
Thaddeus Crews
cc6ee3e956
Merge pull request #98713 from dalexeev/core-fix-callable-get-bound-arguments
Core: Fix `Callable.get_bound_arguments{,_count}()` return incorrect data
2024-11-12 12:13:04 -06:00
Thaddeus Crews
f233d186ef
Merge pull request #93885 from dalexeev/core-fix-freed-object-booleanization
Core: Fix `Freed Object` booleanization
2024-11-11 14:18:18 -06:00
Thaddeus Crews
30d87229ed
Merge pull request #82845 from Hysterelius/master
Color: Expose OKHSL properties
2024-11-11 14:18:04 -06:00
Hysterelius
2126df2dfd
Color: Expose OKHSL properties 2024-11-11 20:41:57 +01:00
Stanislav Labzyuk
824ddeea3f Fix comparison of callables 2024-11-11 17:15:52 +01:00
Danil Alexeev
e379cc76e5
Core: Fix Callable.get_bound_arguments{,_count}() return incorrect data 2024-11-04 22:41:56 +03:00
Thaddeus Crews
89a311205f
Style: Apply clang-tidy fixes
• `modernize-use-default-member-init` and `readability-redundant-member-init`
• Minor adjustments to `.clang-tidy` to improve syntax & remove redundancies
2024-11-04 12:11:06 -06:00
Thaddeus Crews
363c0b5fec
Merge pull request #47502 from KoBeWi/add_0
Always add decimal when converting float to string
2024-10-31 20:14:39 -05:00
A Thousand Ships
38f9769bc6
[Core] Improve error messages with vformat 2024-10-30 15:55:51 +01:00
Clay John
b4ba0f983a
Merge pull request #98363 from dustdfg/rid_in_operator_fix
Allow using RID with `in` operator for Arrays and Dictionaries
2024-10-24 19:04:41 -07:00
kobewi
5c0f2414cd Always add decimal when printing float 2024-10-23 15:00:21 +02:00
Yevhen Babiichuk (DustDFG)
ee5d90853f Allow use RID with in operator for Arrays and Dictionaries
Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
2024-10-21 11:50:41 +03:00
A Thousand Ships
79f654ced5
[Core] Fix sorting of Dictionary keys
`StringName` keys were sorted as `StringName` which is unstable.
2024-10-18 08:47:05 +02:00
Aaron Franke
a7f6ec0e4c
Add a sort method to Dictionary and HashMap 2024-10-02 14:26:33 -07:00
Rémi Verschelde
9ce149c7a3
Merge pull request #93299 from rune-scape/fix-ref
Fix RefCounted releasing early and not clearing reference
2024-10-02 15:00:47 +02:00
Aaron Franke
cc9f2b58a0
Bind Array get and set functions 2024-09-26 13:00:17 -07:00
Rémi Verschelde
9d5b59b2ae
Merge pull request #94864 from rune-scape/add-missing-method-bind
Add missing CallableCustomMethodPointer for const methods
2024-09-26 12:45:27 +02:00
Thaddeus Crews
9f9ee0c813
SCons: Add unobtrusive type hints in SCons files 2024-09-25 09:34:35 -05:00
rune-scape
a84c480049 Add missing CallableCustomMethodPointer for const methods 2024-09-23 11:46:10 -07:00
Rémi Verschelde
1b19ecb360
Merge pull request #95166 from aaronp64/variant_op_err_return
Assign return value on `Variant` operator failure
2024-09-23 12:27:51 +02:00
rune-scape
cee0e6667a Refactor ref-counting code and fix ref counted releasing before aquiring 2024-09-21 11:36:58 -07:00
A Thousand Ships
203d3be200
[Core] Add way to check if a signal has any connections
Added to `Object` and `Signal`
2024-09-20 16:39:09 +02:00
Rémi Verschelde
6bf8a3e3f8
Merge pull request #95449 from SlashScreen/array_functions
Add callable support for `find` and `rfind` `Array` methods
2024-09-20 16:06:13 +02:00
aaronp64
714357e55c Assign return value on Variant operator failure
Variant operators for String formatting and "in" could result in errors, which would return from validated_evaluate without assigning r_ret.  This would cause scripts using the return value from these operators to get results from previously run code.  Updated to return the original String value in the String formatting case, and false for "in" when an error occurs.
2024-09-19 11:22:35 -04:00
Slashscreen
89491f4403 Add callable support for find and rfind Array methods 2024-09-13 00:01:53 -07:00
Thaddeus Crews
b3d7960df4
Core: Fix operator[] for typed dictionaries 2024-09-12 11:10:17 -05:00
Rémi Verschelde
60ffa9645a
Merge pull request #96864 from KoBeWi/dictionerrory
Fix `Dictionary.merge()` type validation
2024-09-12 09:25:42 +02:00
Rémi Verschelde
f8fbb860f5
Merge pull request #95840 from raulsntos/char_metadata
Add metadata for `char16_t` and `char32_t`
2024-09-12 09:25:19 +02:00
Raul Santos
aaffab8afb
Add metadata for char16_t and char32_t
We don't seem to expose any API that uses `char16_t` yet, but I added it anyway since we make the type info for it.

I didn't add anything for `wchar_t` because we are not making a type info so maybe we don't have a need for it yet, it could be added in the future.

To prevent breaking compatibility with the C# bindings, we ignore the `char32_t` metadata and still use `System.Int64`.
2024-09-12 02:15:55 +02:00
Hilderin
27d1fb63e1 Fix Unable to use ResourceLoader in C# after threaded load in GDScript #92798 2024-09-11 19:03:55 -04:00
kobewi
48d5b8a8b8 Fix Dictionary.merge() type validation 2024-09-11 17:22:49 +02:00
Rémi Verschelde
0b4ae20156
Merge pull request #78656 from Repiteo/typed-dictionary
Implement typed dictionaries
2024-09-06 22:38:13 +02:00
Rémi Verschelde
4629f7d040
Merge pull request #96496 from aXu-AP/lerp-transform
Add support for Transform2D/3D in `lerp()`
2024-09-05 17:44:11 +02:00
Thaddeus Crews
9853a69144
Implement typed dictionaries 2024-09-04 10:27:26 -05:00
Rémi Verschelde
13a90e938f
Merge pull request #70096 from rune-scape/stringname-dict
StringName Dictionary keys
2024-09-03 17:38:06 +02:00
aXu-AP
7218dd6a3a Add support for Transform2D/3D in lerp()
Implements godotengine/godot-proposals#10579
2024-09-03 16:59:15 +03:00
Danil Alexeev
49bcdf78a7
Core: Сheck r_error after calling callp() 2024-08-30 21:09:30 +03:00
rune-scape
154049ce17 StringName Dictionary keys
also added 'is_string()' method to Variant
and refactored many String type comparisons to use it instead
2024-08-29 13:39:27 -07:00
Rémi Verschelde
622393c115
Merge pull request #95317 from esainane/when-i-am-64
binder_common: Fix uninitialized marshalling for `PtrToArg<char32_t>`
2024-08-28 17:15:05 +02:00
Rémi Verschelde
71accb9008
Merge pull request #94679 from rune-scape/remove-unused-initialize_ref
Remove unused `initialize_ref`
2024-08-28 00:12:16 +02:00
Haoyu Qiu
8bf4ecc026 Add String.is_valid_unicode_identifier()
- Adds `is_valid_unicode_identifier()`
- Adds `is_valid_ascii_identifier()`
- Deprecates `is_valid_identifier()`
- Renames `validate_identifier()` to `validate_ascii_identifier()`
2024-08-27 11:34:08 +08:00
Aaron Franke
7db24a9ad5
Simplify and fix Rect2/AABB get_support function 2024-08-19 23:55:31 -07:00
Sai Nane
e6a7c63125 binder_common: Fix uninitialized marshalling
C# uses `long`s to access many native values. With `PtrToArg<m_enum>` and
`PtrToArg<bitfield<m_enum>>` this isn't a problem, as C++ code converts
through a `*(int64_t*)` cast in assignment, so all 64-bits are initialized.

However, with `PtrToArg<char32_t>`, value assignment happens through an
`*(int *)` cast, leaving 32 bits uninitialized where `int` is 32 bits. On
platforms where `int` is 16 bits, there are presumably 48 bits uninitialized,
though there are very few platforms where this is still the case.

The easiest way to see the practical effects of this is by looking at
`EventInputKey.Unicode`:

```csharp
    public override void _Input(InputEvent @event) {
        if (@event is InputEventKey keyEvent) {
            if (keyEvent.IsPressed() && !keyEvent.Echo) {
                var raw = keyEvent.Unicode;
                var value = raw & 0xffffffff;
                GD.Print($"Key pressed: raw: {raw}; masked: {(char) value} ({value})");
            }
        }
    }
```

Pressing 'a' emits the following line:
```
Key pressed: raw: -3617008645356650399; masked: a (97)
```

Examining execution flow in gdb shows this conversion going through the
following line:
```
PtrToArg<char32_t>::encode (p_ptr=0x7ffcd5bb4b18, p_val=97 U'a') at ./core/variant/binder_common.h:221
221			*(int *)p_ptr = p_val;
```

Here, `p_val` is still 97, which is the value `InputEventKey.Unicode`
is expected to have. After assignment, `p *(int64_t *)0x7ffcd5bb4b18` displays
`-3617008645356650399`, with only the lower 32 bits being properly assigned,
and is the value we see from C#.

With this patch applied, the above testing `_Input` now prints:
```
Key pressed: raw: 97; masked: a (97)
```

Thank you to blujay1269 for asking about an unexpected value they saw in
`EventInputKey.Unicode`, which prompted this investigation.
2024-08-09 05:15:54 +00:00
A Thousand Ships
8f3e2c96eb
[Core] Fix Variant::construct of Object
Variant type was not updated correctly causing leaks in ref-counted
2024-07-25 12:25:29 +02:00
Rémi Verschelde
496b7b8482
Core: Improve vformat error reporting on sprintf failure
And fix a few occurrences of formatting errors that led me to this.
2024-07-04 10:54:55 +02:00
rune-scape
c8b697c64c Remove unused initialize_ref 2024-07-03 13:32:50 -07:00
Danil Alexeev
68481b6cdb
Core: Fix Freed Object booleanization 2024-07-03 09:49:47 +03:00
Rémi Verschelde
152d7c1bba
Revert "Make freed object different than null in comparison operators"
This reverts commit 150b50cfcd.

As discussed with the GDScript team, this has some implications which aren't
fully consensual yet, and which we want to revisit.

For now we revert to the 4.2 behavior for the 4.3 release, to avoid breaking
user expectations.
2024-07-01 14:11:43 +02:00
Rémi Verschelde
3d8562d775
Merge pull request #89197 from AThousandShips/arr_typed_fix
[Core] Fix sharing of typed arrays from constructor
2024-06-26 18:15:09 +02:00
bruvzg
e651421905
[TextServer, GDExtension] Fix building text servers as GDExtension, expose new/changed low-level methods to GDExtension API. 2024-06-12 19:30:19 +03:00