Fixes for Visual Scripting in Editor
This commit is contained in:
@@ -1121,7 +1121,7 @@ namespace FlaxEditor.Scripting
|
||||
return new ScriptType(_managed.MakeArrayType());
|
||||
if (_custom != null)
|
||||
return new ScriptType(new ScriptTypeArray(this));
|
||||
return Null;
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1130,6 +1130,8 @@ namespace FlaxEditor.Scripting
|
||||
/// <returns>A type object representing a dictionary of the key and value types.</returns>
|
||||
public static ScriptType MakeDictionaryType(ScriptType keyType, ScriptType valueType)
|
||||
{
|
||||
if (keyType == Null || valueType == Null)
|
||||
throw new ArgumentNullException();
|
||||
return new ScriptType(typeof(Dictionary<,>).MakeGenericType(TypeUtils.GetType(keyType), TypeUtils.GetType(valueType)));
|
||||
}
|
||||
|
||||
|
||||
@@ -327,16 +327,10 @@ namespace FlaxEditor.Scripting
|
||||
return ScriptType.Null;
|
||||
|
||||
// C#/C++ types
|
||||
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||
for (int i = 0; i < assemblies.Length; i++)
|
||||
{
|
||||
var assembly = assemblies[i];
|
||||
if (assembly != null)
|
||||
{
|
||||
var type = assembly.GetType(typeName);
|
||||
if (type != null)
|
||||
return new ScriptType(type);
|
||||
}
|
||||
var type = Type.GetType(typeName);
|
||||
if (type != null)
|
||||
return new ScriptType(type);
|
||||
}
|
||||
|
||||
// Custom types
|
||||
@@ -348,6 +342,7 @@ namespace FlaxEditor.Scripting
|
||||
}
|
||||
if (typeName.EndsWith("[]"))
|
||||
{
|
||||
// Array of custom type
|
||||
if (typeName[0] == '.')
|
||||
typeName = typeName.Substring(1);
|
||||
typeName = typeName.Substring(0, typeName.Length - 2);
|
||||
@@ -359,6 +354,7 @@ namespace FlaxEditor.Scripting
|
||||
}
|
||||
}
|
||||
|
||||
Editor.LogWarning($"Failed to find type '{typeName}'.");
|
||||
return ScriptType.Null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user