diff options
Diffstat (limited to 'modules')
3 files changed, 38 insertions, 11 deletions
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs index f65f926b22..9c9258dd9e 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/VariantUtils.cs @@ -170,39 +170,66 @@ namespace Godot.NativeInterop [MethodImpl(MethodImplOptions.AggressiveInlining)] public static godot_variant CreateFromPackedByteArray(Span<byte> from) - => CreateFromPackedByteArray(Marshaling.ConvertSystemArrayToNativePackedByteArray(from)); + { + using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedByteArray(from); + return CreateFromPackedByteArray(nativePackedArray); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static godot_variant CreateFromPackedInt32Array(Span<int> from) - => CreateFromPackedInt32Array(Marshaling.ConvertSystemArrayToNativePackedInt32Array(from)); + { + using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedInt32Array(from); + return CreateFromPackedInt32Array(nativePackedArray); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static godot_variant CreateFromPackedInt64Array(Span<long> from) - => CreateFromPackedInt64Array(Marshaling.ConvertSystemArrayToNativePackedInt64Array(from)); + { + using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedInt64Array(from); + return CreateFromPackedInt64Array(nativePackedArray); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static godot_variant CreateFromPackedFloat32Array(Span<float> from) - => CreateFromPackedFloat32Array(Marshaling.ConvertSystemArrayToNativePackedFloat32Array(from)); + { + using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedFloat32Array(from); + return CreateFromPackedFloat32Array(nativePackedArray); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static godot_variant CreateFromPackedFloat64Array(Span<double> from) - => CreateFromPackedFloat64Array(Marshaling.ConvertSystemArrayToNativePackedFloat64Array(from)); + { + using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedFloat64Array(from); + return CreateFromPackedFloat64Array(nativePackedArray); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static godot_variant CreateFromPackedStringArray(Span<string> from) - => CreateFromPackedStringArray(Marshaling.ConvertSystemArrayToNativePackedStringArray(from)); + { + using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedStringArray(from); + return CreateFromPackedStringArray(nativePackedArray); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static godot_variant CreateFromPackedVector2Array(Span<Vector2> from) - => CreateFromPackedVector2Array(Marshaling.ConvertSystemArrayToNativePackedVector2Array(from)); + { + using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedVector2Array(from); + return CreateFromPackedVector2Array(nativePackedArray); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static godot_variant CreateFromPackedVector3Array(Span<Vector3> from) - => CreateFromPackedVector3Array(Marshaling.ConvertSystemArrayToNativePackedVector3Array(from)); + { + using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedVector3Array(from); + return CreateFromPackedVector3Array(nativePackedArray); + } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static godot_variant CreateFromPackedColorArray(Span<Color> from) - => CreateFromPackedColorArray(Marshaling.ConvertSystemArrayToNativePackedColorArray(from)); + { + using var nativePackedArray = Marshaling.ConvertSystemArrayToNativePackedColorArray(from); + return CreateFromPackedColorArray(nativePackedArray); + } public static godot_variant CreateFromSystemArrayOfStringName(Span<StringName> from) => CreateFromArray(new Collections.Array(from)); diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs index c471eceded..4c60080ee9 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs @@ -139,7 +139,7 @@ namespace Godot /// <returns>The angle between the two vectors, in radians.</returns> public readonly real_t AngleToPoint(Vector2 to) { - return Mathf.Atan2(y - to.y, x - to.x); + return Mathf.Atan2(to.y - y, to.x - x); } /// <summary> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs index 08f2a3a8af..91be548a21 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs @@ -123,7 +123,7 @@ namespace Godot /// <returns>The angle between the two vectors, in radians.</returns> public readonly real_t AngleToPoint(Vector2i to) { - return Mathf.Atan2(y - to.y, x - to.x); + return Mathf.Atan2(to.y - y, to.x - x); } /// <summary> |