RenderPipelineConverter.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. [assembly: InternalsVisibleTo("PPv2URPConverters")]
  4. namespace UnityEditor.Rendering.Universal.Converters
  5. {
  6. // Might need to change this name before making it public
  7. internal abstract class RenderPipelineConverter
  8. {
  9. /// <summary>
  10. /// Name of the converter.
  11. /// </summary>
  12. public abstract string name { get; }
  13. /// <summary>
  14. /// The information when hovering over the converter.
  15. /// </summary>
  16. public abstract string info { get; }
  17. /// <summary>
  18. /// A check if the converter is enabled or not. Can be used to do a check if prerequisites are met to have it enabled or disabled.
  19. /// </summary>
  20. public virtual bool isEnabled => true;
  21. /// <summary>
  22. /// A priority of the converter. The lower the number (can be negative), the earlier it will be executed. Can be used to make sure that a converter runs before another converter.
  23. /// </summary>
  24. public virtual int priority => 0;
  25. /// <summary>
  26. /// A check to see if the converter needs to create the index.
  27. /// This will only need to be set to true if the converter is using search api, and search queries.
  28. /// If set to true the converter framework will create the indexer and remove it after all search queries are done.
  29. /// </summary>
  30. public virtual bool needsIndexing => false;
  31. /// <summary>
  32. /// This method getting triggered when clicking the listview item in the UI.
  33. /// </summary>
  34. public virtual void OnClicked(int index)
  35. {
  36. }
  37. // This is so that we can have different segment in our UI, example Unity converters, your custom converters etc..
  38. // This is not implemented yet
  39. public virtual string category { get; }
  40. // This is in which drop down item the converter belongs to.
  41. // Not properly implemented yet
  42. public abstract Type container { get; }
  43. /// <summary>
  44. /// This runs when initializing the converter. To gather data for the UI and also for the converter if needed.
  45. /// </summary>
  46. /// <param name="context">The context that will be used to initialize data for the converter.</param>
  47. public abstract void OnInitialize(InitializeConverterContext context, Action callback);
  48. /// <summary>
  49. /// The method that will be run before Run method if needed.
  50. /// </summary>
  51. public virtual void OnPreRun()
  52. {
  53. }
  54. /// <summary>
  55. /// The method that will be run when converting the assets.
  56. /// </summary>
  57. /// <param name="context">The context that will be used when executing converter.</param>
  58. public abstract void OnRun(ref RunItemContext context);
  59. /// <summary>
  60. /// The method that will be run after the converters are done if needed.
  61. /// </summary>
  62. public virtual void OnPostRun()
  63. {
  64. }
  65. }
  66. }