Added the functionality to add RelayNode directly to edge between two Prot;
This commit is contained in:
@@ -64,20 +64,24 @@ namespace Misaki.GraphView
|
||||
/// Link the current slot with another slot.
|
||||
/// </summary>
|
||||
/// <param name="other"> The slot need to be linked </param>
|
||||
public void Link(Slot other)
|
||||
public bool Link(Slot other, out SlotConnection connection)
|
||||
{
|
||||
connection = default;
|
||||
if (other.slotData.direction == slotData.direction)
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_linkedSlotData.Contains(other.slotData))
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
_linkedSlotData.Add(other.slotData);
|
||||
other._linkedSlotData.Add(slotData);
|
||||
connection = new(slotData, other.slotData);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -9,10 +9,10 @@ namespace Misaki.GraphView
|
||||
[Serializable]
|
||||
public struct SlotConnection : IEquatable<SlotConnection>
|
||||
{
|
||||
[SerializeField]
|
||||
[SerializeField]
|
||||
private SlotData _inputSlotData;
|
||||
|
||||
[SerializeField]
|
||||
[SerializeField]
|
||||
private SlotData _outputSlotData;
|
||||
|
||||
/// <summary>
|
||||
@@ -43,5 +43,15 @@ namespace Misaki.GraphView
|
||||
{
|
||||
return HashCode.Combine(InputSlotData, OutputSlotData);
|
||||
}
|
||||
|
||||
public static bool operator ==(SlotConnection left, SlotConnection right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
public static bool operator !=(SlotConnection left, SlotConnection right)
|
||||
{
|
||||
return !left.Equals(right);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user