Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

GraphConcretization.cs 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Linq;
  2. using UnityEngine;
  3. namespace UnityEditor.ShaderGraph
  4. {
  5. sealed partial class GraphData : ISerializationCallbackReceiver
  6. {
  7. public static class GraphConcretization
  8. {
  9. public static void ConcretizeNode(AbstractMaterialNode node)
  10. {
  11. node.Concretize();
  12. }
  13. public static void ConcretizeProperties(GraphData graph)
  14. {
  15. // get all property nodes whose property doesn't exist?
  16. var propertyNodes = graph.GetNodes<PropertyNode>().Where(n => !graph.m_Properties.Any(p => p.value == n.property || n.property != null && p.value.objectId == n.property.objectId)).ToArray();
  17. foreach (var pNode in propertyNodes)
  18. graph.ReplacePropertyNodeWithConcreteNodeNoValidate(pNode);
  19. }
  20. public static void ConcretizeGraph(GraphData graph)
  21. {
  22. graph.graphIsConcretizing = true;
  23. try
  24. {
  25. ConcretizeProperties(graph);
  26. GraphDataUtils.ApplyActionLeafFirst(graph, ConcretizeNode);
  27. }
  28. catch (System.Exception e)
  29. {
  30. graph.graphIsConcretizing = false;
  31. throw e;
  32. }
  33. graph.graphIsConcretizing = false;
  34. }
  35. }
  36. }
  37. }