InlinePropertyTable.cs 997 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using UnityEngine;
  2. using UnityEditor;
  3. using System;
  4. using System.Collections.Generic;
  5. namespace AmplifyShaderEditor
  6. {
  7. public class InlinePropertyTable
  8. {
  9. // @diogo: Used to keep track of inline properties during Graph loading process, in order to resolve
  10. // dependencies AFTER the meta data is parsed, not during the process, making it order agnostic.
  11. static List<InlineProperty> m_pool = new List<InlineProperty>( 32 );
  12. static List<InlineProperty> m_trackingTable = null;
  13. public static void Initialize()
  14. {
  15. m_trackingTable = m_pool; // keep memory allocated, despite empty list
  16. }
  17. public static void Register( InlineProperty prop )
  18. {
  19. if ( m_trackingTable != null )
  20. {
  21. m_trackingTable.Add( prop );
  22. }
  23. }
  24. public static void ResolveDependencies()
  25. {
  26. if ( m_trackingTable != null )
  27. {
  28. foreach ( var prop in m_trackingTable )
  29. {
  30. prop.TryResolveDependency();
  31. }
  32. m_trackingTable.Clear();
  33. m_trackingTable = null;
  34. }
  35. }
  36. }
  37. }