Merge pull request #68092 from raulsntos/dotnet/variant-from-array
C#: Add implicit conversion from arrays to Variant
This commit is contained in:
commit
c0de8d32d5
1 changed files with 52 additions and 4 deletions
|
@ -765,6 +765,58 @@ public partial struct Variant : IDisposable
|
|||
public static implicit operator Variant(SignalInfo from) =>
|
||||
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromSignalInfo(from));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Variant(byte[] from) =>
|
||||
(Variant)from.AsSpan();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Variant(int[] from) =>
|
||||
(Variant)from.AsSpan();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Variant(long[] from) =>
|
||||
(Variant)from.AsSpan();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Variant(float[] from) =>
|
||||
(Variant)from.AsSpan();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Variant(double[] from) =>
|
||||
(Variant)from.AsSpan();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Variant(string[] from) =>
|
||||
(Variant)from.AsSpan();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Variant(Vector2[] from) =>
|
||||
(Variant)from.AsSpan();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Variant(Vector3[] from) =>
|
||||
(Variant)from.AsSpan();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Variant(Color[] from) =>
|
||||
(Variant)from.AsSpan();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Variant(Godot.Object[] from) =>
|
||||
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromSystemArrayOfGodotObject(from));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Variant(StringName[] from) =>
|
||||
(Variant)from.AsSpan();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Variant(NodePath[] from) =>
|
||||
(Variant)from.AsSpan();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Variant(RID[] from) =>
|
||||
(Variant)from.AsSpan();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Variant(Span<byte> from) =>
|
||||
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromPackedByteArray(from));
|
||||
|
@ -801,10 +853,6 @@ public partial struct Variant : IDisposable
|
|||
public static implicit operator Variant(Span<Color> from) =>
|
||||
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromPackedColorArray(from));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Variant(Godot.Object[] from) =>
|
||||
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromSystemArrayOfGodotObject(from));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator Variant(Span<StringName> from) =>
|
||||
CreateTakingOwnershipOfDisposableValue(VariantUtils.CreateFromSystemArrayOfStringName(from));
|
||||
|
|
Loading…
Reference in a new issue