feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -96,7 +96,7 @@ internal static class ExtensionMethods
|
|||
|
||||
public static string NameWithTypeParameters(this INamedTypeSymbol symbol)
|
||||
{
|
||||
return symbol.IsGenericType ?
|
||||
return symbol.IsGenericType && symbol.TypeParameters.Length > 0 ?
|
||||
string.Concat(symbol.Name, "<", string.Join(", ", symbol.TypeParameters), ">") :
|
||||
symbol.Name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1035,12 +1035,17 @@ namespace Godot.Collections
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Typed wrapper around Godot's Array class, an array of Variant
|
||||
/// typed elements allocated in the engine in C++. Useful when
|
||||
/// interfacing with the engine. Otherwise prefer .NET collections
|
||||
/// Typed wrapper around Godot's Array class, an array of <typeparamref name="T"/>
|
||||
/// annotated, Variant typed elements allocated in the engine in C++.
|
||||
/// Useful when interfacing with the engine. Otherwise prefer .NET collections
|
||||
/// such as arrays or <see cref="List{T}"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the array.</typeparam>
|
||||
/// <remarks>
|
||||
/// While the elements are statically annotated to <typeparamref name="T"/>,
|
||||
/// the underlying array still stores <see cref="Variant"/>, which has the same
|
||||
/// memory footprint per element as an untyped <see cref="Array"/>.
|
||||
/// </remarks>
|
||||
[DebuggerTypeProxy(typeof(ArrayDebugView<>))]
|
||||
[DebuggerDisplay("Count = {Count}")]
|
||||
[SuppressMessage("ReSharper", "RedundantExtendsListEntry")]
|
||||
|
|
|
|||
|
|
@ -476,13 +476,18 @@ namespace Godot.Collections
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Typed wrapper around Godot's Dictionary class, a dictionary of Variant
|
||||
/// typed elements allocated in the engine in C++. Useful when
|
||||
/// interfacing with the engine. Otherwise prefer .NET collections
|
||||
/// Typed wrapper around Godot's Dictionary class, a dictionary of <typeparamref name="TKey"/>
|
||||
/// and <typeparamref name="TValue"/> annotated, Variant typed elements allocated in the engine in C++.
|
||||
/// Useful when interfacing with the engine. Otherwise prefer .NET collections
|
||||
/// such as <see cref="System.Collections.Generic.Dictionary{TKey, TValue}"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="TKey">The type of the dictionary's keys.</typeparam>
|
||||
/// <typeparam name="TValue">The type of the dictionary's values.</typeparam>
|
||||
/// <remarks>
|
||||
/// While the elements are statically annotated to <typeparamref name="TKey"/> and <typeparamref name="TValue"/>,
|
||||
/// the underlying dictionary still stores <see cref="Variant"/>, which has the same memory footprint per element
|
||||
/// as an untyped <see cref="Dictionary"/>.
|
||||
/// </remarks>
|
||||
[DebuggerTypeProxy(typeof(DictionaryDebugView<,>))]
|
||||
[DebuggerDisplay("Count = {Count}")]
|
||||
[SuppressMessage("Design", "CA1001", MessageId = "Types that own disposable fields should be disposable",
|
||||
|
|
|
|||
|
|
@ -455,6 +455,12 @@ namespace Godot.NativeInterop
|
|||
get => _data._m_obj_data.obj;
|
||||
}
|
||||
|
||||
public readonly ulong ObjectId
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => _data._m_obj_data.id;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
switch (Type)
|
||||
|
|
|
|||
|
|
@ -503,6 +503,9 @@ namespace Godot.NativeInterop
|
|||
public static partial void godotsharp_string_simplify_path(scoped in godot_string p_self,
|
||||
out godot_string r_simplified_path);
|
||||
|
||||
public static partial void godotsharp_string_capitalize(scoped in godot_string p_self,
|
||||
out godot_string r_capitalized);
|
||||
|
||||
public static partial void godotsharp_string_to_camel_case(scoped in godot_string p_self,
|
||||
out godot_string r_camel_case);
|
||||
|
||||
|
|
@ -512,6 +515,9 @@ namespace Godot.NativeInterop
|
|||
public static partial void godotsharp_string_to_snake_case(scoped in godot_string p_self,
|
||||
out godot_string r_snake_case);
|
||||
|
||||
public static partial void godotsharp_string_to_kebab_case(scoped in godot_string p_self,
|
||||
out godot_string r_kebab_case);
|
||||
|
||||
// NodePath
|
||||
|
||||
public static partial void godotsharp_node_path_get_as_property_path(in godot_node_path p_self,
|
||||
|
|
|
|||
|
|
@ -485,7 +485,14 @@ namespace Godot.NativeInterop
|
|||
NativeFuncs.godotsharp_variant_as_rid(p_var);
|
||||
|
||||
public static IntPtr ConvertToGodotObjectPtr(in godot_variant p_var)
|
||||
=> p_var.Type == Variant.Type.Object ? p_var.Object : IntPtr.Zero;
|
||||
{
|
||||
if (p_var.Type != Variant.Type.Object || p_var.ObjectId == 0)
|
||||
{
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
return NativeFuncs.godotsharp_instance_from_id(p_var.ObjectId);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static GodotObject ConvertToGodotObject(in godot_variant p_var)
|
||||
|
|
|
|||
|
|
@ -845,6 +845,33 @@ namespace Godot
|
|||
W = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a projection from 16 scalars.
|
||||
/// </summary>
|
||||
/// <param name="xx">The X column vector's X component, accessed via <c>p.X.X</c> or <c>[0][0]</c>.</param>
|
||||
/// <param name="xy">The X column vector's Y component, accessed via <c>p.X.Y</c> or <c>[0][1]</c>.</param>
|
||||
/// <param name="xz">The X column vector's Z component, accessed via <c>p.X.Z</c> or <c>[0][2]</c>.</param>
|
||||
/// <param name="xw">The X column vector's W component, accessed via <c>p.X.W</c> or <c>[0][3]</c>.</param>
|
||||
/// <param name="yx">The Y column vector's X component, accessed via <c>p.Y.X</c> or <c>[1][0]</c>.</param>
|
||||
/// <param name="yy">The Y column vector's Y component, accessed via <c>p.Y.Y</c> or <c>[1][1]</c>.</param>
|
||||
/// <param name="yz">The Y column vector's Z component, accessed via <c>p.Y.Z</c> or <c>[1][2]</c>.</param>
|
||||
/// <param name="yw">The Y column vector's W component, accessed via <c>p.Y.W</c> or <c>[1][3]</c>.</param>
|
||||
/// <param name="zx">The Z column vector's X component, accessed via <c>p.Z.X</c> or <c>[2][0]</c>.</param>
|
||||
/// <param name="zy">The Z column vector's Y component, accessed via <c>p.Z.Y</c> or <c>[2][1]</c>.</param>
|
||||
/// <param name="zz">The Z column vector's Z component, accessed via <c>p.Z.Z</c> or <c>[2][2]</c>.</param>
|
||||
/// <param name="zw">The Z column vector's W component, accessed via <c>p.Z.W</c> or <c>[2][3]</c>.</param>
|
||||
/// <param name="wx">The W column vector's X component, accessed via <c>p.W.X</c> or <c>[3][0]</c>.</param>
|
||||
/// <param name="wy">The W column vector's Y component, accessed via <c>p.W.Y</c> or <c>[3][1]</c>.</param>
|
||||
/// <param name="wz">The W column vector's Z component, accessed via <c>p.W.Z</c> or <c>[3][2]</c>.</param>
|
||||
/// <param name="ww">The W column vector's W component, accessed via <c>p.W.W</c> or <c>[3][3]</c>.</param>
|
||||
public Projection(real_t xx, real_t xy, real_t xz, real_t xw, real_t yx, real_t yy, real_t yz, real_t yw, real_t zx, real_t zy, real_t zz, real_t zw, real_t wx, real_t wy, real_t wz, real_t ww)
|
||||
{
|
||||
X = new Vector4(xx, xy, xz, xw);
|
||||
Y = new Vector4(yx, yy, yz, yw);
|
||||
Z = new Vector4(zx, zy, zz, zw);
|
||||
W = new Vector4(wx, wy, wz, ww);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="Projection"/> from a <see cref="Transform3D"/>.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -48,12 +48,19 @@ namespace Godot
|
|||
|
||||
awaiter._completed = true;
|
||||
|
||||
Variant[] signalArgs = new Variant[argCount];
|
||||
if (argCount > 0)
|
||||
{
|
||||
Variant[] signalArgs = new Variant[argCount];
|
||||
|
||||
for (int i = 0; i < argCount; i++)
|
||||
signalArgs[i] = Variant.CreateCopyingBorrowed(*args[i]);
|
||||
for (int i = 0; i < argCount; i++)
|
||||
signalArgs[i] = Variant.CreateCopyingBorrowed(*args[i]);
|
||||
|
||||
awaiter._result = signalArgs;
|
||||
awaiter._result = signalArgs;
|
||||
}
|
||||
else
|
||||
{
|
||||
awaiter._result = [];
|
||||
}
|
||||
|
||||
awaiter._continuation?.Invoke();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -314,22 +314,10 @@ namespace Godot
|
|||
/// <returns>The capitalized string.</returns>
|
||||
public static string Capitalize(this string instance)
|
||||
{
|
||||
string aux = instance.CamelcaseToUnderscore(true).Replace("_", " ", StringComparison.Ordinal).Trim();
|
||||
string cap = string.Empty;
|
||||
|
||||
for (int i = 0; i < aux.GetSliceCount(" "); i++)
|
||||
{
|
||||
string slice = aux.GetSliceCharacter(' ', i);
|
||||
if (slice.Length > 0)
|
||||
{
|
||||
slice = char.ToUpperInvariant(slice[0]) + slice.Substring(1);
|
||||
if (i > 0)
|
||||
cap += " ";
|
||||
cap += slice;
|
||||
}
|
||||
}
|
||||
|
||||
return cap;
|
||||
using godot_string instanceStr = Marshaling.ConvertStringToNative(instance);
|
||||
NativeFuncs.godotsharp_string_capitalize(instanceStr, out godot_string capitalized);
|
||||
using (capitalized)
|
||||
return Marshaling.ConvertStringToManaged(capitalized);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -371,49 +359,17 @@ namespace Godot
|
|||
return Marshaling.ConvertStringToManaged(snakeCase);
|
||||
}
|
||||
|
||||
private static string CamelcaseToUnderscore(this string instance, bool lowerCase)
|
||||
/// <summary>
|
||||
/// Returns the string converted to <c>kebab-case</c>.
|
||||
/// </summary>
|
||||
/// <param name="instance">The string to convert.</param>
|
||||
/// <returns>The converted string.</returns>
|
||||
public static string ToKebabCase(this string instance)
|
||||
{
|
||||
string newString = string.Empty;
|
||||
int startIndex = 0;
|
||||
|
||||
for (int i = 1; i < instance.Length; i++)
|
||||
{
|
||||
bool isUpper = char.IsUpper(instance[i]);
|
||||
bool isNumber = char.IsDigit(instance[i]);
|
||||
|
||||
bool areNext2Lower = false;
|
||||
bool isNextLower = false;
|
||||
bool isNextNumber = false;
|
||||
bool wasPrecedentUpper = char.IsUpper(instance[i - 1]);
|
||||
bool wasPrecedentNumber = char.IsDigit(instance[i - 1]);
|
||||
|
||||
if (i + 2 < instance.Length)
|
||||
{
|
||||
areNext2Lower = char.IsLower(instance[i + 1]) && char.IsLower(instance[i + 2]);
|
||||
}
|
||||
|
||||
if (i + 1 < instance.Length)
|
||||
{
|
||||
isNextLower = char.IsLower(instance[i + 1]);
|
||||
isNextNumber = char.IsDigit(instance[i + 1]);
|
||||
}
|
||||
|
||||
bool condA = isUpper && !wasPrecedentUpper && !wasPrecedentNumber;
|
||||
bool condB = wasPrecedentUpper && isUpper && areNext2Lower;
|
||||
bool condC = isNumber && !wasPrecedentNumber;
|
||||
bool canBreakNumberLetter = isNumber && !wasPrecedentNumber && isNextLower;
|
||||
bool canBreakLetterNumber = !isNumber && wasPrecedentNumber && (isNextLower || isNextNumber);
|
||||
|
||||
bool shouldSplit = condA || condB || condC || canBreakNumberLetter || canBreakLetterNumber;
|
||||
if (shouldSplit)
|
||||
{
|
||||
newString += string.Concat(instance.AsSpan(startIndex, i - startIndex), "_");
|
||||
startIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
newString += instance.Substring(startIndex, instance.Length - startIndex);
|
||||
return lowerCase ? newString.ToLowerInvariant() : newString;
|
||||
using godot_string instanceStr = Marshaling.ConvertStringToNative(instance);
|
||||
NativeFuncs.godotsharp_string_to_kebab_case(instanceStr, out godot_string kebabCase);
|
||||
using (kebabCase)
|
||||
return Marshaling.ConvertStringToManaged(kebabCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1359,7 +1315,9 @@ namespace Godot
|
|||
/// <returns>The concatenated path with the given file name.</returns>
|
||||
public static string PathJoin(this string instance, string file)
|
||||
{
|
||||
if (instance.Length > 0 && instance[instance.Length - 1] == '/')
|
||||
if (instance.Length == 0)
|
||||
return file;
|
||||
if (instance[^1] == '/' || (file.Length > 0 && file[0] == '/'))
|
||||
return instance + file;
|
||||
return instance + "/" + file;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,6 +487,23 @@ namespace Godot
|
|||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the result of the component-wise minimum between
|
||||
/// this vector and <paramref name="with"/>.
|
||||
/// Equivalent to <c>new Vector3(Mathf.Min(X, with), Mathf.Min(Y, with), Mathf.Min(Z, with))</c>.
|
||||
/// </summary>
|
||||
/// <param name="with">The other value to use.</param>
|
||||
/// <returns>The resulting minimum vector.</returns>
|
||||
public readonly Vector3 Min(real_t with)
|
||||
{
|
||||
return new Vector3
|
||||
(
|
||||
Mathf.Min(X, with),
|
||||
Mathf.Min(Y, with),
|
||||
Mathf.Min(Z, with)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
|
||||
/// If all components are equal, this method returns <see cref="Axis.X"/>.
|
||||
|
|
@ -751,6 +768,50 @@ namespace Godot
|
|||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the octahedral-encoded (oct32) form of this Vector3 as a Vector2. Since a Vector2 occupies 1/3 less memory compared to Vector3,
|
||||
/// this form of compression can be used to pass greater amounts of normalized Vector3s without increasing storage or memory requirements.
|
||||
/// See also <see cref="Normalized()"/>, <see cref="OctahedronDecode(Vector2)"/>.
|
||||
/// Note: OctahedronEncode can only be used for normalized vectors. OctahedronEncode does not check whether this Vector3 is normalized,
|
||||
/// and will return a value that does not decompress to the original value if the Vector3 is not normalized.
|
||||
/// Note: Octahedral compression is lossy, although visual differences are rarely perceptible in real world scenarios.
|
||||
/// </summary>
|
||||
/// <returns>The encoded Vector2.</returns>
|
||||
public readonly Vector2 OctahedronEncode()
|
||||
{
|
||||
Vector3 n = this;
|
||||
n /= Mathf.Abs(n.X) + Mathf.Abs(n.Y) + Mathf.Abs(n.Z);
|
||||
Vector2 o;
|
||||
if (n.Z >= 0.0f)
|
||||
{
|
||||
o.X = n.X;
|
||||
o.Y = n.Y;
|
||||
}
|
||||
else
|
||||
{
|
||||
o.X = (1.0f - Mathf.Abs(n.Y)) * (n.X >= 0.0f ? 1.0f : -1.0f);
|
||||
o.Y = (1.0f - Mathf.Abs(n.X)) * (n.Y >= 0.0f ? 1.0f : -1.0f);
|
||||
}
|
||||
o.X = o.X * 0.5f + 0.5f;
|
||||
o.Y = o.Y * 0.5f + 0.5f;
|
||||
return o;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the Vector3 from an octahedral-compressed form created using <see cref="OctahedronEncode()"/> (stored as a Vector2).
|
||||
/// </summary>
|
||||
/// <param name="oct">Encoded Vector2</param>
|
||||
/// <returns>The decoded normalized Vector3.</returns>
|
||||
public static Vector3 OctahedronDecode(Vector2 oct)
|
||||
{
|
||||
var f = new Vector2(oct.X * 2.0f - 1.0f, oct.Y * 2.0f - 1.0f);
|
||||
var n = new Vector3(f.X, f.Y, 1.0f - Mathf.Abs(f.X) - Mathf.Abs(f.Y));
|
||||
real_t t = Mathf.Clamp(-n.Z, 0.0f, 1.0f);
|
||||
n.X += n.X >= 0 ? -t : t;
|
||||
n.Y += n.Y >= 0 ? -t : t;
|
||||
return n.Normalized();
|
||||
}
|
||||
|
||||
// Constants
|
||||
private static readonly Vector3 _zero = new Vector3(0, 0, 0);
|
||||
private static readonly Vector3 _one = new Vector3(1, 1, 1);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
<Authors>Godot Engine contributors</Authors>
|
||||
|
||||
<PackageId>GodotSharp</PackageId>
|
||||
<Version>4.4.0</Version>
|
||||
<Version>4.5.0</Version>
|
||||
<PackageVersion>$(PackageVersion_GodotSharp)</PackageVersion>
|
||||
<RepositoryUrl>https://github.com/godotengine/godot/tree/master/modules/mono/glue/GodotSharp/GodotSharp</RepositoryUrl>
|
||||
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
<Authors>Godot Engine contributors</Authors>
|
||||
|
||||
<PackageId>GodotSharpEditor</PackageId>
|
||||
<Version>4.4.0</Version>
|
||||
<Version>4.5.0</Version>
|
||||
<PackageVersion>$(PackageVersion_GodotSharp)</PackageVersion>
|
||||
<RepositoryUrl>https://github.com/godotengine/godot/tree/master/modules/mono/glue/GodotSharp/GodotSharpEditor</RepositoryUrl>
|
||||
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue