summaryrefslogtreecommitdiff
path: root/modules/mono/glue
AgeCommit message (Collapse)Author
2023-01-15Merge pull request #71374 from ↵Rémi Verschelde
raulsntos/dotnet/remove-spherical_interpolate_with C#: Remove `SphericalInterpolateWith` from Transform3D
2023-01-15Merge pull request #71423 from ↵Rémi Verschelde
raulsntos/dotnet/intersects-without-include_borders C#: Remove `includeBorders` parameter from `Rect2i.Intersects` and `AABB.Intersects`
2023-01-14C#: Sync `Basis` with CoreRaul Santos
- Remove `GetOrthogonalIndex` method (moved to `GridMap`). - Remove `GetRow` and `SetRow` methods.
2023-01-14C#: Remove `includeBorders` parameter from `Rect2i.Intersects` and ↵Raul Santos
`AABB.Intersects`
2023-01-14C#: Remove `SphericalInterpolateWith` from Transform3DRaul Santos
2023-01-13Merge pull request #71339 from raulsntos/dotnet/is_finiteYuri Sizov
Add `IsFinite` to C# Variants
2023-01-13Add `IsZeroApprox` to C# vectorsRaul Santos
2023-01-13Add `IsFinite` to C# VariantsRaul Santos
2023-01-11Improve description of `GetNodeOrDefault` in C# APIGuillermo
Indenting with spaces and added a line break Co-authored-by: Raul Santos <raulsntos@gmail.com>
2023-01-06Merge pull request #70547 from TokageItLab/pingpong-wrapRémi Verschelde
Fix pingpong-loop with `loop_wrap` is not working & clean-up cubic interpolation key retrieve process
2023-01-05One Copyright Update to rule them allRémi Verschelde
As many open source projects have started doing it, we're removing the current year from the copyright notice, so that we don't need to bump it every year. It seems like only the first year of publication is technically relevant for copyright notices, and even that seems to be something that many companies stopped listing altogether (in a version controlled codebase, the commits are a much better source of date of publication than a hardcoded copyright statement). We also now list Godot Engine contributors first as we're collectively the current maintainers of the project, and we clarify that the "exclusive" copyright of the co-founders covers the timespan before opensourcing (their further contributions are included as part of Godot Engine contributors). Also fixed "cf." Frenchism - it's meant as "refer to / see".
2022-12-30Merge pull request #70511 from raulsntos/dotnet/fix-update-script-class-infoIgnacio Roldán Etcheverry
C#: Skip getting class info for unbound generics
2022-12-28C#: Avoid generic types in the script path attribute generatorRaul Santos
- Avoid generic types in `ScriptPathAttributeGenerator`, this means they won't be added to the `[AssemblyHasScripts]` attribute and a `[ScriptPath]` attribute won't be added to the class. Since generic classes can't be used as scripts they shouldn't use those attributes, this also makes CSharpScript consider those types invalid since they won't be added to the script/type map. - Avoid generic types in `ScriptManagerBridge.LookupScriptsInAssembly`. - Set `outMethodsDest` in `ScriptManagerBridge.UpdateScriptClassInfo`.
2022-12-25Fix pingpong with loop wrap is not workingSilc Renew
2022-12-24Merge pull request #70509 from irwiss/reverse-Vector2.AngleToPointIgnacio Roldán Etcheverry
C#: reverse Vector2.AngleToPoint
2022-12-24C#: reverse Vector2.AngleToPointAlexey Kim
2022-12-23C#: Fix leak in Span to Variant conversionsIgnacio Roldán Etcheverry
2022-12-23C#: Rename `ConvertToX` methodsRaul Santos
- Renamed `ConvertToX` to `ConvertToNativeX`. - Renamed `ConvertToXObject` to `ConvertToX`. - Renamed `ConvertToXManaged` to `ConvertToX`. - Fix `Signal` name in bindings generator and csharp script.
2022-12-16Merge pull request #69867 from raulsntos/dotnet/colorIgnacio Roldán Etcheverry
C#: Synchronize Color with Core
2022-12-16C#: Synchronize Color with CoreRaul Santos
- Add `Luminance` readonly property. - Add `LinearToSrgb` and `SrgbToLinear` static methods. - Add `FromOkHsl` static method. - Add `FromRgbe9995` static method. - Add `FromString` static method. - Expose `FromHtml` static method. - Expose `HtmlIsValid` static method. - Add and update some Color documentation.
2022-12-15Added Projection to ConvertTo<T> and CreateFrom<T>Alberto Vilches
2022-12-15Fix typos with codespellRémi Verschelde
2022-12-12C#: Rename SignalInfo to Signal and make awaitableRaul Santos
2022-12-12Merge pull request #69718 from groud/finally_rename_gdnative_to_gdextensionRémi Verschelde
Rename all gdnative occurences to gdextension
2022-12-12Rename all gdnative occurences to gdextensionGilles Roudière
Non-exhaustive list of case-sensitive renames: GDExtension -> GDNative GDNATIVE -> GDEXTENSION gdextension -> gdnative ExtensionExtension ->Extension (for where there was GDNativeExtension) EXTENSION_EXTENSION ->EXTENSION (for where there was GDNATIVE_EXTENSION) gdnlib -> gdextension gdn_interface -> gde_interface gdni -> gde_interface
2022-12-11Merge pull request #69933 from neikeq/issue-69822Rémi Verschelde
C#: Fix exported properties of GodotObject[] type
2022-12-11C#: Fix exported properties of GodotObject[] typeIgnacio Roldán Etcheverry
This was a regression from 17b2838f39c634324710166d2f36458906ecaf4a. `MarshalUtils` was changed in the source generators to use `ConvertTo<T>` and `CreateFrom<T>`, which don't support `GodotObject[]` because it would need reflection. As such, we need to keep the custom cases for `GodotObject[]` in `MarshalUtils`.
2022-12-10C#: Expose attribute properties and add documentationRaul Santos
- Exposes the properties of C# attribute so they can be accessed from reflection, renaming them to PascalCase to follow .NET conventions. - Added some documentation to the newly exposed members. - Made attribute properties readonly to avoid giving the impression that they could be modified.
2022-12-02C#: Always convert float Variants to System.DoubleRaul Santos
Godot floats are always 64-bit. The real_t feature only affects vectors, not scalars.
2022-12-02C#: Replace most conversions between Variant and System.ObjectIgnacio Roldán Etcheverry
This commit replaces most usages of `ConvertManagedObjectToVariant` and `ConvertVariantToManagedObjectOfType`, by using the `Godot.Variant` struct instead of `System.Object`. The most notable change is to the `GetGodotPropertyDefaultValues` method that's generated for scripts. The dictionary it returns now stores `Godot.Variant` values. Remaining usages are: - The `DelegateUtils` class, for the serialization of closure display classes during assembly reloading by the editor. These display classes are compiler generated classes to store values captured by a closure. Since it's generated by the compiler, the only way we have to access the fields is through reflection. This leads to using `System.Object`. - Converting parameters when invoking constructors from the engine. This will be replaced with source generators in the future. - Legacy support for old `GetGodotPropertyDefaultValues` return values. We need to keep supporting the old version of this generated method for some time. Otherwise, if loading a project built with the previous version, it could lead to the loss of exported property values. Ideally, we should remove this legacy support before a stable release.
2022-12-02C#: Remove `ConvertVariantToManagedObject`Ignacio Roldán Etcheverry
Its two usages were: - The Array `ICollection.CopyTo` implementation. It's possible that this class shouldn't be implementing the non-generic `ICollection`, but this commit doesn't change that. The new implementation stores the elements as boxed `Variant` values. - The `Variant.Obj` property. I'm not sure if this property's existence is justified, but for now I rewrote it as a simpler version of `ConvertVariantToManagedObject`.
2022-11-30Merge pull request #65905 from raulsntos/dotnet/marshaling-collectionsIgnacio Roldán Etcheverry
C#: Fix marshaling generic Godot collections
2022-11-28Merge pull request #67031 from raulsntos/dotnet/string-extensionsRémi Verschelde
C#: Cleanup and sync StringExtensions with core
2022-11-27C#: Remove/deprecate unnecessary string extensionsRaul Santos
- Removed `UnicodeAt` - Removed `EndsWith` - Removed `LPad` and `RPad` - Deprecated `BeginsWith` in favor of `string.StartsWith` - Deprecated `LStrip` and `RStrip` in favor of `string.TrimStart` and `string.TrimEnd`
2022-11-27Merge pull request #69194 from raulsntos/dotnet/begone-variant-disposerIgnacio Roldán Etcheverry
C#: Remove VariantSpanDisposer and use constants in stackalloc
2022-11-27C#: Remove VariantSpanDisposer and use constants in stackallocRaul Santos
- Remove `VariantSpanDisposer`, no need to dispose of the Variant Spans since we are now borrowing the Variants instead of copying them. - Remove `VariantSpanExtensions.Cleared` that was only used so the Span was initialized for `VariantSpanDisposer` to know what to dispose. - Fix stackalloc Spans to use constant VarArgsSpanThreshold and avoid bound checks.
2022-11-26Merge pull request #69191 from raulsntos/dotnet/no-throwIgnacio Roldán Etcheverry
Fix `VariantUtils.UnsupportedType` method throwing
2022-11-26Merge pull request #69088 from raulsntos/dotnet/globalIgnacio Roldán Etcheverry
C#: Add `global::` namespace to generated source
2022-11-26Fix `VariantUtils.UnsupportedType` method throwingRaul Santos
This method was not supposed to throw, just return the new constructed exception so it can be thrown by the caller.
2022-11-26C#: Add `global::` namespace to generated sourceRaul Santos
Adds `global::` to the fully qualified types in source generators to prevent ambiguity.
2022-11-25Merge pull request #68310 from neikeq/csharp-opt-variant-generic-convRémi Verschelde
C#: Optimize Variant conversion callbacks
2022-11-25C#: Cleanup and sync crypto/buffer StringExtensions with coreRaul Santos
- Replaced `MD5Buffer`, `MD5Text`, `SHA256Buffer` and `SHA256Text` implementation to use the `System.Security.Cryptography` classes and avoid marshaling. - Added `SHA1Buffer` and `SHA1Text`. - Renamed `ToUTF8` to `ToUTF8Buffer`. - Renamed `ToAscii` to `ToASCIIBuffer`. - Added `ToUTF16Buffer` and `ToUTF32Buffer`. - Added `GetStringFromUTF16` and `GetStringFromUTF32`.
2022-11-25C#: Cleanup and sync `IsValid*` StringExtensions with coreRaul Santos
- Renamed `IsValidInteger` to `IsValidInt`. - Added `IsValidFileName`. - Added `IsValidHexNumber`. - Added support for IPv6 to `IsValidIPAddress`. - Added `ValidateNodeName`. - Updated the documentation of the `IsValid*` methods.
2022-11-25C#: Cleanup and sync StringExtensions with coreRaul Santos
- Moved `GetBaseName` to keep methods alphabetically sorted. - Removed `Length`, users should just use the Length property. - Removed `Insert`, string already has a method with the same signature that takes precedence. - Removed `Erase`. - Removed `ToLower` and `ToUpper`, string already has methods with the same signature that take precedence. - Removed `FindLast` in favor of `RFind`. - Replaced `RFind` and `RFindN` implemenation with a ca ll to `string.LastIndexOf` to avoid marshaling. - Added `LPad` and `RPad`. - Added `StripEscapes`. - Replaced `LStrip` and `RStrip` implementation with a call to `string.TrimStart` and `string.TrimEnd`. - Added `TrimPrefix` and `TrimSuffix`. - Renamed `OrdAt` to `UnicodeAt`. - Added `CountN` and move the `caseSensitive` parameter of `Count` to the end. - Added `Indent` and `Dedent`.
2022-11-25Merge pull request #67511 from neikeq/issue-66060Rémi Verschelde
C#: Load assemblies as collectible only in the Godot editor
2022-11-25C#: Optimize Variant conversion callbacksIgnacio Roldán Etcheverry
These callbacks are used for marshaling by callables and generic Godot collections. C# generics don't support specialization the way C++ templates do. I knew NativeAOT could optimize away many type checks when the types are known at compile time, but I didn't trust the JIT would do as good a job, so I initially went with cached function pointers. Well, it turns out the JIT is also very good at optimizing in this scenario, so I'm changing the methods to do the conversion directly, rather than returning a function pointer for the conversion. The methods were moved to `VariantUtils`, and were renamed from `GetFromVariantCallback/GetToVariantCallback` to `ConvertTo/CreateFrom`. The new implementation looks like it goes through many `if` checks at runtime to find the right branch for the type, but in practice it works pretty much like template specialization. The JIT only generates code for the relevant branch. Together with inlining, the result is very close or the same as doing the conversion manually: ```cs godot_variant variant; int foo = variant.Int; int bar = VariantUtils.ConvertTo<int>(variant); ``` If the type is a generic Godot collection, the conversion still goes through a function pointer call. The new code happens to be much shorter as well, with the file going from 1057 lines to 407. Side note: `Variant.cs` was mistakenly created in the wrong folder, so I moved it to the `Core` folder.
2022-11-25C#: Add Projection documentationRaul Santos
- Add documentation to Projection type - Reorder Projection members to be consistent with other C# types
2022-11-24Merge pull request #69125 from raulsntos/dotnet/bezier_derivativeRémi Verschelde
C#: Implement BezierDerivative
2022-11-24C#: Implement BezierDerivativeRaul Santos
Adds `BezierDerivative` method to Mathf, Vector2 and Vector3 (already exposed in Core).
2022-11-24Refactor interpolating functions in some classes to use Math classSilc Renew