Added the functionality to add RelayNode directly to edge between two Prot;

This commit is contained in:
Misaki
2024-11-07 00:42:52 +09:00
parent 02ae77f17a
commit 5ac1081d32
16 changed files with 243 additions and 150 deletions

View File

@@ -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>

View File

@@ -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);
}
}
}