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

GetSelectedPaths.cs 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System.Collections.Generic;
  2. using System.IO;
  3. using Unity.PlasticSCM.Editor.AssetMenu;
  4. using Unity.PlasticSCM.Editor.AssetsOverlays.Cache;
  5. using UnityEditor.VersionControl;
  6. namespace Unity.PlasticSCM.Editor.AssetUtils
  7. {
  8. internal static class GetSelectedPaths
  9. {
  10. internal static List<string> ForOperation(
  11. string wkPath,
  12. AssetList assetList,
  13. IAssetStatusCache assetStatusCache,
  14. AssetMenuOperations operation)
  15. {
  16. List<string> selectedPaths = AssetsSelection.
  17. GetSelectedPaths(wkPath, assetList);
  18. List<string> result = new List<string>(selectedPaths);
  19. foreach (string path in selectedPaths)
  20. {
  21. if (MetaPath.IsMetaPath(path))
  22. continue;
  23. string metaPath = MetaPath.GetMetaPath(path);
  24. if (!File.Exists(metaPath))
  25. continue;
  26. if (result.Contains(metaPath))
  27. continue;
  28. if (!IsApplicableForOperation(
  29. metaPath, false, operation, assetStatusCache))
  30. continue;
  31. result.Add(metaPath);
  32. }
  33. return result;
  34. }
  35. static bool IsApplicableForOperation(
  36. string path,
  37. bool isDirectory,
  38. AssetMenuOperations operation,
  39. IAssetStatusCache assetStatusCache)
  40. {
  41. SelectedAssetGroupInfo info = SelectedAssetGroupInfo.BuildFromSingleFile(
  42. path, isDirectory, assetStatusCache);
  43. return AssetMenuUpdater.GetAvailableMenuOperations(info).HasFlag(operation);
  44. }
  45. }
  46. }