Merge branch 'visject-improvements-6' of git://github.com/stefnotch/FlaxEngine into stefnotch-visject-improvements-6

This commit is contained in:
Wojtek Figat
2021-02-27 20:44:29 +01:00
13 changed files with 447 additions and 43 deletions

View File

@@ -10,7 +10,7 @@ namespace FlaxEditor.Surface.Undo
/// The helper structure for Surface node box handle.
/// </summary>
[HideInEditor]
public struct BoxHandle
public struct BoxHandle : IEquatable<BoxHandle>
{
private readonly uint _nodeId;
private readonly int _boxId;
@@ -51,5 +51,27 @@ namespace FlaxEditor.Surface.Undo
throw new Exception("Missing box.");
return box;
}
/// <inheritdoc />
public override bool Equals(object obj)
{
return obj is BoxHandle handle && Equals(handle);
}
/// <inheritdoc />
public bool Equals(BoxHandle other)
{
return _nodeId == other._nodeId &&
_boxId == other._boxId;
}
/// <inheritdoc />
public override int GetHashCode()
{
unchecked
{
return (_nodeId.GetHashCode() * 397) ^ _boxId.GetHashCode();
}
}
}
}

View File

@@ -106,9 +106,12 @@ namespace FlaxEditor.Surface.Undo
}
for (int i = 0; i < output.Length; i++)
{
var box = output[i].Get(context);
oB.Connections.Add(box);
box.Connections.Add(oB);
if (!output[i].Equals(_input))
{
var box = output[i].Get(context);
oB.Connections.Add(box);
box.Connections.Add(oB);
}
}
toUpdate.AddRange(iB.Connections);