Skip to content

Commit

Permalink
Merge branch 'main' into feature/performance_tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
Haruma-K committed Jan 18, 2024
2 parents 4273d6e + 52f4c81 commit 262d1c9
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public sealed class SmartAddresserProjectSettings : ScriptableSingleton<SmartAdd
[SerializeField] private LayoutRuleData primaryData;
[SerializeField] private MonoScript versionExpressionParser;
[SerializeField] private Validation validation = new Validation();
[SerializeField] private bool sortByAssetPaths = false;

public LayoutRuleData PrimaryData
{
Expand Down Expand Up @@ -52,6 +53,19 @@ public Validation ValidationSettings
}
}

public bool SortByAssetPaths
{
get => sortByAssetPaths;
set
{
if (value == sortByAssetPaths)
return;

sortByAssetPaths = value;
Save(true);
}
}

[Serializable]
public sealed class Validation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ public override void OnGUI(string searchContext)
projectSettings.ValidationSettings = new SmartAddresserProjectSettings.Validation(duplicateAddresses,
duplicateAssetPaths, entryHasMultipleVersions);
}

using (var ccs = new EditorGUI.ChangeCheckScope())
{
var sortByAssetPaths = EditorGUILayout.Toggle("Sort by assetPaths", projectSettings.SortByAssetPaths);
if (ccs.changed)
projectSettings.SortByAssetPaths = sortByAssetPaths;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using SmartAddresser.Editor.Core.Tools.Shared;
using UnityEditor;

namespace SmartAddresser.Editor.Foundation.AssetDatabaseAdapter
Expand All @@ -7,7 +8,14 @@ public sealed class AssetDatabaseAdapter : IAssetDatabaseAdapter
{
public string[] GetAllAssetPaths()
{
return AssetDatabase.GetAllAssetPaths();
string[] allAssetPaths = AssetDatabase.GetAllAssetPaths();
var projectSettings = SmartAddresserProjectSettings.instance;
if (projectSettings == null || !projectSettings.SortByAssetPaths)
{
return allAssetPaths;
}
Array.Sort(allAssetPaths, StringComparer.OrdinalIgnoreCase);
return allAssetPaths;
}

public string GUIDToAssetPath(string guid)
Expand Down

0 comments on commit 262d1c9

Please sign in to comment.