Ingen beskrivning
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.

Target.cs 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Rendering;
  5. using UnityEngine.UIElements;
  6. using UnityEditor.ShaderGraph.Serialization;
  7. namespace UnityEditor.ShaderGraph
  8. {
  9. [Serializable, GenerationAPI] // TODO: Public
  10. internal abstract class Target : JsonObject
  11. {
  12. public string displayName { get; set; }
  13. public bool isHidden { get; set; }
  14. internal virtual bool ignoreCustomInterpolators => true;
  15. internal virtual int padCustomInterpolatorLimit => 4;
  16. internal virtual bool prefersSpritePreview => false;
  17. public abstract bool IsActive();
  18. public abstract void Setup(ref TargetSetupContext context);
  19. public abstract void GetFields(ref TargetFieldContext context);
  20. public abstract void GetActiveBlocks(ref TargetActiveBlockContext context);
  21. public abstract void GetPropertiesGUI(ref TargetPropertyGUIContext context, Action onChange, Action<string> registerUndo);
  22. public virtual void CollectShaderProperties(PropertyCollector collector, GenerationMode generationMode) { }
  23. public virtual void ProcessPreviewMaterial(Material material) { }
  24. public virtual object saveContext => null;
  25. public virtual bool IsNodeAllowedByTarget(Type nodeType)
  26. {
  27. NeverAllowedByTargetAttribute never = NodeClassCache.GetAttributeOnNodeType<NeverAllowedByTargetAttribute>(nodeType);
  28. return never == null;
  29. }
  30. public virtual bool DerivativeModificationCallback(
  31. out string dstGraphFunctions,
  32. out string dstGraphPixel,
  33. out bool[] adjustedUvDerivs,
  34. string primaryShaderName,
  35. string passName,
  36. string propStr,
  37. string surfaceDescStr,
  38. string graphFuncStr,
  39. string graphPixelStr,
  40. List<string> customFuncs,
  41. bool applyEmulatedDerivatives)
  42. {
  43. dstGraphFunctions = "";
  44. dstGraphPixel = "";
  45. adjustedUvDerivs = new bool[4];
  46. return false;
  47. }
  48. // think this is not called by anyone anymore, leaving it to avoid changing client code
  49. public abstract bool WorksWithSRP(RenderPipelineAsset scriptableRenderPipeline);
  50. }
  51. }