From 329818f20b455bd5026878ee4ed15df4d50abc62 Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Sun, 6 Mar 2022 18:04:29 +0100 Subject: 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`. --- modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules/mono/glue') 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 @@ -79,6 +79,11 @@ namespace Godot /// private static bool TypeIsGenericIDictionary(Type type) => type.GetGenericTypeDefinition() == typeof(IDictionary<,>); + /// + /// Returns if the is applied to the given type. + /// + private static bool TypeHasFlagsAttribute(Type type) => type.IsDefined(typeof(FlagsAttribute), false); + /// /// Returns the generic type definition of . /// -- cgit v1.2.3