Add support for NotNullItems option in collections editors

#542
This commit is contained in:
Wojtek Figat
2021-06-09 10:58:54 +02:00
parent 0ba4a0cabc
commit 484bc409d4
11 changed files with 64 additions and 57 deletions

View File

@@ -37,9 +37,8 @@ namespace FlaxEditor.Scripting
/// Gets the default value for the given type (can be value type or reference type).
/// </summary>
/// <param name="type">The type.</param>
/// <param name="notNull">Whether the value can be empty. If that's true, it can't.</param>
/// <returns>The created instance.</returns>
public static object GetDefaultValue(ScriptType type, bool notNull = false)
public static object GetDefaultValue(ScriptType type)
{
if (type.Type == typeof(string))
return string.Empty;
@@ -65,7 +64,7 @@ namespace FlaxEditor.Scripting
Utilities.Utils.InitDefaultValues(value);
return value;
}
if (!notNull && new ScriptType(typeof(object)).IsAssignableFrom(type))
if (new ScriptType(typeof(object)).IsAssignableFrom(type))
return null;
if (type.CanCreateInstance)
{