AssetsSelection.cs 1015 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using Unity.PlasticSCM.Editor.AssetUtils;
  5. using UnityEditor.VersionControl;
  6. namespace Unity.PlasticSCM.Editor.AssetMenu
  7. {
  8. internal static class AssetsSelection
  9. {
  10. internal static Asset GetSelectedAsset(AssetList assetList)
  11. {
  12. if (assetList.Count == 0)
  13. return null;
  14. return assetList[0];
  15. }
  16. internal static string GetSelectedPath(AssetList assetList)
  17. {
  18. if (assetList.Count == 0)
  19. return null;
  20. return Path.GetFullPath(assetList[0].path);
  21. }
  22. internal static List<string> GetSelectedPaths(AssetList selectedAssets)
  23. {
  24. List<string> result = new List<string>();
  25. foreach (Asset asset in selectedAssets)
  26. {
  27. string fullPath = Path.GetFullPath(asset.path);
  28. result.Add(fullPath);
  29. }
  30. return result;
  31. }
  32. }
  33. }