summaryrefslogtreecommitdiff
path: root/modules/mono/glue/GodotSharp
AgeCommit message (Collapse)Author
2022-11-18Merge pull request #66816 from raulsntos/dotnet/readonlyRémi Verschelde
Add `readonly` to C# methods and types that don't mutate
2022-11-15C#: Remove "?" from CEscape and CUnescapeRaul Santos
2022-11-14Add `readonly` to C# methods and types that don't mutateRaul Santos
Also removes a few unnecessary temp variables
2022-11-04Merge pull request #68253 from dzil123/fix_array_shuffleIgnacio Roldán Etcheverry
Fix c# Array.Shuffle incorrect mono bindings
2022-11-04Fix c# Array.Shuffle incorrect mono bindingsdzil123
2022-11-03Merge pull request #68092 from raulsntos/dotnet/variant-from-arrayIgnacio Roldán Etcheverry
C#: Add implicit conversion from arrays to Variant
2022-11-02Allow getting Quaternion rotation in different Euler ordersAaron Franke
2022-11-02C#: Add implicit conversion from arrays to VariantRaul Santos
Adds an implicit conversion from supported array types (the ones that are equivalent to `Packed*Array` types in Godot) to Variant.
2022-11-02Move EulerOrder enum to math_defs.h and global scopeAaron Franke
2022-11-02Merge pull request #68118 from aaronfranke/quat-from-eulerRémi Verschelde
Replace Quaternion Euler constructor with `from_euler` method
2022-11-02Add missed Quaternion constructor to C#Yuri Rubinsky
2022-11-01Replace Quaternion Euler constructor with `from_euler` methodAaron Franke
2022-10-30C#: Add Variant conversion callbacks for generic Godot collectionsIgnacio Roldán Etcheverry
This allows using generic Godot collections as type arguments for other generic Godot collections. This also allows generic Godot collections as parameter or return type in dynamic Callable invocations.
2022-10-30C#: Remove need for reflection to invoking callable delegatesIgnacio Roldán Etcheverry
We aim to make the C# API reflection-free, mainly for concerns about performance, and to be able to target NativeAOT in refletion-free mode, which reduces the binary size. One of the main usages of reflection still left was the dynamic invokation of callable delegates, and for some time I wasn't sure I would find an alternative solution that I'd be happy with. The new solution uses trampoline functions to invoke the delegates: ``` static void Trampoline(object delegateObj, NativeVariantPtrArgs args, out godot_variant ret) { if (args.Count != 1) throw new ArgumentException($"Callable expected 1 arguments but received {args.Count}."); string res = ((Func<int, string>)delegateObj)( VariantConversionCallbacks.GetToManagedCallback<int>()(args[0]) ); ret = VariantConversionCallbacks.GetToVariantCallback<string>()(res); } Callable.CreateWithUnsafeTrampoline((int num) => "Foo" + num, &Trampoline); ``` Of course, this is too much boilerplate for user code. To improve this, the `Callable.From` methods were added. These are overloads that take `Action` and `Func` delegates, which covers the most common use cases: lambdas and method groups: ``` // Lambda Callable.From((int num) => "Foo" + num); // Method group string AppendNum(int num) => "Foo" + num; Callable.From(AppendNum); ``` Unfortunately, due to limitations in the C# language, implicit conversions from delegates to `Callable` are not supported. `Callable.From` does not support custom delegates. These should be uncommon, but the Godot C# API actually uses them for event signals. As such, the bindings generator was updated to generate trampoline functions for event signals. It was also optimized to use `Action` instead of a custom delegate for parameterless signals, which removes the need for the trampoline functions for those signals. The change to reflection-free invokation removes one of the last needs for `ConvertVariantToManagedObjectOfType`. The only remaining usage is from calling script constructors with parameters from the engine (`CreateManagedForGodotObjectScriptInstance`). Once that one is made reflection-free, `ConvertVariantToManagedObjectOfType` can be removed.
2022-10-16Add a `Plane(Vector3, Vector3)` constructor for C#Yuri Rubinsky
2022-10-13Adding null check to prevent null reference exception when serializing ↵Alexander Schill
delegates in C#
2022-10-08C#: Generate symbols packagesRaul Santos
2022-10-03C#: Use Span in Color to avoid string allocationsRaul Santos
2022-10-03Merge pull request #66387 from aaronfranke/cs-basis-eulerRémi Verschelde
C#: Update Basis Euler angle code to match core
2022-10-01ManagedCallable: use delegate target instead of middleman when possiblePatrick Dawson
If the delegate target is an Object, the connected signal will be registered in that object instead of the middleman. So when that object is destroyed, the signal will be properly disconnected.
2022-09-25C#: Update Basis Euler angle code to match coreAaron Franke
2022-09-19C#: Rename `PlusFile` to `PathJoin`Raul Santos
2022-09-06Merge pull request #64417 from aaronfranke/has-spaceRémi Verschelde
Replace AABB/Rect2/Rect2i has_no_* methods with has_* methods
2022-09-06Rename `range_lerp` to `remap`Micky
2022-09-05Merge pull request #65266 from raulsntos/dotnet/reload-non-tool-scriptsRémi Verschelde
Create script instance of reloaded scripts even if they're not tools
2022-09-04Replace AABB/Rect2(i) HasNo* methods in C#Aaron Franke
2022-09-04Fix some bugs with Vector4 in C#Aaron Franke
2022-09-04C#: Create script instance of reloaded scripts even if they're not toolsRaul Santos
Scripts that are instantiated at some point will always be recreated if they ever become placeholders to prevent non-tool scripts instantiated manually by users to become placeholders, if they do become placeholders due to errors that prevent instantiation (such as a missing parameterless constructor) these scripts will also be recreated replacing the temporary placeholder. If a script is marked as a tool but becomes a non-tool script in a rebuild, the script will become a placeholder and will no longer be considered applicable to be replaced by an instance since the user explicitly removed the Tool attribute.
2022-09-04Add float arg to build_assemblies.pyAlmighty Laxz
2022-09-03Fixed build failing when REAL_T double and dotnet enabledAlmighty Laxz
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