PostProcessAttribute.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. namespace UnityEngine.Rendering.PostProcessing
  3. {
  4. /// <summary>
  5. /// Use this attribute to associate a <see cref="PostProcessEffectSettings"/> to a
  6. /// <see cref="PostProcessEffectRenderer{T}"/> type.
  7. /// </summary>
  8. /// <seealso cref="PostProcessEffectSettings"/>
  9. /// <seealso cref="PostProcessEffectRenderer{T}"/>
  10. [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
  11. public sealed class PostProcessAttribute : Attribute
  12. {
  13. /// <summary>
  14. /// The renderer type to associate with a <see cref="PostProcessEffectSettings"/>.
  15. /// </summary>
  16. public readonly Type renderer;
  17. /// <summary>
  18. /// The injection point for the effect.
  19. /// </summary>
  20. public readonly PostProcessEvent eventType;
  21. /// <summary>
  22. /// The menu item name to set for the effect. You can use a `/` character to add sub-menus.
  23. /// </summary>
  24. public readonly string menuItem;
  25. /// <summary>
  26. /// Should this effect be allowed in the Scene View?
  27. /// </summary>
  28. public readonly bool allowInSceneView;
  29. internal readonly bool builtinEffect;
  30. /// <summary>
  31. /// Creates a new attribute.
  32. /// </summary>
  33. /// <param name="renderer">The renderer type to associate with a <see cref="PostProcessEffectSettings"/></param>
  34. /// <param name="eventType">The injection point for the effect</param>
  35. /// <param name="menuItem">The menu item name to set for the effect. You can use a `/` character to add sub-menus.</param>
  36. /// <param name="allowInSceneView">Should this effect be allowed in the Scene View?</param>
  37. public PostProcessAttribute(Type renderer, PostProcessEvent eventType, string menuItem, bool allowInSceneView = true)
  38. {
  39. this.renderer = renderer;
  40. this.eventType = eventType;
  41. this.menuItem = menuItem;
  42. this.allowInSceneView = allowInSceneView;
  43. builtinEffect = false;
  44. }
  45. internal PostProcessAttribute(Type renderer, string menuItem, bool allowInSceneView = true)
  46. {
  47. this.renderer = renderer;
  48. this.menuItem = menuItem;
  49. this.allowInSceneView = allowInSceneView;
  50. builtinEffect = true;
  51. }
  52. }
  53. }