Commit graph

728 commits

Author SHA1 Message Date
Raul Santos 509d4f5302
C#: Fix ExprMatch for case sensitive matching
We were accidentally stopping the recursion when matching in the case sensitive scenario.

Took the opportunity to also rename the private method to follow the Core method naming more closely so it's easier to compare the implementations in the future.

Also, the private method now uses `ReadOnlySpan<char>` to avoid allocating strings on each recursion.
2024-04-15 03:15:28 +02:00
Rémi Verschelde 368d6db6cc
Merge pull request #90060 from warquys/CSharp-DebugInfo
Add DebugView for Array and Dictionary, based of the DebugView from the .NET Foundation
2024-04-08 11:20:46 +02:00
Valentin Arthur Thomas f8c482b19a DebugView for Array and dictionary 2024-04-05 19:55:37 +02:00
Paul Joannon c310ecce13
Fix captured variable serialization in delegates 2024-04-04 18:46:11 +02:00
Rémi Verschelde c196d12e23
Merge pull request #84947 from raulsntos/dotnet/instance_bindings
C#: Use `get_instance_binding` instead of set
2024-04-04 14:30:35 +02:00
kleonc e2ed63b313 [C#] Fix Transform3D.InterpolateWith applying rotation before scale 2024-03-24 09:31:20 +01:00
Rémi Verschelde 3895639f72
Merge pull request #89756 from zaevi/dotnet/fix_null_array
C#: Fix errors when creating `Variant` from null array
2024-03-24 01:23:18 +01:00
Zae 833a03fbf6 C#: Fix errors when creating Variant from null array 2024-03-21 23:55:44 +08:00
Thaddeus Crews 300aa202c8
C#: Implement InvariantCulture on Variant strings 2024-03-15 19:43:00 -05: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
Paul Joannon 7290e7d7a5
C#: Fix warnings
- Fix most CS0108 in generated glue
- Suppress CA1001 on `Variant`
2024-03-09 17:05:23 +01:00
A Thousand Ships 5aadb8660b
[C#] Fix typo in Color documentation 2024-03-02 18:13:01 +01:00
Rémi Verschelde f2045ba822
Merge pull request #88933 from raulsntos/dotnet/pre-commit
Move dotnet-format script to pre-commit
2024-03-02 10:48:25 +01:00
Raul Santos 97851f0340
Move dotnet-format script to pre-commit
Co-authored-by: Paul Joannon <437025+paulloz@users.noreply.github.com>
2024-03-02 08:25:48 +01:00
Travis Lange 09c6cb1250 Fix C# epsilon compiler error on double precision build 2024-02-29 08:25:37 -05:00
Rémi Verschelde ed2ff19cd7
Merge pull request #88909 from emre0altan/clarify-c#-color-opacity-comment
Clarify C# Color opacity comment
2024-02-27 21:23:07 +01:00
Paul Joannon 139a5df821
Cleanup C# projects, code quality & style
New rules:
- Do not silence CA1805 any more
- Limit where we silence CA1707, CA1711, CA1720
- Enforce severity=warning for IDE0040
- Enforce Allman style braces
- Enforce naming conventions (IDE1006 is still severity=suggestion)

Fixes:
- Fix REFL045, CS1572, CS1573
- Suppress CS0618 when generating `InvokeGodotClassMethod`
- Fix indent when generating GD_constants.cs
- Temporarily silence CS1734 in generated code
- Fix a lot of naming rule violations

Misc.:
- Remove ReSharper comments for RedundantNameQualifier
- Remove suppression attributes for RedundantNameQualifier
- Remove severity=warnings for CA1716, CA1304 (already included in the level of analysis we run)
2024-02-27 20:11:24 +01:00
emre0altan 4100a23c5e Clarify C# Color opacity comment 2024-02-27 15:56:21 +00:00
Rémi Verschelde 9509a9e8dd
Merge pull request #83691 from theraot/slidedocs
Expanded documentation for vector slide and project
2024-02-26 10:48:37 +01:00
Raul Santos 5ba92e5a57
Fix some DEFVALs to use the right type
- Use `StringName()` in DEFVAL for StringNames.
- Use `Variant()` in DEFVAL for Variants.
2024-02-23 01:50:18 +01:00
Thaddeus Crews 000d12d237
C#: Enforce Globalization code quality rules 2024-02-20 11:15:12 -06:00
Rémi Verschelde dfe226b933
Merge pull request #88270 from TokageItLab/avoid-near-far
Avoid unqualified-id "near" and "far" in Node3DEditor/Viewport
2024-02-13 11:25:24 +01:00
Silc Lizard (Tokage) Renew 67e38709fd Avoid unqualified-id "near" and "far" in Node3DEditor/Viewport 2024-02-13 18:53:21 +09:00
Zae 8245157682 C#: Fix missing CowData 64-bit promotion for PackedInt32Array. 2024-02-13 12:19:48 +08:00
Raul Santos 5815d1c8c8
Improve handling of generic C# types
- Create CSharpScript for generic C# types.
  - `ScriptPathAttributeGenerator` registers the path for the generic type definition.
  - `ScriptManagerBridge` lookup uses the generic type definition that was registered by the generator.
  - Constructed generic types use a virtual `csharp://` path so they can be registered in the map and loaded as if there was a different file for each constructed type, even though they all share the same real path.
  - This allows getting the base type for a C# type that derives from a generic type.
- Shows base scripts in the _Add Node_ and _Create Resource_ dialogs even when they are generic types.
  - `get_global_class_name` implementation was moved to C# and now always returns the base type even if the script is not a global class (this behavior matches GDScript).
- Create `CSharpScript::TypeInfo` struct to hold all the type information about the C# type that corresponds to the `CSharpScript`, and use it as the parameter in `UpdateScriptClassInfo` to avoid adding more parameters.
2024-02-08 18:31:13 +01:00
Rémi Verschelde d0f8b76ffd
Merge pull request #87838 from paulloz/dotnet/fix-duplicate-key-on-reload
C#: Fix duplicate key issue on reload
2024-02-02 12:05:14 +01:00
Paul Joannon 999180d5b5
Delay fs update when populating path bimap 2024-02-01 22:06:40 +01:00
Zae 1e14503715 C#: Fix issues for StringName reference in CSharpInstanceBridge.Get. 2024-01-29 02:04:02 +08:00
Rémi Verschelde 563e385810
Merge pull request #87526 from zaevi/fix_csharp_gc
C#: Fix incorrect GC handle for non-instantiable types.
2024-01-26 11:47:25 +01:00
Paul Joannon 46b3096570
Clean a bunch of C# warnings
- `[Obsolete]` tag generated in the middle of documentation comments
- Potential `null` values in generators
- Obsolete call to `GetEditorInterface()`
- We don't want `Godot.Collections.Array` to end with `Collection`
- A few culture specifications and use of `AsSpan` instead of `SubString` in `StringExtensions`
- Disable CA1716 in GodotSharp
2024-01-26 09:38:33 +01:00
Zae 201e946741 C#: Fix incorrect GC handle for non-instantiable types. 2024-01-25 02:40:08 +08: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
Yuri Sizov b6a2c78033 Merge pull request #87286 from akien-mga/fix-preprocessor-if-ENABLED-checks
Fix `#if *_ENABLED` inconsistencies, should check if defined
2024-01-17 18:53:33 +01:00
Rémi Verschelde 0a7579b161
Fix #if *_ENABLED inconsistencies, should check if defined
Co-authored-by: Caroline Joy Bell <halotroop2288@proton.me>
2024-01-17 10:30:15 +01:00
A Thousand Ships 227a165ce4
[C#] Fix Encloses failing on shared upper bound for AABB and
`Rect2(I)`
2024-01-16 20:20:53 +01:00
Zae 51c54b03d1 C#: Fix return type hint for methods. 2024-01-09 04:28:17 +08: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
Raul Santos abd7927325
C#: Use string literal instead of nameof
Using `nameof` expressions with method parameters requires C# 11 and we're currently on C# 10.
2023-12-21 03:11:47 +01:00
Yuri Sizov ef79e5d9dd Merge pull request #82983 from Repiteo/c#-godotsharp-nullable-classes
[C#] Enable nullability for variant classes
2023-12-19 20:32:30 +01:00
Yuri Sizov f478a599fc Merge pull request #85975 from Repiteo/c#-null-ptr-exception
C#: Implement function to throw on null pointers
2023-12-19 13:02:24 +01:00
Thaddeus Crews a0db88335a
Implement function to throw on null pointers
• Specifically: checks if ptr == IntPtr.Zero
2023-12-17 08:52:20 -06:00
Thaddeus Crews 08e44123cb
[C#] Enable nullability for variant classes 2023-12-09 12:42:10 -06:00
Thaddeus Crews db7a643e1c
[C#] Enable nullability for variant structs 2023-12-09 12:41:53 -06:00
Rémi Verschelde d76c1d0e51
Bump version to 4.3-dev
The essential doesn't change.

-- Samuel Beckett, Waiting for Godot
2023-11-29 23:00:27 +01:00
Raul Santos a351c4bbe3
C#: Use get_instance_binding instead of set 2023-11-15 21:06:13 +01:00
Rémi Verschelde 313bffc205
Merge pull request #83357 from raulsntos/dotnet/ConvertCallableToNative(default)
C#: Fix converting default Callables to native
2023-11-10 21:55:22 +01:00
A Thousand Ships 668761fa8e Rename Vector2/3/4I.Min/Max to MinValue/MaxValue
More consistent with the `Mathf` constants they reference
2023-11-09 14:16:53 +01:00
Theraot 8777c05817 Expanded documentation for vector slide and project 2023-10-23 06:16:07 -05:00
Rémi Verschelde 49f492d54b
Merge pull request #83532 from raulsntos/dotnet/nested-class-generation
C#: Fix generated nested class order
2023-10-18 16:54:58 +02:00