diff options
author | Raul Santos <raulsntos@gmail.com> | 2022-03-06 18:04:29 +0100 |
---|---|---|
committer | Raul Santos <raulsntos@gmail.com> | 2022-06-03 05:19:01 +0200 |
commit | 329818f20b455bd5026878ee4ed15df4d50abc62 (patch) | |
tree | 89bee7b1fbddcf407dc1d358b03980143d93b48f /modules/mono/glue | |
parent | 1baee2189c21ae36c852ddff10f769b1134509ca (diff) | |
download | redot-engine-329818f20b455bd5026878ee4ed15df4d50abc62.tar.gz |
Support explicit values in flag properties, add C# flags support
- Add support for explicit values in properties using `PROPERTY_HINT_FLAGS`
that works the same way it does for enums.
- Fix enums and flags in VisualScriptEditor (it wasn't considering the
explicit value).
- Use `PROPERTY_HINT_FLAGS` for C# enums with the FlagsAttribute instead
of `PROPERTY_HINT_ENUM`.
Diffstat (limited to 'modules/mono/glue')
-rw-r--r-- | modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs index ee4d0eed08..50ae2eb112 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs @@ -80,6 +80,11 @@ namespace Godot private static bool TypeIsGenericIDictionary(Type type) => type.GetGenericTypeDefinition() == typeof(IDictionary<,>); /// <summary> + /// Returns <see langword="true"/> if the <see cref="FlagsAttribute"/> is applied to the given type. + /// </summary> + private static bool TypeHasFlagsAttribute(Type type) => type.IsDefined(typeof(FlagsAttribute), false); + + /// <summary> /// Returns the generic type definition of <paramref name="type"/>. /// </summary> /// <exception cref="InvalidOperationException"> |