Geen omschrijving
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.

FieldExtensions.cs 884B

123456789101112131415161718192021222324252627282930
  1. using UnityEditor.ShaderGraph.Internal;
  2. namespace UnityEditor.ShaderGraph
  3. {
  4. static class FieldExtensions
  5. {
  6. public static bool HasPreprocessor(this FieldDescriptor descriptor)
  7. {
  8. return (descriptor.preprocessor?.Length > 0);
  9. }
  10. public static bool HasSemantic(this FieldDescriptor descriptor)
  11. {
  12. return (descriptor.semantic?.Length > 0);
  13. }
  14. public static bool HasFlag(this FieldDescriptor descriptor, StructFieldOptions options)
  15. {
  16. return (descriptor.subscriptOptions & options) == options;
  17. }
  18. public static string ToFieldString(this FieldDescriptor descriptor)
  19. {
  20. if (!string.IsNullOrEmpty(descriptor.tag))
  21. return $"{descriptor.tag}.{descriptor.name}";
  22. else
  23. return descriptor.name;
  24. }
  25. }
  26. }