You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
C#: Support type hints for exported Arrays
Added the code for Dictionary as well, but it's not yet supported by the Godot inspector.
This commit is contained in:
@@ -18,6 +18,20 @@ namespace Godot
|
||||
return type.GetGenericTypeDefinition() == typeof(Godot.Collections.Dictionary<,>);
|
||||
}
|
||||
|
||||
static void ArrayGetElementType(Type type, out Type elementType)
|
||||
{
|
||||
elementType = type.GetGenericArguments()[0];
|
||||
}
|
||||
|
||||
static void DictionaryGetKeyValueTypes(Type type, out Type keyType, out Type valueType)
|
||||
{
|
||||
var genericArgs = type.GetGenericArguments();
|
||||
|
||||
keyType = genericArgs[0];
|
||||
valueType = genericArgs[1];
|
||||
}
|
||||
|
||||
// TODO Add support for IEnumerable<T> and IDictionary<TKey, TValue>
|
||||
// TODO: EnumerableToArray and IDictionaryToDictionary can be optimized
|
||||
|
||||
internal static void EnumerableToArray(IEnumerable enumerable, IntPtr godotArrayPtr)
|
||||
|
||||
Reference in New Issue
Block a user