summaryrefslogtreecommitdiff
path: root/modules/mono
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mono')
-rw-r--r--modules/mono/SdkPackageVersions.props5
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.targets2
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Generic.cs16
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPathAttributeGenerator.cs19
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs8
-rw-r--r--modules/mono/editor/bindings_generator.h2
-rw-r--r--modules/mono/editor/code_completion.cpp2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs164
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs12
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs8
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/NodePath.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs4
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs13
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs32
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs46
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs72
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs38
-rw-r--r--modules/mono/godotsharp_dirs.cpp3
-rw-r--r--modules/mono/mono_gc_handle.h3
-rw-r--r--modules/mono/mono_gd/gd_mono_cache.cpp4
-rw-r--r--modules/mono/mono_gd/gd_mono_cache.h2
-rw-r--r--modules/mono/mono_gd/gd_mono_class.cpp11
-rw-r--r--modules/mono/mono_gd/gd_mono_log.cpp11
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.cpp6
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.h2
29 files changed, 277 insertions, 218 deletions
diff --git a/modules/mono/SdkPackageVersions.props b/modules/mono/SdkPackageVersions.props
index df3ebe581c..bdec051625 100644
--- a/modules/mono/SdkPackageVersions.props
+++ b/modules/mono/SdkPackageVersions.props
@@ -1,6 +1,7 @@
<Project>
<PropertyGroup>
- <PackageVersion_Godot_NET_Sdk>4.0.0-dev5</PackageVersion_Godot_NET_Sdk>
- <PackageVersion_Godot_SourceGenerators>4.0.0-dev2</PackageVersion_Godot_SourceGenerators>
+ <PackageFloatingVersion_Godot>4.0.*-*</PackageFloatingVersion_Godot>
+ <PackageVersion_Godot_NET_Sdk>4.0.0-dev6</PackageVersion_Godot_NET_Sdk>
+ <PackageVersion_Godot_SourceGenerators>4.0.0-dev3</PackageVersion_Godot_SourceGenerators>
</PropertyGroup>
</Project>
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.targets b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.targets
index 92e299d2f3..397ede9644 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.targets
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.targets
@@ -17,6 +17,6 @@
<!-- C# source generators -->
<ItemGroup Condition=" '$(DisableImplicitGodotGeneratorReferences)' != 'true' ">
- <PackageReference Include="Godot.SourceGenerators" Version="$(PackageVersion_Godot_SourceGenerators)" />
+ <PackageReference Include="Godot.SourceGenerators" Version="$(PackageFloatingVersion_Godot)" />
</ItemGroup>
</Project>
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Generic.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Generic.cs
new file mode 100644
index 0000000000..2ddb8880c2
--- /dev/null
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Generic.cs
@@ -0,0 +1,16 @@
+namespace Godot.SourceGenerators.Sample
+{
+ partial class Generic<T> : Godot.Object
+ {
+ }
+
+ // Generic again but different generic parameters
+ partial class Generic<T, R> : Godot.Object
+ {
+ }
+
+ // Generic again but without generic parameters
+ partial class Generic : Godot.Object
+ {
+ }
+}
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPathAttributeGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPathAttributeGenerator.cs
index a51728e221..fa65595290 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPathAttributeGenerator.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPathAttributeGenerator.cs
@@ -97,9 +97,13 @@ namespace Godot.SourceGenerators
string.Empty;
bool hasNamespace = classNs.Length != 0;
- string uniqueName = hasNamespace ?
- classNs + "." + className + "_ScriptPath_Generated" :
- className + "_ScriptPath_Generated";
+ var uniqueName = new StringBuilder();
+ if (hasNamespace)
+ uniqueName.Append($"{classNs}.");
+ uniqueName.Append(className);
+ if (symbol.IsGenericType)
+ uniqueName.Append($"Of{string.Join(string.Empty, symbol.TypeParameters)}");
+ uniqueName.Append("_ScriptPath_Generated");
var source = new StringBuilder();
@@ -121,6 +125,8 @@ namespace Godot.SourceGenerators
source.Append(attributes);
source.Append("\n partial class ");
source.Append(className);
+ if (symbol.IsGenericType)
+ source.Append($"<{string.Join(", ", symbol.TypeParameters)}>");
source.Append("\n{\n}\n");
if (hasNamespace)
@@ -128,7 +134,7 @@ namespace Godot.SourceGenerators
source.Append("\n}\n");
}
- context.AddSource(uniqueName, SourceText.From(source.ToString(), Encoding.UTF8));
+ context.AddSource(uniqueName.ToString(), SourceText.From(source.ToString(), Encoding.UTF8));
}
private static void AddScriptTypesAssemblyAttr(GeneratorExecutionContext context,
@@ -145,12 +151,15 @@ namespace Godot.SourceGenerators
foreach (var godotClass in godotClasses)
{
var qualifiedName = godotClass.Key.ToDisplayString(
- NullableFlowState.NotNull, SymbolDisplayFormat.FullyQualifiedFormat);
+ NullableFlowState.NotNull, SymbolDisplayFormat.FullyQualifiedFormat
+ .WithGenericsOptions(SymbolDisplayGenericsOptions.None));
if (!first)
sourceBuilder.Append(", ");
first = false;
sourceBuilder.Append("typeof(");
sourceBuilder.Append(qualifiedName);
+ if (godotClass.Key.IsGenericType)
+ sourceBuilder.Append($"<{new string(',', godotClass.Key.TypeParameters.Count() - 1)}>");
sourceBuilder.Append(")");
}
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
index b53347fc4c..56fca6b5cb 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs
@@ -119,7 +119,7 @@ namespace GodotTools.Build
private void IssueActivated(int idx)
{
- if (idx < 0 || idx >= _issuesList.GetItemCount())
+ if (idx < 0 || idx >= _issuesList.ItemCount)
throw new IndexOutOfRangeException("Item list index out of range");
// Get correct issue idx from issue list
@@ -193,7 +193,7 @@ namespace GodotTools.Build
string itemText = lineBreakIdx == -1 ? text : text.Substring(0, lineBreakIdx);
_issuesList.AddItem(itemText, issue.Warning ? warningIcon : errorIcon);
- int index = _issuesList.GetItemCount() - 1;
+ int index = _issuesList.ItemCount - 1;
_issuesList.SetItemTooltip(index, tooltip);
_issuesList.SetItemMetadata(index, i);
}
@@ -207,7 +207,7 @@ namespace GodotTools.Build
_issuesList.Clear();
- var issue = new BuildIssue {Message = cause, Warning = false};
+ var issue = new BuildIssue { Message = cause, Warning = false };
ErrorCount += 1;
_issues.Add(issue);
@@ -348,7 +348,7 @@ namespace GodotTools.Build
label: "Copy Error".TTR(), (int)IssuesContextMenuOption.Copy);
}
- if (_issuesListContextMenu.GetItemCount() > 0)
+ if (_issuesListContextMenu.ItemCount > 0)
{
_issuesListContextMenu.Position = (Vector2i)(_issuesList.RectGlobalPosition + atPosition);
_issuesListContextMenu.Popup();
diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h
index 51a27ee934..a7879e96c8 100644
--- a/modules/mono/editor/bindings_generator.h
+++ b/modules/mono/editor/bindings_generator.h
@@ -598,7 +598,7 @@ class BindingsGenerator {
private:
NameCache(const NameCache &);
- NameCache &operator=(const NameCache &);
+ void operator=(const NameCache &);
};
NameCache name_cache;
diff --git a/modules/mono/editor/code_completion.cpp b/modules/mono/editor/code_completion.cpp
index 7433c865f5..61d0890288 100644
--- a/modules/mono/editor/code_completion.cpp
+++ b/modules/mono/editor/code_completion.cpp
@@ -155,7 +155,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
dir_access->list_dir_begin();
String filename = dir_access->get_next();
- while (filename != "") {
+ while (!filename.is_empty()) {
if (filename == "." || filename == "..") {
filename = dir_access->get_next();
continue;
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
index bfbf1a097e..656796c5c7 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
@@ -209,27 +209,6 @@ namespace Godot
}
}
- /// <summary>
- /// Returns the <see cref="Basis"/>'s rotation in the form of a
- /// <see cref="Quaternion"/>. See <see cref="GetEuler"/> if you
- /// need Euler angles, but keep in mind quaternions should generally
- /// be preferred to Euler angles.
- /// </summary>
- /// <returns>The basis rotation.</returns>
- public Quaternion GetRotationQuaternion()
- {
- Basis orthonormalizedBasis = Orthonormalized();
- real_t det = orthonormalizedBasis.Determinant();
- if (det < 0)
- {
- // Ensure that the determinant is 1, such that result is a proper
- // rotation matrix which can be represented by Euler angles.
- orthonormalizedBasis = orthonormalizedBasis.Scaled(-Vector3.One);
- }
-
- return orthonormalizedBasis.Quaternion();
- }
-
internal void SetQuaternionScale(Quaternion quaternion, Vector3 scale)
{
SetDiagonal(scale);
@@ -272,8 +251,8 @@ namespace Godot
/// The returned vector contains the rotation angles in
/// the format (X angle, Y angle, Z angle).
///
- /// Consider using the <see cref="Quaternion()"/> method instead, which
- /// returns a <see cref="Godot.Quaternion"/> quaternion instead of Euler angles.
+ /// Consider using the <see cref="GetRotationQuaternion"/> method instead, which
+ /// returns a <see cref="Quaternion"/> quaternion instead of Euler angles.
/// </summary>
/// <returns>A <see cref="Vector3"/> representing the basis rotation in Euler angles.</returns>
public Vector3 GetEuler()
@@ -309,6 +288,85 @@ namespace Godot
}
/// <summary>
+ /// Returns the basis's rotation in the form of a quaternion.
+ /// See <see cref="GetEuler()"/> if you need Euler angles, but keep in
+ /// mind that quaternions should generally be preferred to Euler angles.
+ /// </summary>
+ /// <returns>A <see cref="Quaternion"/> representing the basis's rotation.</returns>
+ internal Quaternion GetQuaternion()
+ {
+ real_t trace = Row0[0] + Row1[1] + Row2[2];
+
+ if (trace > 0.0f)
+ {
+ real_t s = Mathf.Sqrt(trace + 1.0f) * 2f;
+ real_t inv_s = 1f / s;
+ return new Quaternion(
+ (Row2[1] - Row1[2]) * inv_s,
+ (Row0[2] - Row2[0]) * inv_s,
+ (Row1[0] - Row0[1]) * inv_s,
+ s * 0.25f
+ );
+ }
+
+ if (Row0[0] > Row1[1] && Row0[0] > Row2[2])
+ {
+ real_t s = Mathf.Sqrt(Row0[0] - Row1[1] - Row2[2] + 1.0f) * 2f;
+ real_t inv_s = 1f / s;
+ return new Quaternion(
+ s * 0.25f,
+ (Row0[1] + Row1[0]) * inv_s,
+ (Row0[2] + Row2[0]) * inv_s,
+ (Row2[1] - Row1[2]) * inv_s
+ );
+ }
+
+ if (Row1[1] > Row2[2])
+ {
+ real_t s = Mathf.Sqrt(-Row0[0] + Row1[1] - Row2[2] + 1.0f) * 2f;
+ real_t inv_s = 1f / s;
+ return new Quaternion(
+ (Row0[1] + Row1[0]) * inv_s,
+ s * 0.25f,
+ (Row1[2] + Row2[1]) * inv_s,
+ (Row0[2] - Row2[0]) * inv_s
+ );
+ }
+ else
+ {
+ real_t s = Mathf.Sqrt(-Row0[0] - Row1[1] + Row2[2] + 1.0f) * 2f;
+ real_t inv_s = 1f / s;
+ return new Quaternion(
+ (Row0[2] + Row2[0]) * inv_s,
+ (Row1[2] + Row2[1]) * inv_s,
+ s * 0.25f,
+ (Row1[0] - Row0[1]) * inv_s
+ );
+ }
+ }
+
+ /// <summary>
+ /// Returns the <see cref="Basis"/>'s rotation in the form of a
+ /// <see cref="Quaternion"/>. See <see cref="GetEuler"/> if you
+ /// need Euler angles, but keep in mind quaternions should generally
+ /// be preferred to Euler angles.
+ /// </summary>
+ /// <returns>The basis rotation.</returns>
+ public Quaternion GetRotationQuaternion()
+ {
+ Basis orthonormalizedBasis = Orthonormalized();
+ real_t det = orthonormalizedBasis.Determinant();
+ if (det < 0)
+ {
+ // Ensure that the determinant is 1, such that result is a proper
+ // rotation matrix which can be represented by Euler angles.
+ orthonormalizedBasis = orthonormalizedBasis.Scaled(-Vector3.One);
+ }
+
+ return orthonormalizedBasis.GetQuaternion();
+ }
+
+ /// <summary>
/// Get rows by index. Rows are not very useful for user code,
/// but are more efficient for some internal calculations.
/// </summary>
@@ -600,64 +658,6 @@ namespace Godot
);
}
- /// <summary>
- /// Returns the basis's rotation in the form of a quaternion.
- /// See <see cref="GetEuler()"/> if you need Euler angles, but keep in
- /// mind that quaternions should generally be preferred to Euler angles.
- /// </summary>
- /// <returns>A <see cref="Godot.Quaternion"/> representing the basis's rotation.</returns>
- public Quaternion Quaternion()
- {
- real_t trace = Row0[0] + Row1[1] + Row2[2];
-
- if (trace > 0.0f)
- {
- real_t s = Mathf.Sqrt(trace + 1.0f) * 2f;
- real_t inv_s = 1f / s;
- return new Quaternion(
- (Row2[1] - Row1[2]) * inv_s,
- (Row0[2] - Row2[0]) * inv_s,
- (Row1[0] - Row0[1]) * inv_s,
- s * 0.25f
- );
- }
-
- if (Row0[0] > Row1[1] && Row0[0] > Row2[2])
- {
- real_t s = Mathf.Sqrt(Row0[0] - Row1[1] - Row2[2] + 1.0f) * 2f;
- real_t inv_s = 1f / s;
- return new Quaternion(
- s * 0.25f,
- (Row0[1] + Row1[0]) * inv_s,
- (Row0[2] + Row2[0]) * inv_s,
- (Row2[1] - Row1[2]) * inv_s
- );
- }
-
- if (Row1[1] > Row2[2])
- {
- real_t s = Mathf.Sqrt(-Row0[0] + Row1[1] - Row2[2] + 1.0f) * 2f;
- real_t inv_s = 1f / s;
- return new Quaternion(
- (Row0[1] + Row1[0]) * inv_s,
- s * 0.25f,
- (Row1[2] + Row2[1]) * inv_s,
- (Row0[2] - Row2[0]) * inv_s
- );
- }
- else
- {
- real_t s = Mathf.Sqrt(-Row0[0] - Row1[1] + Row2[2] + 1.0f) * 2f;
- real_t inv_s = 1f / s;
- return new Quaternion(
- (Row0[2] + Row2[0]) * inv_s,
- (Row1[2] + Row2[1]) * inv_s,
- s * 0.25f,
- (Row1[0] - Row0[1]) * inv_s
- );
- }
- }
-
private static readonly Basis[] _orthoBases = {
new Basis(1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 1f),
new Basis(0f, -1f, 0f, 1f, 0f, 0f, 0f, 0f, 1f),
@@ -745,7 +745,7 @@ namespace Godot
/// given in the vector format as (X angle, Y angle, Z angle).
///
/// Consider using the <see cref="Basis(Quaternion)"/> constructor instead, which
- /// uses a <see cref="Godot.Quaternion"/> quaternion instead of Euler angles.
+ /// uses a <see cref="Quaternion"/> quaternion instead of Euler angles.
/// </summary>
/// <param name="eulerYXZ">The Euler angles to create the basis from.</param>
public Basis(Vector3 eulerYXZ)
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs
index a3afc83222..c664463e86 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs
@@ -127,7 +127,7 @@ namespace Godot
/// </code>
/// </example>
/// <param name="linear">The linear energy to convert.</param>
- /// <returns>Audio as decibels</returns>
+ /// <returns>Audio as decibels.</returns>
public static real_t Linear2Db(real_t linear)
{
return (real_t)(Math.Log(linear) * 8.6858896380650365530225783783321);
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs
index 3051bcedc7..ee4d0eed08 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs
@@ -80,6 +80,18 @@ namespace Godot
private static bool TypeIsGenericIDictionary(Type type) => type.GetGenericTypeDefinition() == typeof(IDictionary<,>);
/// <summary>
+ /// Returns the generic type definition of <paramref name="type"/>.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// Thrown when the given <paramref name="type"/> is not a generic type.
+ /// That is, <see cref="Type.IsGenericType"/> returns <see langword="false"/>.
+ /// </exception>
+ private static void GetGenericTypeDefinition(Type type, out Type genericTypeDefinition)
+ {
+ genericTypeDefinition = type.GetGenericTypeDefinition();
+ }
+
+ /// <summary>
/// Gets the element type for the given <paramref name="arrayType"/>.
/// </summary>
/// <param name="arrayType">Type for the generic array.</param>
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs
index fbc8ff64a6..bfe9600084 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs
@@ -624,7 +624,7 @@ namespace Godot
/// </summary>
/// <param name="s">The value to snap.</param>
/// <param name="step">The step size to snap to.</param>
- /// <returns></returns>
+ /// <returns>The snapped value.</returns>
public static real_t Snapped(real_t s, real_t step)
{
if (step != 0f)
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs
index 9bb73ce7dd..f15d01b34b 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs
@@ -44,7 +44,7 @@ namespace Godot
/// <summary>
/// Returns the amount of digits after the decimal place.
/// </summary>
- /// <param name="s">The input <see cref="decimal"/> value.</param>
+ /// <param name="s">The input <see langword="decimal"/> value.</param>
/// <returns>The amount of digits.</returns>
public static int DecimalCount(decimal s)
{
@@ -54,7 +54,7 @@ namespace Godot
/// <summary>
/// Rounds <paramref name="s"/> upward (towards positive infinity).
///
- /// This is the same as <see cref="Ceil(real_t)"/>, but returns an <c>int</c>.
+ /// This is the same as <see cref="Ceil(real_t)"/>, but returns an <see langword="int"/>.
/// </summary>
/// <param name="s">The number to ceil.</param>
/// <returns>The smallest whole number that is not less than <paramref name="s"/>.</returns>
@@ -66,7 +66,7 @@ namespace Godot
/// <summary>
/// Rounds <paramref name="s"/> downward (towards negative infinity).
///
- /// This is the same as <see cref="Floor(real_t)"/>, but returns an <c>int</c>.
+ /// This is the same as <see cref="Floor(real_t)"/>, but returns an <see langword="int"/>.
/// </summary>
/// <param name="s">The number to floor.</param>
/// <returns>The largest whole number that is not more than <paramref name="s"/>.</returns>
@@ -78,7 +78,7 @@ namespace Godot
/// <summary>
/// Rounds <paramref name="s"/> to the nearest whole number.
///
- /// This is the same as <see cref="Round(real_t)"/>, but returns an <c>int</c>.
+ /// This is the same as <see cref="Round(real_t)"/>, but returns an <see langword="int"/>.
/// </summary>
/// <param name="s">The number to round.</param>
/// <returns>The rounded number.</returns>
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NodePath.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NodePath.cs
index f53b5dc904..40fb5f8788 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NodePath.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NodePath.cs
@@ -122,7 +122,7 @@ namespace Godot
/// "/root/Level/Path2D"
/// </code>
/// </example>
- /// <param name="path"></param>
+ /// <param name="path">A string that represents a path in a scene tree.</param>
public NodePath(string path)
{
ptr = godot_icall_NodePath_Ctor(path);
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs
index dfb8e87bce..e38dca414f 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs
@@ -377,7 +377,7 @@ namespace Godot
/// <param name="basis">The <see cref="Basis"/> to construct from.</param>
public Quaternion(Basis basis)
{
- this = basis.Quaternion();
+ this = basis.GetQuaternion();
}
/// <summary>
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
index d9ee684c5b..68e6422c19 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs
@@ -415,6 +415,10 @@ namespace Godot
/// <summary>
/// Find the first occurrence of a substring. Optionally, the search starting position can be passed.
/// </summary>
+ /// <seealso cref="Find(string, char, int, bool)"/>
+ /// <seealso cref="FindLast(string, string, bool)"/>
+ /// <seealso cref="FindLast(string, string, int, bool)"/>
+ /// <seealso cref="FindN(string, string, int)"/>
/// <param name="instance">The string that will be searched.</param>
/// <param name="what">The substring to find.</param>
/// <param name="from">The search starting position.</param>
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
index 6f1d9574a8..8e253388bf 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
@@ -23,7 +23,6 @@ namespace Godot
/// <summary>
/// The basis matrix's X vector (column 0). Equivalent to array index <c>[0]</c>.
/// </summary>
- /// <value></value>
public Vector2 x;
/// <summary>
@@ -420,12 +419,12 @@ namespace Godot
/// Constructs a transformation matrix from the given components.
/// Arguments are named such that xy is equal to calling x.y
/// </summary>
- /// <param name="xx">The X component of the X column vector, accessed via <c>t.x.x</c> or <c>[0][0]</c></param>
- /// <param name="xy">The Y component of the X column vector, accessed via <c>t.x.y</c> or <c>[0][1]</c></param>
- /// <param name="yx">The X component of the Y column vector, accessed via <c>t.y.x</c> or <c>[1][0]</c></param>
- /// <param name="yy">The Y component of the Y column vector, accessed via <c>t.y.y</c> or <c>[1][1]</c></param>
- /// <param name="ox">The X component of the origin vector, accessed via <c>t.origin.x</c> or <c>[2][0]</c></param>
- /// <param name="oy">The Y component of the origin vector, accessed via <c>t.origin.y</c> or <c>[2][1]</c></param>
+ /// <param name="xx">The X component of the X column vector, accessed via <c>t.x.x</c> or <c>[0][0]</c>.</param>
+ /// <param name="xy">The Y component of the X column vector, accessed via <c>t.x.y</c> or <c>[0][1]</c>.</param>
+ /// <param name="yx">The X component of the Y column vector, accessed via <c>t.y.x</c> or <c>[1][0]</c>.</param>
+ /// <param name="yy">The Y component of the Y column vector, accessed via <c>t.y.y</c> or <c>[1][1]</c>.</param>
+ /// <param name="ox">The X component of the origin vector, accessed via <c>t.origin.x</c> or <c>[2][0]</c>.</param>
+ /// <param name="oy">The Y component of the origin vector, accessed via <c>t.origin.y</c> or <c>[2][1]</c>.</param>
public Transform2D(real_t xx, real_t xy, real_t yx, real_t yy, real_t ox, real_t oy)
{
x = new Vector2(xx, xy);
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
index 4bb8308c12..5d9aabdd2f 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
@@ -166,7 +166,7 @@ namespace Godot
/// Operations take place in global space.
/// </summary>
/// <param name="target">The object to look at.</param>
- /// <param name="up">The relative up direction</param>
+ /// <param name="up">The relative up direction.</param>
/// <returns>The resulting transform.</returns>
public Transform3D LookingAt(Vector3 target, Vector3 up)
{
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
index 0c3331900a..1f5282e88f 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
@@ -17,7 +17,7 @@ namespace Godot
{
/// <summary>
/// Enumerated index values for the axes.
- /// Returned by <see cref="MaxAxis"/> and <see cref="MinAxis"/>.
+ /// Returned by <see cref="MaxAxisIndex"/> and <see cref="MinAxisIndex"/>.
/// </summary>
public enum Axis
{
@@ -184,13 +184,13 @@ namespace Godot
}
/// <summary>
- /// Returns the cross product of this vector and <paramref name="b"/>.
+ /// Returns the cross product of this vector and <paramref name="with"/>.
/// </summary>
- /// <param name="b">The other vector.</param>
+ /// <param name="with">The other vector.</param>
/// <returns>The cross product value.</returns>
- public real_t Cross(Vector2 b)
+ public real_t Cross(Vector2 with)
{
- return (x * b.y) - (y * b.x);
+ return (x * with.y) - (y * with.x);
}
/// <summary>
@@ -222,13 +222,13 @@ namespace Godot
}
/// <summary>
- /// Returns the normalized vector pointing from this vector to <paramref name="b"/>.
+ /// Returns the normalized vector pointing from this vector to <paramref name="to"/>.
/// </summary>
- /// <param name="b">The other vector to point towards.</param>
- /// <returns>The direction from this vector to <paramref name="b"/>.</returns>
- public Vector2 DirectionTo(Vector2 b)
+ /// <param name="to">The other vector to point towards.</param>
+ /// <returns>The direction from this vector to <paramref name="to"/>.</returns>
+ public Vector2 DirectionTo(Vector2 to)
{
- return new Vector2(b.x - x, b.y - y).Normalized();
+ return new Vector2(to.x - x, to.y - y).Normalized();
}
/// <summary>
@@ -365,21 +365,21 @@ namespace Godot
}
/// <summary>
- /// Returns the axis of the vector's largest value. See <see cref="Axis"/>.
+ /// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
/// If both components are equal, this method returns <see cref="Axis.X"/>.
/// </summary>
- /// <returns>The index of the largest axis.</returns>
- public Axis MaxAxis()
+ /// <returns>The index of the highest axis.</returns>
+ public Axis MaxAxisIndex()
{
return x < y ? Axis.Y : Axis.X;
}
/// <summary>
- /// Returns the axis of the vector's smallest value. See <see cref="Axis"/>.
+ /// Returns the axis of the vector's lowest value. See <see cref="Axis"/>.
/// If both components are equal, this method returns <see cref="Axis.Y"/>.
/// </summary>
- /// <returns>The index of the smallest axis.</returns>
- public Axis MinAxis()
+ /// <returns>The index of the lowest axis.</returns>
+ public Axis MinAxisIndex()
{
return x < y ? Axis.X : Axis.Y;
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs
index 6cac16d53b..9b51de5c8c 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs
@@ -17,7 +17,7 @@ namespace Godot
{
/// <summary>
/// Enumerated index values for the axes.
- /// Returned by <see cref="MaxAxis"/> and <see cref="MinAxis"/>.
+ /// Returned by <see cref="MaxAxisIndex"/> and <see cref="MinAxisIndex"/>.
/// </summary>
public enum Axis
{
@@ -149,45 +149,45 @@ namespace Godot
}
/// <summary>
- /// Returns the cross product of this vector and <paramref name="b"/>.
+ /// Returns the cross product of this vector and <paramref name="with"/>.
/// </summary>
- /// <param name="b">The other vector.</param>
+ /// <param name="with">The other vector.</param>
/// <returns>The cross product vector.</returns>
- public int Cross(Vector2i b)
+ public int Cross(Vector2i with)
{
- return x * b.y - y * b.x;
+ return x * with.y - y * with.x;
}
/// <summary>
- /// Returns the squared distance between this vector and <paramref name="b"/>.
+ /// Returns the squared distance between this vector and <paramref name="to"/>.
/// This method runs faster than <see cref="DistanceTo"/>, so prefer it if
/// you need to compare vectors or need the squared distance for some formula.
/// </summary>
- /// <param name="b">The other vector to use.</param>
+ /// <param name="to">The other vector to use.</param>
/// <returns>The squared distance between the two vectors.</returns>
- public int DistanceSquaredTo(Vector2i b)
+ public int DistanceSquaredTo(Vector2i to)
{
- return (b - this).LengthSquared();
+ return (to - this).LengthSquared();
}
/// <summary>
- /// Returns the distance between this vector and <paramref name="b"/>.
+ /// Returns the distance between this vector and <paramref name="to"/>.
/// </summary>
- /// <param name="b">The other vector to use.</param>
+ /// <param name="to">The other vector to use.</param>
/// <returns>The distance between the two vectors.</returns>
- public real_t DistanceTo(Vector2i b)
+ public real_t DistanceTo(Vector2i to)
{
- return (b - this).Length();
+ return (to - this).Length();
}
/// <summary>
- /// Returns the dot product of this vector and <paramref name="b"/>.
+ /// Returns the dot product of this vector and <paramref name="with"/>.
/// </summary>
- /// <param name="b">The other vector to use.</param>
+ /// <param name="with">The other vector to use.</param>
/// <returns>The dot product of the two vectors.</returns>
- public int Dot(Vector2i b)
+ public int Dot(Vector2i with)
{
- return x * b.x + y * b.y;
+ return x * with.x + y * with.y;
}
/// <summary>
@@ -218,21 +218,21 @@ namespace Godot
}
/// <summary>
- /// Returns the axis of the vector's largest value. See <see cref="Axis"/>.
+ /// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
/// If both components are equal, this method returns <see cref="Axis.X"/>.
/// </summary>
- /// <returns>The index of the largest axis.</returns>
- public Axis MaxAxis()
+ /// <returns>The index of the highest axis.</returns>
+ public Axis MaxAxisIndex()
{
return x < y ? Axis.Y : Axis.X;
}
/// <summary>
- /// Returns the axis of the vector's smallest value. See <see cref="Axis"/>.
+ /// Returns the axis of the vector's lowest value. See <see cref="Axis"/>.
/// If both components are equal, this method returns <see cref="Axis.Y"/>.
/// </summary>
- /// <returns>The index of the smallest axis.</returns>
- public Axis MinAxis()
+ /// <returns>The index of the lowest axis.</returns>
+ public Axis MinAxisIndex()
{
return x < y ? Axis.X : Axis.Y;
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
index 63d9be0a6d..433a5d9dc9 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
@@ -17,7 +17,7 @@ namespace Godot
{
/// <summary>
/// Enumerated index values for the axes.
- /// Returned by <see cref="MaxAxis"/> and <see cref="MinAxis"/>.
+ /// Returned by <see cref="MaxAxisIndex"/> and <see cref="MinAxisIndex"/>.
/// </summary>
public enum Axis
{
@@ -170,17 +170,17 @@ namespace Godot
}
/// <summary>
- /// Returns the cross product of this vector and <paramref name="b"/>.
+ /// Returns the cross product of this vector and <paramref name="with"/>.
/// </summary>
- /// <param name="b">The other vector.</param>
+ /// <param name="with">The other vector.</param>
/// <returns>The cross product vector.</returns>
- public Vector3 Cross(Vector3 b)
+ public Vector3 Cross(Vector3 with)
{
return new Vector3
(
- (y * b.z) - (z * b.y),
- (z * b.x) - (x * b.z),
- (x * b.y) - (y * b.x)
+ (y * with.z) - (z * with.y),
+ (z * with.x) - (x * with.z),
+ (x * with.y) - (y * with.x)
);
}
@@ -212,46 +212,46 @@ namespace Godot
}
/// <summary>
- /// Returns the normalized vector pointing from this vector to <paramref name="b"/>.
+ /// Returns the normalized vector pointing from this vector to <paramref name="to"/>.
/// </summary>
- /// <param name="b">The other vector to point towards.</param>
- /// <returns>The direction from this vector to <paramref name="b"/>.</returns>
- public Vector3 DirectionTo(Vector3 b)
+ /// <param name="to">The other vector to point towards.</param>
+ /// <returns>The direction from this vector to <paramref name="to"/>.</returns>
+ public Vector3 DirectionTo(Vector3 to)
{
- return new Vector3(b.x - x, b.y - y, b.z - z).Normalized();
+ return new Vector3(to.x - x, to.y - y, to.z - z).Normalized();
}
/// <summary>
- /// Returns the squared distance between this vector and <paramref name="b"/>.
+ /// Returns the squared distance between this vector and <paramref name="to"/>.
/// This method runs faster than <see cref="DistanceTo"/>, so prefer it if
/// you need to compare vectors or need the squared distance for some formula.
/// </summary>
- /// <param name="b">The other vector to use.</param>
+ /// <param name="to">The other vector to use.</param>
/// <returns>The squared distance between the two vectors.</returns>
- public real_t DistanceSquaredTo(Vector3 b)
+ public real_t DistanceSquaredTo(Vector3 to)
{
- return (b - this).LengthSquared();
+ return (to - this).LengthSquared();
}
/// <summary>
- /// Returns the distance between this vector and <paramref name="b"/>.
+ /// Returns the distance between this vector and <paramref name="to"/>.
/// </summary>
/// <seealso cref="DistanceSquaredTo(Vector3)"/>
- /// <param name="b">The other vector to use.</param>
+ /// <param name="to">The other vector to use.</param>
/// <returns>The distance between the two vectors.</returns>
- public real_t DistanceTo(Vector3 b)
+ public real_t DistanceTo(Vector3 to)
{
- return (b - this).Length();
+ return (to - this).Length();
}
/// <summary>
- /// Returns the dot product of this vector and <paramref name="b"/>.
+ /// Returns the dot product of this vector and <paramref name="with"/>.
/// </summary>
- /// <param name="b">The other vector to use.</param>
+ /// <param name="with">The other vector to use.</param>
/// <returns>The dot product of the two vectors.</returns>
- public real_t Dot(Vector3 b)
+ public real_t Dot(Vector3 with)
{
- return (x * b.x) + (y * b.y) + (z * b.z);
+ return (x * with.x) + (y * with.y) + (z * with.z);
}
/// <summary>
@@ -364,21 +364,21 @@ namespace Godot
}
/// <summary>
- /// Returns the axis of the vector's largest value. See <see cref="Axis"/>.
+ /// 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"/>.
/// </summary>
- /// <returns>The index of the largest axis.</returns>
- public Axis MaxAxis()
+ /// <returns>The index of the highest axis.</returns>
+ public Axis MaxAxisIndex()
{
return x < y ? (y < z ? Axis.Z : Axis.Y) : (x < z ? Axis.Z : Axis.X);
}
/// <summary>
- /// Returns the axis of the vector's smallest value. See <see cref="Axis"/>.
+ /// Returns the axis of the vector's lowest value. See <see cref="Axis"/>.
/// If all components are equal, this method returns <see cref="Axis.Z"/>.
/// </summary>
- /// <returns>The index of the smallest axis.</returns>
- public Axis MinAxis()
+ /// <returns>The index of the lowest axis.</returns>
+ public Axis MinAxisIndex()
{
return x < y ? (x < z ? Axis.X : Axis.Z) : (y < z ? Axis.Y : Axis.Z);
}
@@ -412,16 +412,16 @@ namespace Godot
}
/// <summary>
- /// Returns the outer product with <paramref name="b"/>.
+ /// Returns the outer product with <paramref name="with"/>.
/// </summary>
- /// <param name="b">The other vector.</param>
+ /// <param name="with">The other vector.</param>
/// <returns>A <see cref="Basis"/> representing the outer product matrix.</returns>
- public Basis Outer(Vector3 b)
+ public Basis Outer(Vector3 with)
{
return new Basis(
- x * b.x, x * b.y, x * b.z,
- y * b.x, y * b.y, y * b.z,
- z * b.x, z * b.y, z * b.z
+ x * with.x, x * with.y, x * with.z,
+ y * with.x, y * with.y, y * with.z,
+ z * with.x, z * with.y, z * with.z
);
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs
index 474876fc91..eb06d2b87e 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs
@@ -17,7 +17,7 @@ namespace Godot
{
/// <summary>
/// Enumerated index values for the axes.
- /// Returned by <see cref="MaxAxis"/> and <see cref="MinAxis"/>.
+ /// Returned by <see cref="MaxAxisIndex"/> and <see cref="MinAxisIndex"/>.
/// </summary>
public enum Axis
{
@@ -124,36 +124,36 @@ namespace Godot
}
/// <summary>
- /// Returns the squared distance between this vector and <paramref name="b"/>.
+ /// Returns the squared distance between this vector and <paramref name="to"/>.
/// This method runs faster than <see cref="DistanceTo"/>, so prefer it if
/// you need to compare vectors or need the squared distance for some formula.
/// </summary>
- /// <param name="b">The other vector to use.</param>
+ /// <param name="to">The other vector to use.</param>
/// <returns>The squared distance between the two vectors.</returns>
- public int DistanceSquaredTo(Vector3i b)
+ public int DistanceSquaredTo(Vector3i to)
{
- return (b - this).LengthSquared();
+ return (to - this).LengthSquared();
}
/// <summary>
- /// Returns the distance between this vector and <paramref name="b"/>.
+ /// Returns the distance between this vector and <paramref name="to"/>.
/// </summary>
/// <seealso cref="DistanceSquaredTo(Vector3i)"/>
- /// <param name="b">The other vector to use.</param>
+ /// <param name="to">The other vector to use.</param>
/// <returns>The distance between the two vectors.</returns>
- public real_t DistanceTo(Vector3i b)
+ public real_t DistanceTo(Vector3i to)
{
- return (b - this).Length();
+ return (to - this).Length();
}
/// <summary>
- /// Returns the dot product of this vector and <paramref name="b"/>.
+ /// Returns the dot product of this vector and <paramref name="with"/>.
/// </summary>
- /// <param name="b">The other vector to use.</param>
+ /// <param name="with">The other vector to use.</param>
/// <returns>The dot product of the two vectors.</returns>
- public int Dot(Vector3i b)
+ public int Dot(Vector3i with)
{
- return x * b.x + y * b.y + z * b.z;
+ return x * with.x + y * with.y + z * with.z;
}
/// <summary>
@@ -186,21 +186,21 @@ namespace Godot
}
/// <summary>
- /// Returns the axis of the vector's largest value. See <see cref="Axis"/>.
+ /// 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"/>.
/// </summary>
- /// <returns>The index of the largest axis.</returns>
- public Axis MaxAxis()
+ /// <returns>The index of the highest axis.</returns>
+ public Axis MaxAxisIndex()
{
return x < y ? (y < z ? Axis.Z : Axis.Y) : (x < z ? Axis.Z : Axis.X);
}
/// <summary>
- /// Returns the axis of the vector's smallest value. See <see cref="Axis"/>.
+ /// Returns the axis of the vector's lowest value. See <see cref="Axis"/>.
/// If all components are equal, this method returns <see cref="Axis.Z"/>.
/// </summary>
- /// <returns>The index of the smallest axis.</returns>
- public Axis MinAxis()
+ /// <returns>The index of the lowest axis.</returns>
+ public Axis MinAxisIndex()
{
return x < y ? (x < z ? Axis.X : Axis.Z) : (y < z ? Axis.Y : Axis.Z);
}
diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp
index 24bd1ed492..2b4cc7fcc3 100644
--- a/modules/mono/godotsharp_dirs.cpp
+++ b/modules/mono/godotsharp_dirs.cpp
@@ -229,9 +229,6 @@ private:
#endif
}
- _GodotSharpDirs(const _GodotSharpDirs &);
- _GodotSharpDirs &operator=(const _GodotSharpDirs &);
-
public:
static _GodotSharpDirs &get_singleton() {
static _GodotSharpDirs singleton;
diff --git a/modules/mono/mono_gc_handle.h b/modules/mono/mono_gc_handle.h
index d0e51d159f..a18a4ce646 100644
--- a/modules/mono/mono_gc_handle.h
+++ b/modules/mono/mono_gc_handle.h
@@ -56,13 +56,12 @@ struct MonoGCHandleData {
void release();
- MonoGCHandleData &operator=(const MonoGCHandleData &p_other) {
+ void operator=(const MonoGCHandleData &p_other) {
#ifdef DEBUG_ENABLED
CRASH_COND(!is_released());
#endif
handle = p_other.handle;
type = p_other.type;
- return *this;
}
MonoGCHandleData(const MonoGCHandleData &) = default;
diff --git a/modules/mono/mono_gd/gd_mono_cache.cpp b/modules/mono/mono_gd/gd_mono_cache.cpp
index 2bf55493e0..60277e0652 100644
--- a/modules/mono/mono_gd/gd_mono_cache.cpp
+++ b/modules/mono/mono_gd/gd_mono_cache.cpp
@@ -177,6 +177,8 @@ void CachedData::clear_godot_api_cache() {
methodthunk_MarshalUtils_TypeIsGenericICollection.nullify();
methodthunk_MarshalUtils_TypeIsGenericIDictionary.nullify();
+ methodthunk_MarshalUtils_GetGenericTypeDefinition.nullify();
+
methodthunk_MarshalUtils_ArrayGetElementType.nullify();
methodthunk_MarshalUtils_DictionaryGetKeyValueTypes.nullify();
@@ -299,6 +301,8 @@ void update_godot_api_cache() {
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, TypeIsGenericICollection, GODOT_API_CLASS(MarshalUtils)->get_method("TypeIsGenericICollection", 1));
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, TypeIsGenericIDictionary, GODOT_API_CLASS(MarshalUtils)->get_method("TypeIsGenericIDictionary", 1));
+ CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, GetGenericTypeDefinition, GODOT_API_CLASS(MarshalUtils)->get_method("GetGenericTypeDefinition", 2));
+
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, ArrayGetElementType, GODOT_API_CLASS(MarshalUtils)->get_method("ArrayGetElementType", 2));
CACHE_METHOD_THUNK_AND_CHECK(MarshalUtils, DictionaryGetKeyValueTypes, GODOT_API_CLASS(MarshalUtils)->get_method("DictionaryGetKeyValueTypes", 3));
diff --git a/modules/mono/mono_gd/gd_mono_cache.h b/modules/mono/mono_gd/gd_mono_cache.h
index 4b4688b4d9..5101907bd6 100644
--- a/modules/mono/mono_gd/gd_mono_cache.h
+++ b/modules/mono/mono_gd/gd_mono_cache.h
@@ -148,6 +148,8 @@ struct CachedData {
GDMonoMethodThunkR<MonoBoolean, MonoReflectionType *> methodthunk_MarshalUtils_TypeIsGenericICollection;
GDMonoMethodThunkR<MonoBoolean, MonoReflectionType *> methodthunk_MarshalUtils_TypeIsGenericIDictionary;
+ GDMonoMethodThunk<MonoReflectionType *, MonoReflectionType **> methodthunk_MarshalUtils_GetGenericTypeDefinition;
+
GDMonoMethodThunk<MonoReflectionType *, MonoReflectionType **> methodthunk_MarshalUtils_ArrayGetElementType;
GDMonoMethodThunk<MonoReflectionType *, MonoReflectionType **, MonoReflectionType **> methodthunk_MarshalUtils_DictionaryGetKeyValueTypes;
diff --git a/modules/mono/mono_gd/gd_mono_class.cpp b/modules/mono/mono_gd/gd_mono_class.cpp
index 4f4480fa49..520568071e 100644
--- a/modules/mono/mono_gd/gd_mono_class.cpp
+++ b/modules/mono/mono_gd/gd_mono_class.cpp
@@ -464,9 +464,18 @@ const Vector<GDMonoClass *> &GDMonoClass::get_all_delegates() {
return delegates_list;
}
+ // If the class is generic we must use the generic type definition.
+ MonoClass *klass = mono_class;
+ if (mono_type_get_type(get_mono_type()) == MONO_TYPE_GENERICINST) {
+ MonoReflectionType *reftype = mono_type_get_object(mono_domain_get(), get_mono_type());
+ GDMonoUtils::Marshal::get_generic_type_definition(reftype, &reftype);
+ MonoType *type = mono_reflection_type_get_type(reftype);
+ klass = mono_class_from_mono_type(type);
+ }
+
void *iter = nullptr;
MonoClass *raw_class = nullptr;
- while ((raw_class = mono_class_get_nested_types(mono_class, &iter)) != nullptr) {
+ while ((raw_class = mono_class_get_nested_types(klass, &iter)) != nullptr) {
if (mono_class_is_delegate(raw_class)) {
StringName name = String::utf8(mono_class_get_name(raw_class));
diff --git a/modules/mono/mono_gd/gd_mono_log.cpp b/modules/mono/mono_gd/gd_mono_log.cpp
index 179bbfb40c..bcdcd6623b 100644
--- a/modules/mono/mono_gd/gd_mono_log.cpp
+++ b/modules/mono/mono_gd/gd_mono_log.cpp
@@ -121,12 +121,10 @@ void GDMonoLog::_delete_old_log_files(const String &p_logs_dir) {
ERR_FAIL_COND(da->list_dir_begin() != OK);
- String current;
- while ((current = da->get_next()).length()) {
- if (da->current_is_dir()) {
- continue;
- }
- if (!current.ends_with(".txt")) {
+ String current = da->get_next();
+ while (!current.is_empty()) {
+ if (da->current_is_dir() || !current.ends_with(".txt")) {
+ current = da->get_next();
continue;
}
@@ -135,6 +133,7 @@ void GDMonoLog::_delete_old_log_files(const String &p_logs_dir) {
if (OS::get_singleton()->get_unix_time() - modified_time > MAX_SECS) {
da->remove(current);
}
+ current = da->get_next();
}
da->list_dir_end();
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
index 09aa9ad948..505c637af9 100644
--- a/modules/mono/mono_gd/gd_mono_utils.cpp
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -614,6 +614,12 @@ bool type_is_generic_idictionary(MonoReflectionType *p_reftype) {
return (bool)res;
}
+void get_generic_type_definition(MonoReflectionType *p_reftype, MonoReflectionType **r_generic_reftype) {
+ MonoException *exc = nullptr;
+ CACHED_METHOD_THUNK(MarshalUtils, GetGenericTypeDefinition).invoke(p_reftype, r_generic_reftype, &exc);
+ UNHANDLED_EXCEPTION(exc);
+}
+
void array_get_element_type(MonoReflectionType *p_array_reftype, MonoReflectionType **r_elem_reftype) {
MonoException *exc = nullptr;
CACHED_METHOD_THUNK(MarshalUtils, ArrayGetElementType).invoke(p_array_reftype, r_elem_reftype, &exc);
diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h
index 773501e93d..3162ef198d 100644
--- a/modules/mono/mono_gd/gd_mono_utils.h
+++ b/modules/mono/mono_gd/gd_mono_utils.h
@@ -62,6 +62,8 @@ bool type_is_generic_ienumerable(MonoReflectionType *p_reftype);
bool type_is_generic_icollection(MonoReflectionType *p_reftype);
bool type_is_generic_idictionary(MonoReflectionType *p_reftype);
+void get_generic_type_definition(MonoReflectionType *p_reftype, MonoReflectionType **r_generic_reftype);
+
void array_get_element_type(MonoReflectionType *p_array_reftype, MonoReflectionType **r_elem_reftype);
void dictionary_get_key_value_types(MonoReflectionType *p_dict_reftype, MonoReflectionType **r_key_reftype, MonoReflectionType **r_value_reftype);