using System; using System.Collections.Generic; using UnityEditor.ShaderGraph; namespace UnityEditor.Graphing { public enum ModificationScope { Nothing = 0, Node = 1, Graph = 2, Topological = 3 } public delegate void OnNodeModified(INode node, ModificationScope scope); public interface INode { OnNodeModified onModified { get; set; } void Dirty(ModificationScope scope); IGraph owner { get; set; } Guid guid { get; } Identifier tempId { get; set; } Guid RewriteGuid(); string name { get; set; } bool canDeleteNode { get; } void GetInputSlots(List foundSlots) where T : ISlot; void GetOutputSlots(List foundSlots) where T : ISlot; void GetSlots(List foundSlots) where T : ISlot; void AddSlot(ISlot slot); void RemoveSlot(int slotId); SlotReference GetSlotReference(int slotId); T FindSlot(int slotId) where T : ISlot; T FindInputSlot(int slotId) where T : ISlot; T FindOutputSlot(int slotId) where T : ISlot; IEnumerable GetInputsWithNoConnection(); DrawState drawState { get; set; } bool hasError { get; } void ValidateNode(); void UpdateNodeAfterDeserialization(); } public static class NodeExtensions { public static IEnumerable GetSlots(this INode node) where T : ISlot { var slots = new List(); node.GetSlots(slots); return slots; } public static IEnumerable GetInputSlots(this INode node) where T : ISlot { var slots = new List(); node.GetInputSlots(slots); return slots; } public static IEnumerable GetOutputSlots(this INode node) where T : ISlot { var slots = new List(); node.GetOutputSlots(slots); return slots; } } }