暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

INode.cs 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEditor.ShaderGraph;
  4. namespace UnityEditor.Graphing
  5. {
  6. enum ModificationScope
  7. {
  8. Nothing = 0,
  9. Node = 1,
  10. Graph = 2,
  11. Topological = 3,
  12. Layout = 4
  13. }
  14. delegate void OnNodeModified(AbstractMaterialNode node, ModificationScope scope);
  15. static class NodeExtensions
  16. {
  17. public static IEnumerable<T> GetSlots<T>(this AbstractMaterialNode node) where T : MaterialSlot
  18. {
  19. var slots = new List<T>();
  20. node.GetSlots(slots);
  21. return slots;
  22. }
  23. public static IEnumerable<T> GetInputSlots<T>(this AbstractMaterialNode node) where T : MaterialSlot
  24. {
  25. var slots = new List<T>();
  26. node.GetInputSlots(slots);
  27. return slots;
  28. }
  29. public static IEnumerable<T> GetInputSlots<T>(this AbstractMaterialNode node, MaterialSlot startingSlot) where T : MaterialSlot
  30. {
  31. var slots = new List<T>();
  32. node.GetInputSlots(startingSlot, slots);
  33. return slots;
  34. }
  35. public static IEnumerable<T> GetOutputSlots<T>(this AbstractMaterialNode node) where T : MaterialSlot
  36. {
  37. var slots = new List<T>();
  38. node.GetOutputSlots(slots);
  39. return slots;
  40. }
  41. public static IEnumerable<T> GetOutputSlots<T>(this AbstractMaterialNode node, MaterialSlot startingSlot) where T : MaterialSlot
  42. {
  43. var slots = new List<T>();
  44. node.GetOutputSlots(startingSlot, slots);
  45. return slots;
  46. }
  47. }
  48. }