mirror of
https://github.com/godotengine/godot.git
synced 2025-10-29 20:51:14 +00:00
Allow readonly and writeonly C# properties to be accessed from GDScript
This commit is contained in:
parent
7ba79d68bd
commit
41cf94e8b6
6 changed files with 69 additions and 33 deletions
|
|
@ -303,11 +303,6 @@ namespace Godot.SourceGenerators
|
|||
{
|
||||
foreach (var property in properties)
|
||||
{
|
||||
// TODO: We should still restore read-only properties after reloading assembly. Two possible ways: reflection or turn RestoreGodotObjectData into a constructor overload.
|
||||
// Ignore properties without a getter, without a setter or with an init-only setter. Godot properties must be both readable and writable.
|
||||
if (property.IsWriteOnly || property.IsReadOnly || property.SetMethod!.IsInitOnly)
|
||||
continue;
|
||||
|
||||
var marshalType = MarshalUtils.ConvertManagedTypeToMarshalType(property.Type, typeCache);
|
||||
|
||||
if (marshalType == null)
|
||||
|
|
@ -325,10 +320,6 @@ namespace Godot.SourceGenerators
|
|||
foreach (var field in fields)
|
||||
{
|
||||
// TODO: We should still restore read-only fields after reloading assembly. Two possible ways: reflection or turn RestoreGodotObjectData into a constructor overload.
|
||||
// Ignore properties without a getter or without a setter. Godot properties must be both readable and writable.
|
||||
if (field.IsReadOnly)
|
||||
continue;
|
||||
|
||||
var marshalType = MarshalUtils.ConvertManagedTypeToMarshalType(field.Type, typeCache);
|
||||
|
||||
if (marshalType == null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue