summaryrefslogtreecommitdiff
path: root/modules/mono/editor/Godot.NET.Sdk
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mono/editor/Godot.NET.Sdk')
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Bar.cs4
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/EventSignals.cs2
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedFields.cs20
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs20
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Foo.cs2
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Generic.cs6
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Methods.cs2
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/MoreExportedFields.cs2
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Common.cs8
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs2
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotClasses.cs4
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotEnums.cs43
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs4
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalType.cs14
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalUtils.cs36
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MustBeVariantAnalyzer.cs24
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs6
-rw-r--r--modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs33
18 files changed, 145 insertions, 87 deletions
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Bar.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Bar.cs
index 5eaebc4474..2d797e2f46 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Bar.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Bar.cs
@@ -1,6 +1,6 @@
namespace Godot.SourceGenerators.Sample
{
- partial class Bar : Godot.Object
+ partial class Bar : GodotObject
{
}
@@ -9,7 +9,7 @@ namespace Godot.SourceGenerators.Sample
{
}
- partial class NotSameNameAsFile : Godot.Object
+ partial class NotSameNameAsFile : GodotObject
{
}
}
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/EventSignals.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/EventSignals.cs
index 764ba8f121..ee6aa857fc 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/EventSignals.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/EventSignals.cs
@@ -1,6 +1,6 @@
namespace Godot.SourceGenerators.Sample;
-public partial class EventSignals : Godot.Object
+public partial class EventSignals : GodotObject
{
[Signal]
public delegate void MySignalEventHandler(string str, int num);
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedFields.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedFields.cs
index ccaba4d727..31e66ac306 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedFields.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedFields.cs
@@ -11,7 +11,7 @@ namespace Godot.SourceGenerators.Sample
[SuppressMessage("ReSharper", "RedundantNameQualifier")]
[SuppressMessage("ReSharper", "ArrangeObjectCreationWhenTypeEvident")]
[SuppressMessage("ReSharper", "InconsistentNaming")]
- public partial class ExportedFields : Godot.Object
+ public partial class ExportedFields : GodotObject
{
[Export] private Boolean field_Boolean = true;
[Export] private Char field_Char = 'f';
@@ -29,19 +29,19 @@ namespace Godot.SourceGenerators.Sample
// Godot structs
[Export] private Vector2 field_Vector2 = new(10f, 10f);
- [Export] private Vector2i field_Vector2i = Vector2i.Up;
+ [Export] private Vector2I field_Vector2I = Vector2I.Up;
[Export] private Rect2 field_Rect2 = new(new Vector2(10f, 10f), new Vector2(10f, 10f));
- [Export] private Rect2i field_Rect2i = new(new Vector2i(10, 10), new Vector2i(10, 10));
+ [Export] private Rect2I field_Rect2I = new(new Vector2I(10, 10), new Vector2I(10, 10));
[Export] private Transform2D field_Transform2D = Transform2D.Identity;
[Export] private Vector3 field_Vector3 = new(10f, 10f, 10f);
- [Export] private Vector3i field_Vector3i = Vector3i.Back;
+ [Export] private Vector3I field_Vector3I = Vector3I.Back;
[Export] private Basis field_Basis = new Basis(Quaternion.Identity);
[Export] private Quaternion field_Quaternion = new Quaternion(Basis.Identity);
[Export] private Transform3D field_Transform3D = Transform3D.Identity;
[Export] private Vector4 field_Vector4 = new(10f, 10f, 10f, 10f);
- [Export] private Vector4i field_Vector4i = Vector4i.One;
+ [Export] private Vector4I field_Vector4I = Vector4I.One;
[Export] private Projection field_Projection = Projection.Identity;
- [Export] private AABB field_AABB = new AABB(10f, 10f, 10f, new Vector3(1f, 1f, 1f));
+ [Export] private Aabb field_Aabb = new Aabb(10f, 10f, 10f, new Vector3(1f, 1f, 1f));
[Export] private Color field_Color = Colors.Aquamarine;
[Export] private Plane field_Plane = Plane.PlaneXZ;
[Export] private Callable field_Callable = new Callable(Engine.GetMainLoop(), "_process");
@@ -80,10 +80,10 @@ namespace Godot.SourceGenerators.Sample
[Export] private Vector2[] field_Vector2Array = { Vector2.Up, Vector2.Down, Vector2.Left, Vector2.Right };
[Export] private Vector3[] field_Vector3Array = { Vector3.Up, Vector3.Down, Vector3.Left, Vector3.Right };
[Export] private Color[] field_ColorArray = { Colors.Aqua, Colors.Aquamarine, Colors.Azure, Colors.Beige };
- [Export] private Godot.Object[] field_GodotObjectOrDerivedArray = { null };
+ [Export] private GodotObject[] field_GodotObjectOrDerivedArray = { null };
[Export] private StringName[] field_StringNameArray = { "foo", "bar" };
[Export] private NodePath[] field_NodePathArray = { "foo", "bar" };
- [Export] private RID[] field_RIDArray = { default, default, default };
+ [Export] private Rid[] field_RidArray = { default, default, default };
// Note we use Array and not System.Array. This tests the generated namespace qualification.
[Export] private Int32[] field_empty_Int32Array = Array.Empty<Int32>();
// Note we use List and not System.Collections.Generic.
@@ -93,11 +93,11 @@ namespace Godot.SourceGenerators.Sample
[Export] private Variant field_Variant = "foo";
// Classes
- [Export] private Godot.Object field_GodotObjectOrDerived;
+ [Export] private GodotObject field_GodotObjectOrDerived;
[Export] private Godot.Texture field_GodotResourceTexture;
[Export] private StringName field_StringName = new StringName("foo");
[Export] private NodePath field_NodePath = new NodePath("foo");
- [Export] private RID field_RID;
+ [Export] private Rid field_Rid;
[Export]
private Godot.Collections.Dictionary field_GodotDictionary =
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs
index 5afaeb736f..aef2a8824e 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedProperties.cs
@@ -10,7 +10,7 @@ namespace Godot.SourceGenerators.Sample
[SuppressMessage("ReSharper", "RedundantNameQualifier")]
[SuppressMessage("ReSharper", "ArrangeObjectCreationWhenTypeEvident")]
[SuppressMessage("ReSharper", "InconsistentNaming")]
- public partial class ExportedProperties : Godot.Object
+ public partial class ExportedProperties : GodotObject
{
// Do not generate default value
private String _notGenerate_Property_String = new string("not generate");
@@ -117,19 +117,19 @@ namespace Godot.SourceGenerators.Sample
// Godot structs
[Export] private Vector2 property_Vector2 { get; set; } = new(10f, 10f);
- [Export] private Vector2i property_Vector2i { get; set; } = Vector2i.Up;
+ [Export] private Vector2I property_Vector2I { get; set; } = Vector2I.Up;
[Export] private Rect2 property_Rect2 { get; set; } = new(new Vector2(10f, 10f), new Vector2(10f, 10f));
- [Export] private Rect2i property_Rect2i { get; set; } = new(new Vector2i(10, 10), new Vector2i(10, 10));
+ [Export] private Rect2I property_Rect2I { get; set; } = new(new Vector2I(10, 10), new Vector2I(10, 10));
[Export] private Transform2D property_Transform2D { get; set; } = Transform2D.Identity;
[Export] private Vector3 property_Vector3 { get; set; } = new(10f, 10f, 10f);
- [Export] private Vector3i property_Vector3i { get; set; } = Vector3i.Back;
+ [Export] private Vector3I property_Vector3I { get; set; } = Vector3I.Back;
[Export] private Basis property_Basis { get; set; } = new Basis(Quaternion.Identity);
[Export] private Quaternion property_Quaternion { get; set; } = new Quaternion(Basis.Identity);
[Export] private Transform3D property_Transform3D { get; set; } = Transform3D.Identity;
[Export] private Vector4 property_Vector4 { get; set; } = new(10f, 10f, 10f, 10f);
- [Export] private Vector4i property_Vector4i { get; set; } = Vector4i.One;
+ [Export] private Vector4I property_Vector4I { get; set; } = Vector4I.One;
[Export] private Projection property_Projection { get; set; } = Projection.Identity;
- [Export] private AABB property_AABB { get; set; } = new AABB(10f, 10f, 10f, new Vector3(1f, 1f, 1f));
+ [Export] private Aabb property_Aabb { get; set; } = new Aabb(10f, 10f, 10f, new Vector3(1f, 1f, 1f));
[Export] private Color property_Color { get; set; } = Colors.Aquamarine;
[Export] private Plane property_Plane { get; set; } = Plane.PlaneXZ;
[Export] private Callable property_Callable { get; set; } = new Callable(Engine.GetMainLoop(), "_process");
@@ -168,20 +168,20 @@ namespace Godot.SourceGenerators.Sample
[Export] private Vector2[] property_Vector2Array { get; set; } = { Vector2.Up, Vector2.Down, Vector2.Left, Vector2.Right };
[Export] private Vector3[] property_Vector3Array { get; set; } = { Vector3.Up, Vector3.Down, Vector3.Left, Vector3.Right };
[Export] private Color[] property_ColorArray { get; set; } = { Colors.Aqua, Colors.Aquamarine, Colors.Azure, Colors.Beige };
- [Export] private Godot.Object[] property_GodotObjectOrDerivedArray { get; set; } = { null };
+ [Export] private GodotObject[] property_GodotObjectOrDerivedArray { get; set; } = { null };
[Export] private StringName[] field_StringNameArray { get; set; } = { "foo", "bar" };
[Export] private NodePath[] field_NodePathArray { get; set; } = { "foo", "bar" };
- [Export] private RID[] field_RIDArray { get; set; } = { default, default, default };
+ [Export] private Rid[] field_RidArray { get; set; } = { default, default, default };
// Variant
[Export] private Variant property_Variant { get; set; } = "foo";
// Classes
- [Export] private Godot.Object property_GodotObjectOrDerived { get; set; }
+ [Export] private GodotObject property_GodotObjectOrDerived { get; set; }
[Export] private Godot.Texture property_GodotResourceTexture { get; set; }
[Export] private StringName property_StringName { get; set; } = new StringName("foo");
[Export] private NodePath property_NodePath { get; set; } = new NodePath("foo");
- [Export] private RID property_RID { get; set; }
+ [Export] private Rid property_Rid { get; set; }
[Export]
private Godot.Collections.Dictionary property_GodotDictionary { get; set; } =
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Foo.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Foo.cs
index 21a5bfe560..9ef72d9e02 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Foo.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Foo.cs
@@ -1,6 +1,6 @@
namespace Godot.SourceGenerators.Sample
{
- partial class Foo : Godot.Object
+ partial class Foo : GodotObject
{
}
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
index b21b035b4d..2cd1a08c0e 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Generic.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Generic.cs
@@ -2,19 +2,19 @@
namespace Godot.SourceGenerators.Sample
{
- partial class Generic<T> : Godot.Object
+ partial class Generic<T> : GodotObject
{
private int _field;
}
// Generic again but different generic parameters
- partial class Generic<T, R> : Godot.Object
+ partial class Generic<T, R> : GodotObject
{
private int _field;
}
// Generic again but without generic parameters
- partial class Generic : Godot.Object
+ partial class Generic : GodotObject
{
private int _field;
}
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Methods.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Methods.cs
index 618ba24abc..9aa6be3972 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Methods.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/Methods.cs
@@ -3,7 +3,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Godot.SourceGenerators.Sample;
[SuppressMessage("ReSharper", "RedundantNameQualifier")]
-public partial class Methods : Godot.Object
+public partial class Methods : GodotObject
{
private void MethodWithOverload()
{
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/MoreExportedFields.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/MoreExportedFields.cs
index a6c8e52667..64088215e9 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/MoreExportedFields.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/MoreExportedFields.cs
@@ -11,7 +11,7 @@ namespace Godot.SourceGenerators.Sample
[SuppressMessage("ReSharper", "ArrangeObjectCreationWhenTypeEvident")]
[SuppressMessage("ReSharper", "InconsistentNaming")]
// We split the definition of ExportedFields to verify properties work across multiple files.
- public partial class ExportedFields : Godot.Object
+ public partial class ExportedFields : GodotObject
{
// Note we use Array and not System.Array. This tests the generated namespace qualification.
[Export] private Int64[] field_empty_Int64Array = Array.Empty<Int64>();
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Common.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Common.cs
index 4eed2d7b7b..41bf89e6d8 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Common.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Common.cs
@@ -14,9 +14,9 @@ namespace Godot.SourceGenerators
{
string message =
"Missing partial modifier on declaration of type '" +
- $"{symbol.FullQualifiedNameOmitGlobal()}' which is a subclass of '{GodotClasses.Object}'";
+ $"{symbol.FullQualifiedNameOmitGlobal()}' which is a subclass of '{GodotClasses.GodotObject}'";
- string description = $"{message}. Subclasses of '{GodotClasses.Object}' " +
+ string description = $"{message}. Subclasses of '{GodotClasses.GodotObject}' " +
"must be declared with the partial modifier.";
context.ReportDiagnostic(Diagnostic.Create(
@@ -46,9 +46,9 @@ namespace Godot.SourceGenerators
string message =
$"Missing partial modifier on declaration of type '{fullQualifiedName}', " +
- $"which contains one or more subclasses of '{GodotClasses.Object}'";
+ $"which contains one or more subclasses of '{GodotClasses.GodotObject}'";
- string description = $"{message}. Subclasses of '{GodotClasses.Object}' and their " +
+ string description = $"{message}. Subclasses of '{GodotClasses.GodotObject}' and their " +
"containing types must be declared with the partial modifier.";
context.ReportDiagnostic(Diagnostic.Create(
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs
index 8852b7ebad..f0c9043fd5 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs
@@ -85,7 +85,7 @@ namespace Godot.SourceGenerators
var classTypeSymbol = sm.GetDeclaredSymbol(cds);
if (classTypeSymbol?.BaseType == null
- || !classTypeSymbol.BaseType.InheritsFrom("GodotSharp", GodotClasses.Object))
+ || !classTypeSymbol.BaseType.InheritsFrom("GodotSharp", GodotClasses.GodotObject))
{
symbol = null;
return false;
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotClasses.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotClasses.cs
index 1d8ddbabf2..b60148b34f 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotClasses.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotClasses.cs
@@ -2,7 +2,7 @@ namespace Godot.SourceGenerators
{
public static class GodotClasses
{
- public const string Object = "Godot.Object";
+ public const string GodotObject = "Godot.GodotObject";
public const string AssemblyHasScriptsAttr = "Godot.AssemblyHasScriptsAttribute";
public const string ExportAttr = "Godot.ExportAttribute";
public const string ExportCategoryAttr = "Godot.ExportCategoryAttribute";
@@ -10,7 +10,7 @@ namespace Godot.SourceGenerators
public const string ExportSubgroupAttr = "Godot.ExportSubgroupAttribute";
public const string SignalAttr = "Godot.SignalAttribute";
public const string MustBeVariantAttr = "Godot.MustBeVariantAttribute";
- public const string GodotClassNameAttr = "Godot.GodotClassName";
+ public const string GodotClassNameAttr = "Godot.GodotClassNameAttribute";
public const string SystemFlagsAttr = "System.FlagsAttribute";
}
}
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotEnums.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotEnums.cs
index 5fb29b86da..b30c8c240e 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotEnums.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotEnums.cs
@@ -12,19 +12,19 @@ namespace Godot.SourceGenerators
Float = 3,
String = 4,
Vector2 = 5,
- Vector2i = 6,
+ Vector2I = 6,
Rect2 = 7,
- Rect2i = 8,
+ Rect2I = 8,
Vector3 = 9,
- Vector3i = 10,
- Transform2d = 11,
+ Vector3I = 10,
+ Transform2D = 11,
Vector4 = 12,
- Vector4i = 13,
+ Vector4I = 13,
Plane = 14,
Quaternion = 15,
Aabb = 16,
Basis = 17,
- Transform3d = 18,
+ Transform3D = 18,
Projection = 19,
Color = 20,
StringName = 21,
@@ -56,12 +56,12 @@ namespace Godot.SourceGenerators
ExpEasing = 4,
Link = 5,
Flags = 6,
- Layers2dRender = 7,
- Layers2dPhysics = 8,
- Layers2dNavigation = 9,
- Layers3dRender = 10,
- Layers3dPhysics = 11,
- Layers3dNavigation = 12,
+ Layers2DRender = 7,
+ Layers2DPhysics = 8,
+ Layers2DNavigation = 9,
+ Layers3DRender = 10,
+ Layers3DPhysics = 11,
+ Layers3DNavigation = 12,
File = 13,
Dir = 14,
GlobalFile = 15,
@@ -111,15 +111,16 @@ namespace Godot.SourceGenerators
ClassIsEnum = 65536,
NilIsVariant = 131072,
Array = 262144,
- DoNotShareOnDuplicate = 524288,
- HighEndGfx = 1048576,
- NodePathFromSceneRoot = 2097152,
- ResourceNotPersistent = 4194304,
- KeyingIncrements = 8388608,
- DeferredSetResource = 16777216,
- EditorInstantiateObject = 33554432,
- EditorBasicSetting = 67108864,
- ReadOnly = 134217728,
+ AlwaysDuplicate = 524288,
+ NeverDuplicate = 1048576,
+ HighEndGfx = 2097152,
+ NodePathFromSceneRoot = 4194304,
+ ResourceNotPersistent = 8388608,
+ KeyingIncrements = 16777216,
+ DeferredSetResource = 33554432,
+ EditorInstantiateObject = 67108864,
+ EditorBasicSetting = 134217728,
+ ReadOnly = 268435456,
Default = 6,
NoEditor = 2
}
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs
index 19fdd51dab..813bdf1e9f 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/GodotPluginsInitializerGenerator.cs
@@ -34,7 +34,7 @@ namespace GodotPlugins.Game
{
DllImportResolver dllImportResolver = new GodotDllImportResolver(godotDllHandle).OnResolveDllImport;
- var coreApiAssembly = typeof(Godot.Object).Assembly;
+ var coreApiAssembly = typeof(global::Godot.GodotObject).Assembly;
NativeLibrary.SetDllImportResolver(coreApiAssembly, dllImportResolver);
@@ -42,7 +42,7 @@ namespace GodotPlugins.Game
ManagedCallbacks.Create(outManagedCallbacks);
- ScriptManagerBridge.LookupScriptsInAssembly(typeof(GodotPlugins.Game.Main).Assembly);
+ ScriptManagerBridge.LookupScriptsInAssembly(typeof(global::GodotPlugins.Game.Main).Assembly);
return godot_bool.True;
}
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalType.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalType.cs
index ee1374d0b9..be6af117eb 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalType.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalType.cs
@@ -21,19 +21,19 @@ namespace Godot.SourceGenerators
// Godot structs
Vector2,
- Vector2i,
+ Vector2I,
Rect2,
- Rect2i,
+ Rect2I,
Transform2D,
Vector3,
- Vector3i,
+ Vector3I,
Basis,
Quaternion,
Transform3D,
Vector4,
- Vector4i,
+ Vector4I,
Projection,
- AABB,
+ Aabb,
Color,
Plane,
Callable,
@@ -55,7 +55,7 @@ namespace Godot.SourceGenerators
GodotObjectOrDerivedArray,
SystemArrayOfStringName,
SystemArrayOfNodePath,
- SystemArrayOfRID,
+ SystemArrayOfRid,
// Variant
Variant,
@@ -64,7 +64,7 @@ namespace Godot.SourceGenerators
GodotObjectOrDerived,
StringName,
NodePath,
- RID,
+ Rid,
GodotDictionary,
GodotArray,
GodotGenericDictionary,
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalUtils.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalUtils.cs
index f0a6a72281..0258f53062 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalUtils.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MarshalUtils.cs
@@ -19,7 +19,7 @@ namespace Godot.SourceGenerators
throw new InvalidOperationException($"Type not found: '{fullyQualifiedMetadataName}'.");
}
- GodotObjectType = GetTypeByMetadataNameOrThrow("Godot.Object");
+ GodotObjectType = GetTypeByMetadataNameOrThrow(GodotClasses.GodotObject);
}
}
@@ -40,19 +40,19 @@ namespace Godot.SourceGenerators
MarshalType.Double => VariantType.Float,
MarshalType.String => VariantType.String,
MarshalType.Vector2 => VariantType.Vector2,
- MarshalType.Vector2i => VariantType.Vector2i,
+ MarshalType.Vector2I => VariantType.Vector2I,
MarshalType.Rect2 => VariantType.Rect2,
- MarshalType.Rect2i => VariantType.Rect2i,
- MarshalType.Transform2D => VariantType.Transform2d,
+ MarshalType.Rect2I => VariantType.Rect2I,
+ MarshalType.Transform2D => VariantType.Transform2D,
MarshalType.Vector3 => VariantType.Vector3,
- MarshalType.Vector3i => VariantType.Vector3i,
+ MarshalType.Vector3I => VariantType.Vector3I,
MarshalType.Basis => VariantType.Basis,
MarshalType.Quaternion => VariantType.Quaternion,
- MarshalType.Transform3D => VariantType.Transform3d,
+ MarshalType.Transform3D => VariantType.Transform3D,
MarshalType.Vector4 => VariantType.Vector4,
- MarshalType.Vector4i => VariantType.Vector4i,
+ MarshalType.Vector4I => VariantType.Vector4I,
MarshalType.Projection => VariantType.Projection,
- MarshalType.AABB => VariantType.Aabb,
+ MarshalType.Aabb => VariantType.Aabb,
MarshalType.Color => VariantType.Color,
MarshalType.Plane => VariantType.Plane,
MarshalType.Callable => VariantType.Callable,
@@ -70,12 +70,12 @@ namespace Godot.SourceGenerators
MarshalType.GodotObjectOrDerivedArray => VariantType.Array,
MarshalType.SystemArrayOfStringName => VariantType.Array,
MarshalType.SystemArrayOfNodePath => VariantType.Array,
- MarshalType.SystemArrayOfRID => VariantType.Array,
+ MarshalType.SystemArrayOfRid => VariantType.Array,
MarshalType.Variant => VariantType.Nil,
MarshalType.GodotObjectOrDerived => VariantType.Object,
MarshalType.StringName => VariantType.StringName,
MarshalType.NodePath => VariantType.NodePath,
- MarshalType.RID => VariantType.Rid,
+ MarshalType.Rid => VariantType.Rid,
MarshalType.GodotDictionary => VariantType.Dictionary,
MarshalType.GodotArray => VariantType.Array,
MarshalType.GodotGenericDictionary => VariantType.Dictionary,
@@ -130,22 +130,22 @@ namespace Godot.SourceGenerators
return type switch
{
{ Name: "Vector2" } => MarshalType.Vector2,
- { Name: "Vector2i" } => MarshalType.Vector2i,
+ { Name: "Vector2I" } => MarshalType.Vector2I,
{ Name: "Rect2" } => MarshalType.Rect2,
- { Name: "Rect2i" } => MarshalType.Rect2i,
+ { Name: "Rect2I" } => MarshalType.Rect2I,
{ Name: "Transform2D" } => MarshalType.Transform2D,
{ Name: "Vector3" } => MarshalType.Vector3,
- { Name: "Vector3i" } => MarshalType.Vector3i,
+ { Name: "Vector3I" } => MarshalType.Vector3I,
{ Name: "Basis" } => MarshalType.Basis,
{ Name: "Quaternion" } => MarshalType.Quaternion,
{ Name: "Transform3D" } => MarshalType.Transform3D,
{ Name: "Vector4" } => MarshalType.Vector4,
- { Name: "Vector4i" } => MarshalType.Vector4i,
+ { Name: "Vector4I" } => MarshalType.Vector4I,
{ Name: "Projection" } => MarshalType.Projection,
- { Name: "AABB" } => MarshalType.AABB,
+ { Name: "Aabb" } => MarshalType.Aabb,
{ Name: "Color" } => MarshalType.Color,
{ Name: "Plane" } => MarshalType.Plane,
- { Name: "RID" } => MarshalType.RID,
+ { Name: "Rid" } => MarshalType.Rid,
{ Name: "Callable" } => MarshalType.Callable,
{ Name: "Signal" } => MarshalType.Signal,
{ Name: "Variant" } => MarshalType.Variant,
@@ -196,8 +196,8 @@ namespace Godot.SourceGenerators
return MarshalType.SystemArrayOfStringName;
case { Name: "NodePath" }:
return MarshalType.SystemArrayOfNodePath;
- case { Name: "RID" }:
- return MarshalType.SystemArrayOfRID;
+ case { Name: "Rid" }:
+ return MarshalType.SystemArrayOfRid;
}
}
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MustBeVariantAnalyzer.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MustBeVariantAnalyzer.cs
index 98ca534c66..2a9758516c 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MustBeVariantAnalyzer.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/MustBeVariantAnalyzer.cs
@@ -26,6 +26,10 @@ namespace Godot.SourceGenerators
private void AnalyzeNode(SyntaxNodeAnalysisContext context)
{
+ // Ignore syntax inside comments
+ if (IsInsideDocumentation(context.Node))
+ return;
+
var typeArgListSyntax = (TypeArgumentListSyntax)context.Node;
// Method invocation or variable declaration that contained the type arguments
@@ -74,6 +78,26 @@ namespace Godot.SourceGenerators
}
/// <summary>
+ /// Check if the syntax node is inside a documentation syntax.
+ /// </summary>
+ /// <param name="syntax">Syntax node to check.</param>
+ /// <returns><see langword="true"/> if the syntax node is inside a documentation syntax.</returns>
+ private bool IsInsideDocumentation(SyntaxNode? syntax)
+ {
+ while (syntax != null)
+ {
+ if (syntax is DocumentationCommentTriviaSyntax)
+ {
+ return true;
+ }
+
+ syntax = syntax.Parent;
+ }
+
+ return false;
+ }
+
+ /// <summary>
/// Check if the given type argument is being used in a type parameter that contains
/// the <c>MustBeVariantAttribute</c>; otherwise, we ignore the attribute.
/// </summary>
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs
index b64b843b7c..b720fb93a3 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptPropertiesGenerator.cs
@@ -328,15 +328,15 @@ namespace Godot.SourceGenerators
private static void AppendGroupingPropertyInfo(StringBuilder source, PropertyInfo propertyInfo)
{
- source.Append(" properties.Add(new(type: (Godot.Variant.Type)")
+ source.Append(" properties.Add(new(type: (global::Godot.Variant.Type)")
.Append((int)VariantType.Nil)
.Append(", name: \"")
.Append(propertyInfo.Name)
- .Append("\", hint: (Godot.PropertyHint)")
+ .Append("\", hint: (global::Godot.PropertyHint)")
.Append((int)PropertyHint.None)
.Append(", hintString: \"")
.Append(propertyInfo.HintString)
- .Append("\", usage: (Godot.PropertyUsageFlags)")
+ .Append("\", usage: (global::Godot.PropertyUsageFlags)")
.Append((int)propertyInfo.Usage)
.Append(", exported: true));\n");
}
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs
index ba6c10aa31..d67cb5349d 100644
--- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs
+++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ScriptSignalsGenerator.cs
@@ -272,6 +272,25 @@ namespace Godot.SourceGenerators
source.Append(" }\n");
}
+ // Generate HasGodotClassSignal
+
+ if (godotSignalDelegates.Count > 0)
+ {
+ source.Append(
+ " protected override bool HasGodotClassSignal(in godot_string_name signal)\n {\n");
+
+ bool isFirstEntry = true;
+ foreach (var signal in godotSignalDelegates)
+ {
+ GenerateHasSignalEntry(signal.Name, source, isFirstEntry);
+ isFirstEntry = false;
+ }
+
+ source.Append(" return base.HasGodotClassSignal(signal);\n");
+
+ source.Append(" }\n");
+ }
+
source.Append("}\n"); // partial class
if (isInnerClass)
@@ -397,6 +416,20 @@ namespace Godot.SourceGenerators
PropertyHint.None, string.Empty, propUsage, exported: false);
}
+ private static void GenerateHasSignalEntry(
+ string signalName,
+ StringBuilder source,
+ bool isFirstEntry
+ )
+ {
+ source.Append(" ");
+ if (!isFirstEntry)
+ source.Append("else ");
+ source.Append("if (signal == SignalName.");
+ source.Append(signalName);
+ source.Append(") {\n return true;\n }\n");
+ }
+
private static void GenerateSignalEventInvoker(
GodotSignalDelegateData signal,
StringBuilder source