- Filtering now also applies when dragging a connection from an input port

This commit is contained in:
Nils Hausfeld
2023-09-27 19:28:06 +02:00
parent 98e9c75cb8
commit 155d11c07b

View File

@@ -156,32 +156,37 @@ namespace FlaxEditor.Surface.ContextMenu
if(memberInfo.IsEvent)
isCompatible = false;
if (startBox.IsOutput)
{
var parameters = memberInfo.GetParameters();
ScriptType outType = startBox.CurrentType;
if (startBox.CurrentType.IsVoid && memberInfo.ValueType.IsVoid)
isCompatible = true;
if (!memberInfo.IsStatic)
{
var scriptType = TypeUtils.GetType((string)_archetype.DefaultValues[0]);
isCompatible |= CanCastToType(scriptType, outType, _archetype.ConnectionsHints);
}
if (!memberInfo.IsEvent)
{
for (int i = 0; i < parameters.Length; i++)
{
ScriptType inType = parameters[i].Type;
isCompatible |= CanCastToType(inType, outType, _archetype.ConnectionsHints);
}
}
}
if (startBox.CurrentType.IsVoid && memberInfo.ValueType.IsVoid)
isCompatible = true;
else
{
if (startBox.IsOutput)
{
var parameters = memberInfo.GetParameters();
ScriptType outType = startBox.CurrentType;
if (!memberInfo.IsStatic)
{
var scriptType = memberInfo.DeclaringType;
isCompatible |= CanCastToType(scriptType, outType, _archetype.ConnectionsHints);
}
if (!memberInfo.IsEvent)
{
for (int i = 0; i < parameters.Length; i++)
{
ScriptType inType = parameters[i].Type;
isCompatible |= CanCastToType(inType, outType, _archetype.ConnectionsHints);
}
}
}
else
{
ScriptType inType = startBox.CurrentType;
ScriptType outType = memberInfo.ValueType;
isCompatible |= CanCastToType(inType, outType, _archetype.ConnectionsHints);
}
}
}
}