summaryrefslogtreecommitdiff
path: root/modules/mono/glue/GodotSharp
AgeCommit message (Collapse)Author
2022-08-31C#: Fix Vector4 in godot_variant and missing marshalingIgnacio Roldán Etcheverry
Vector4 and Vector4i were implemented incorrectly in godot_variant. They were also missing their respective Variant conversion callbacks (used for generic collections). Took the chance to remove unnecessary native calls for creating Variant from Vector4, as now it can be done from C# (which is faster).
2022-08-30Merge pull request #65061 from ↵Ignacio Roldán Etcheverry
paulloz/dotnet/fix-godot_variants-with-empty-type-field C#: Populate `Type` field on `godot_variant` created in managed
2022-08-30Add `String.to_{camel,pascal,snake}_case` methodsDanil Alexeev
2022-08-30C#: godot_variant should always have a valid typePaul Joannon
2022-08-29Merge pull request #64956 from raulsntos/dotnet/format-ciRémi Verschelde
Add `dotnet format` to CI to check C# style
2022-08-29Merge pull request #64900 from raulsntos/dotnet/fix-exceptionsIgnacio Roldán Etcheverry
Fix various C# exceptions
2022-08-28Merge pull request #64959 from raulsntos/dotnet/fix-malloc-sizeIgnacio Roldán Etcheverry
C#: Fix byteCount in `NativeMemory.Alloc`
2022-08-27C#: Fix byteCount in `NativeMemory.Alloc`Raul Santos
`NativeMemory.Alloc` takes the byte count as parameter, this is calculated by multiplying the element size in bytes by the length of the array.
2022-08-27C#: Add `CubicInterpolateAngle`Raul Santos
2022-08-27C#: Add `CubicInterpolateInTime`Raul Santos
2022-08-27C#: Rename and fix `Quaternion.SphericalCubicInterpolate`Raul Santos
2022-08-27C#: Fix `Quaternion.CubicSlerp`Raul Santos
2022-08-27C#: Add `Exp` and `Log` to QuaternionRaul Santos
2022-08-27C#: Add `GetAngle` and `GetAxis` to QuaternionRaul Santos
2022-08-27C#: Fix `Transform3D` interpolation and add spherical interpolationRaul Santos
2022-08-27C#: Add missing match check in `Quaternion.Slerpni`Raul Santos
2022-08-27Merge pull request #64942 from paulloz/cs-fix-color-namesRémi Verschelde
C#: Fix dictionary keys in Colors
2022-08-27Fix C# style with `dotnet format`Raul Santos
2022-08-26C#: Fix dictionary keys in ColorsPaul Joannon
2022-08-26Merge pull request #64367 from Mickeon/rename-var-to-strRémi Verschelde
Rename `str2var` to `str_to_var` and similar
2022-08-26Fix various C# exceptionsRaul Santos
- Replace `IndexOutOfRangeException` with `ArgumentOutOfRangeException` - Replace `Exception` with a more specific exception - Add the parameter name to argument exception - Update documentation for methods that throw exceptions - Use `StringBuilder` to build exception messages - Ensure exception messages end with a period
2022-08-26Rename `str2var` to `str_to_var` and similarMicky
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too. - `var2str` -> `var_to_str` - `str2var` -> `str_to_var` - `bytes2var` -> `bytes_to_var` - `bytes2var_with_objects` -> `bytes_to_var_with_objects` - `var2bytes` -> `var_to_bytes` - `var2bytes_with_objects` -> `var_to_bytes_with_objects` - `linear2db` -> `linear_to_db` - `db2linear` -> `db_to_linear` - `deg2rad` -> `deg_to_rad` - `rad2deg` -> `rad_to_deg` - `dict2inst` -> `dict_to_inst` - `inst2dict` -> `inst_to_dict`
2022-08-26Merge pull request #64901 from raulsntos/dotnet/equalsIgnacio Roldán Etcheverry
C#: Use pattern matching to simplify `Equals`
2022-08-26Remove `[Signal]` attribute from eventsRaul Santos
- Remove event as a valid target of `SignalAttribute` - Stop adding the `[Signal]` attribute to events in bindings_generator - Make bindings_generator use the `EventHandler` suffix to be consistent with the C# source generator - Remove obsolete comment about the signal's delegate name
2022-08-25Various C# documentation improvementsRaul Santos
Fixes wrong/invalid documentation and add documentation to some OS members.
2022-08-25Merge pull request #64731 from raulsntos/dotnet6-variant-generics-analyzerRémi Verschelde
C#: Add `MustBeVariant` attribute and analyzer
2022-08-25Merge pull request #64781 from raulsntos/csharp_childrenRémi Verschelde
Add `includeInternal` to C# NodeExtensions and avoid printing errors in `GetChildOrNull`
2022-08-25Add MustBeVariant attribute and analyzerRaul Santos
- MustBeVariant attribute can be used to enforce that generic types must be a marshable from/to Variant. - Also renames all diagnostic ids to be valid unicode identifiers.
2022-08-24Merge pull request #64742 from zaevi/csharp_add_grouping_attributesIgnacio Roldán Etcheverry
C#: Add grouping attributes for properties.
2022-08-24Use pattern matching to simplify `Equals`Raul Santos
- Simplify and unify `Equals` implementation of C# struct types - Also add pattern matching to replace a cast in `DebuggingUtils`
2022-08-24Update C# named colors to use HEX codesRaul Santos
2022-08-24Avoid printing an error in GetChildOrNullRaul Santos
`GetChildOrNull` won't print an error when the given index is out of range, similar to how the LINQ `ElementAtOrDefault` method works.
2022-08-24Merge pull request #64727 from raulsntos/csharp-remove-ctorsIgnacio Roldán Etcheverry
Remove copy constructors in C# structs
2022-08-24Merge pull request #64773 from raulsntos/dotnet6-🦭Ignacio Roldán Etcheverry
C#: Seal classes that can't be inherited from
2022-08-23Add `includeInternal` to C# NodeExtensions and fix get_child documentationRaul Santos
Node methods in C# extended to use generics now have the optional parameter `includeInternal` like their non-generic equivalents. Also, fixed a typo in the `Node.get_child` documentation.
2022-08-23Seal classes that can't be inherited fromRaul Santos
2022-08-23Merge pull request #64762 from neikeq/csharp-dangling-callable-codeRémi Verschelde
2022-08-23C#: Remove old Callable code left dangling after switch to .NET 6Ignacio Roldán Etcheverry
2022-08-22C#: Replace `Xform` and `XformInv` with `*` operatorRaul Santos
- In cases where both `Xform`/`XformInv` and the `*` operator were implemented the `Xform`/`XformInv` methods were removed in favor of the `*` operator. - In cases where the `Xform`/`XformInv` existed but not the `*` operator, the `Xform`/`XformInv` methods were replaced with the `*` operator. - In cases where no method existed, a new `*` operator has been implemented to support the same operations that are supported in GDScript. - Fixes the `Transform.Xform` and `Transform.XformInv` with `Rect2` implementation to use a zero `Rect2` size to start expanding from (which is how it's implemented in C++).
2022-08-23C#: Add grouping attributes for properties.Zae
2022-08-22Remove copy constructors in C# structsRaul Santos
2022-08-22C#: Replace P/Invoke with delegate pointersIgnacio Roldán Etcheverry
- Moves interop functions to UnmanagedCallbacks struct that contains the function pointers and is passed to C#. - Implements UnmanagedCallbacksGenerator, a C# source generator that generates the UnmanagedCallbacks struct in C# and the body for the NativeFuncs methods (their implementation just calls the function pointer in the UnmanagedCallbacks). The generated methods are needed because .NET pins byref parameters of native calls, even if they are 'ref struct's, which don't need pinning. The generated methods use `Unsafe.AsPointer` so that we can benefit from byref parameters without suffering overhead of pinning. Co-authored-by: Raul Santos <raulsntos@gmail.com>
2022-08-22C#: Remove IL post-processor build dependencyIgnacio Roldán Etcheverry
We were using it to workaround a limitation of `Unsafe.AsPointer` and `ref struct`s. However, we can get the same result with some tricks, since we have control over the declaration of these structs.
2022-08-22C#: Re-introduce generic Godot Array and DictionaryIgnacio Roldán Etcheverry
This new version does not support the following type arguments: - Generic types - Array of Godot Object (Godot.Object[]) or derived types The new implementation uses delegate pointers to call the Variant conversion methods. We do type checking only once in the static constructor to get the conversion delegates. Now, we no longer need to do type checking every time, and we no longer have to box value types. This is the best implementation I could come up with, as C# generics don't support anything similar to C++ template specializations.
2022-08-22C#: Array, Dictionary and marshaling refactoringIgnacio Roldán Etcheverry
- Array and Dictionary now store `Variant` instead of `System.Object`. - Removed generic Array and Dictionary. They cause too much issues, heavily relying on reflection and very limited by the lack of a generic specialization. - Removed support for non-Godot collections. Support for them also relied heavily on reflection for marshaling. Support for them will likely be re-introduced in the future, but it will have to rely on source generators instead of reflection. - Reduced our use of reflection. The remaining usages will be moved to source generators soon. The only usage that I'm not sure yet how to replace is dynamic invocation of delegates.
2022-08-22C#: Add dedicated Variant struct, replacing System.ObjectIgnacio Roldán Etcheverry
2022-08-22C#: Add source generator for method listIgnacio Roldán Etcheverry
2022-08-22C#: Add source generator for signals as eventsIgnacio Roldán Etcheverry
Changed the signal declaration signal to: ``` // The following generates a MySignal event [Signal] public delegate void MySignalEventHandler(int param); ```
2022-08-22C#: Refactor Array & Dictionary interface implementationsIgnacio Roldán Etcheverry
2022-08-22C#: Re-implement assembly reloading with ALCsIgnacio Roldán Etcheverry