1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

[.NET] Disallow [ExportToolButton] on members thay may store the Callable

Ensures the user doesn't store the Callable so the .NET assembly can be reloaded.
This commit is contained in:
Raul Santos
2025-02-13 22:10:26 +01:00
parent 36d90c73a8
commit f4094b554d
14 changed files with 263 additions and 38 deletions

View File

@@ -4,5 +4,5 @@ using Godot.Collections;
public partial class ExportDiagnostics_GD0108 : Node
{
[ExportToolButton("")]
public Callable {|GD0108:MyButton|};
public Callable {|GD0108:MyButton|} => new Callable();
}

View File

@@ -5,5 +5,5 @@ using Godot.Collections;
public partial class ExportDiagnostics_GD0109 : Node
{
[Export, ExportToolButton("")]
public Callable {|GD0109:MyButton|};
public Callable {|GD0109:MyButton|} => new Callable();
}

View File

@@ -5,5 +5,5 @@ using Godot.Collections;
public partial class ExportDiagnostics_GD0110 : Node
{
[ExportToolButton("")]
public string {|GD0110:MyButton|};
public int {|GD0110:MyButton|} => new();
}

View File

@@ -0,0 +1,29 @@
using Godot;
using Godot.Collections;
[Tool]
public partial class ExportDiagnostics_GD0111 : Node
{
private Callable _backingField;
[ExportToolButton("")]
public Callable {|GD0111:MyButtonGet|} { get; }
[ExportToolButton("")]
public Callable {|GD0111:MyButtonGetSet|} { get; set; }
[ExportToolButton("")]
public Callable {|GD0111:MyButtonGetWithBackingField|} { get => _backingField; }
[ExportToolButton("")]
public Callable {|GD0111:MyButtonGetSetWithBackingField|} { get => _backingField; set => _backingField = value; }
[ExportToolButton("")]
public Callable MyButtonOkWithCallableCreationExpression => new Callable(this, "");
[ExportToolButton("")]
public Callable MyButtonOkWithImplicitCallableCreationExpression => new(this, "");
[ExportToolButton("")]
public Callable MyButtonOkWithCallableFromExpression => Callable.From(null);
}