Add support for using interfaces in Visual Scripting

This commit is contained in:
Wojtek Figat
2021-10-04 12:23:34 +02:00
parent ecf926a537
commit e92c22585a
8 changed files with 111 additions and 6 deletions

View File

@@ -76,9 +76,14 @@ namespace FlaxEditor.Modules.SourceCodeEditing
/// </summary>
protected virtual void Search()
{
// Special case for attributes
if (_type.Type != null && new ScriptType(typeof(Attribute)).IsAssignableFrom(_type))
if (_type == ScriptType.Null)
{
// Special case for all types
TypeUtils.GetTypes(_list, _checkFunc, _checkAssembly);
}
else if (_type.Type != null && new ScriptType(typeof(Attribute)).IsAssignableFrom(_type))
{
// Special case for attributes
TypeUtils.GetTypesWithAttributeDefined(_type.Type, _list, _checkFunc, _checkAssembly);
}
else

View File

@@ -157,7 +157,7 @@ namespace FlaxEditor.Modules.SourceCodeEditing
/// <summary>
/// The all types collection from all assemblies (excluding C# system libraries). Includes only primitive and basic types from std lib.
/// </summary>
public readonly CachedTypesCollection All = new CachedAllTypesCollection(8096, new ScriptType(typeof(object)), type => true, HasAssemblyValidAnyTypes);
public readonly CachedTypesCollection All = new CachedAllTypesCollection(8096, ScriptType.Null, type => true, HasAssemblyValidAnyTypes);
/// <summary>
/// The all valid types collection for the Visual Script property types (includes basic types like int/float, structures, object references).