No Description
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.

GraphDataReadOnly.cs 775B

12345678910111213141516171819202122232425262728
  1. using System.Linq;
  2. using UnityEditor.Graphing;
  3. namespace UnityEditor.ShaderGraph
  4. {
  5. readonly struct GraphDataReadOnly
  6. {
  7. private readonly GraphData m_Graph;
  8. public GraphDataReadOnly(GraphData graph)
  9. {
  10. m_Graph = graph;
  11. }
  12. private bool AnyConnectedControl<T>() where T : IControl
  13. {
  14. var matchingNodes = m_Graph.GetNodes<BlockNode>().Where(o => o.descriptor.control is T);
  15. return matchingNodes.SelectMany(o => o.GetInputSlots<MaterialSlot>()).Any(o => o.isConnected);
  16. }
  17. public bool AnyVertexAnimationActive()
  18. {
  19. return AnyConnectedControl<PositionControl>();
  20. }
  21. public bool IsVFXCompatible() => m_Graph.hasVFXCompatibleTarget;
  22. }
  23. }