Add support for loading Visject surfaces without Surface UI

This commit is contained in:
Wojtek Figat
2022-05-06 18:45:12 +02:00
parent 78d6fe6b50
commit 1acac3845e
16 changed files with 171 additions and 88 deletions

View File

@@ -47,13 +47,7 @@ namespace FlaxEditor.Surface
public partial class VisjectSurface
{
/// <summary>
/// Checks if can use direct conversion from one type to another.
/// </summary>
/// <param name="from">Source type.</param>
/// <param name="to">Target type.</param>
/// <returns>True if can use direct conversion, otherwise false.</returns>
public bool CanUseDirectCast(ScriptType from, ScriptType to)
internal static bool CanUseDirectCastStatic(ScriptType from, ScriptType to, bool supportsImplicitCastFromObjectToBoolean = true)
{
if (from == ScriptType.Null || to == ScriptType.Null)
return false;
@@ -76,7 +70,7 @@ namespace FlaxEditor.Surface
// Implicit casting is supported for object reference to test whenever it is valid
var toType = to.Type;
if (_supportsImplicitCastFromObjectToBoolean && toType == typeof(bool) && ScriptType.FlaxObject.IsAssignableFrom(from))
if (supportsImplicitCastFromObjectToBoolean && toType == typeof(bool) && ScriptType.FlaxObject.IsAssignableFrom(from))
{
return true;
}
@@ -124,6 +118,17 @@ namespace FlaxEditor.Surface
return result;
}
/// <summary>
/// Checks if can use direct conversion from one type to another.
/// </summary>
/// <param name="from">Source type.</param>
/// <param name="to">Target type.</param>
/// <returns>True if can use direct conversion, otherwise false.</returns>
public bool CanUseDirectCast(ScriptType from, ScriptType to)
{
return CanUseDirectCastStatic(from, to, _supportsImplicitCastFromObjectToBoolean);
}
/// <summary>
/// Begins connecting surface objects action.
/// </summary>