暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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. }