Compare commits

...

3 Commits

7 changed files with 55 additions and 30 deletions
@@ -53,7 +53,8 @@ namespace AssetUsageDetectorNamespace
#endif
public bool calculateUnusedObjects = false;
public bool hideDuplicateRows = true;
public bool hideReduntantPrefabVariantLinks = true;
public bool hideNonOverriddenPrefabVariablesInAssets = true;
public bool hideNonOverriddenPrefabVariablesInScenes = false;
public bool noAssetDatabaseChanges = false;
public bool showDetailedProgressBar = true;
}
@@ -1453,7 +1453,7 @@ namespace AssetUsageDetectorNamespace
{
bool iteratingVisible = iteratorVisible.NextVisible( true );
#if UNITY_2018_3_OR_NEWER
bool searchPrefabOverridesOnly = searchParameters.hideReduntantPrefabVariantLinks && unityObject.IsAsset() && PrefabUtility.GetCorrespondingObjectFromSource( unityObject ) != null;
bool searchPrefabOverridesOnly = ( ( searchParameters.hideNonOverriddenPrefabVariablesInAssets && unityObject.IsAsset() ) || ( searchParameters.hideNonOverriddenPrefabVariablesInScenes && !unityObject.IsAsset() ) ) && PrefabUtility.GetCorrespondingObjectFromSource( unityObject ) != null;
#endif
bool enterChildren;
do
@@ -35,7 +35,8 @@ namespace AssetUsageDetectorNamespace
private const string PREFS_ADDRESSABLES_SUPPORT = "AUD_AddressablesSupport";
private const string PREFS_CALCULATE_UNUSED_OBJECTS = "AUD_FindUnusedObjs";
private const string PREFS_HIDE_DUPLICATE_ROWS = "AUD_HideDuplicates";
private const string PREFS_HIDE_REDUNDANT_PREFAB_VARIANT_LINKS = "AUD_HideRedundantPVariantLinks";
private const string PREFS_HIDE_NON_OVERRIDDEN_PREFAB_VARIABLES_IN_ASSETS = "AUD_HideRedundantPVariantLinks";
private const string PREFS_HIDE_NON_OVERRIDDEN_PREFAB_VARIABLES_IN_SCENES = "AUD_HideRedundantPVarsInScenes";
private const string PREFS_SHOW_PROGRESS = "AUD_Progress";
private static readonly GUIContent windowTitle = new GUIContent( "Asset Usage Detector" );
@@ -93,7 +94,8 @@ namespace AssetUsageDetectorNamespace
private bool searchUnusedMaterialProperties = true;
private bool calculateUnusedObjects = false;
private bool hideDuplicateRows = true;
private bool hideReduntantPrefabVariantLinks = true;
private bool hideNonOverriddenPrefabVariablesInAssets = true;
private bool hideNonOverriddenPrefabVariablesInScenes = false;
private bool noAssetDatabaseChanges = false;
private bool showDetailedProgressBar = true;
@@ -331,7 +333,8 @@ namespace AssetUsageDetectorNamespace
#endif
calculateUnusedObjects = searchParameters.calculateUnusedObjects;
hideDuplicateRows = searchParameters.hideDuplicateRows;
hideReduntantPrefabVariantLinks = searchParameters.hideReduntantPrefabVariantLinks;
hideNonOverriddenPrefabVariablesInAssets = searchParameters.hideNonOverriddenPrefabVariablesInAssets;
hideNonOverriddenPrefabVariablesInScenes = searchParameters.hideNonOverriddenPrefabVariablesInScenes;
noAssetDatabaseChanges = searchParameters.noAssetDatabaseChanges;
showDetailedProgressBar = searchParameters.showDetailedProgressBar;
@@ -414,7 +417,8 @@ namespace AssetUsageDetectorNamespace
#endif
EditorPrefs.SetBool( PREFS_CALCULATE_UNUSED_OBJECTS, calculateUnusedObjects );
EditorPrefs.SetBool( PREFS_HIDE_DUPLICATE_ROWS, hideDuplicateRows );
EditorPrefs.SetBool( PREFS_HIDE_REDUNDANT_PREFAB_VARIANT_LINKS, hideReduntantPrefabVariantLinks );
EditorPrefs.SetBool( PREFS_HIDE_NON_OVERRIDDEN_PREFAB_VARIABLES_IN_ASSETS, hideNonOverriddenPrefabVariablesInAssets );
EditorPrefs.SetBool( PREFS_HIDE_NON_OVERRIDDEN_PREFAB_VARIABLES_IN_SCENES, hideNonOverriddenPrefabVariablesInScenes );
EditorPrefs.SetBool( PREFS_SHOW_PROGRESS, showDetailedProgressBar );
}
@@ -436,7 +440,8 @@ namespace AssetUsageDetectorNamespace
#endif
calculateUnusedObjects = EditorPrefs.GetBool( PREFS_CALCULATE_UNUSED_OBJECTS, false );
hideDuplicateRows = EditorPrefs.GetBool( PREFS_HIDE_DUPLICATE_ROWS, true );
hideReduntantPrefabVariantLinks = EditorPrefs.GetBool( PREFS_HIDE_REDUNDANT_PREFAB_VARIANT_LINKS, true );
hideNonOverriddenPrefabVariablesInAssets = EditorPrefs.GetBool( PREFS_HIDE_NON_OVERRIDDEN_PREFAB_VARIABLES_IN_ASSETS, true );
hideNonOverriddenPrefabVariablesInScenes = EditorPrefs.GetBool( PREFS_HIDE_NON_OVERRIDDEN_PREFAB_VARIABLES_IN_SCENES, false );
showDetailedProgressBar = EditorPrefs.GetBool( PREFS_SHOW_PROGRESS, true );
}
@@ -583,7 +588,8 @@ namespace AssetUsageDetectorNamespace
calculateUnusedObjects = WordWrappingToggleLeft( "Calculate unused objects", calculateUnusedObjects );
hideDuplicateRows = WordWrappingToggleLeft( "Hide duplicate rows in search results", hideDuplicateRows );
#if UNITY_2018_3_OR_NEWER
hideReduntantPrefabVariantLinks = WordWrappingToggleLeft( "Hide redundant prefab variant links (when the same value is assigned to the same Component of a prefab and its variant(s))", hideReduntantPrefabVariantLinks );
hideNonOverriddenPrefabVariablesInAssets = WordWrappingToggleLeft( "Hide non-overridden prefab variables in assets (references found in non-overridden variables of prefab variants/nested prefabs will be hidden)", hideNonOverriddenPrefabVariablesInAssets );
hideNonOverriddenPrefabVariablesInScenes = WordWrappingToggleLeft( "Hide non-overridden prefab variables in scenes (references found in non-overridden variables of prefab instances will be hidden)", hideNonOverriddenPrefabVariablesInScenes );
#endif
noAssetDatabaseChanges = WordWrappingToggleLeft( "I haven't modified any assets/scenes since the last search (faster search)", noAssetDatabaseChanges );
showDetailedProgressBar = WordWrappingToggleLeft( "Update search progress bar more often (cancelable search) (slower search)", showDetailedProgressBar );
@@ -724,7 +730,8 @@ namespace AssetUsageDetectorNamespace
#endif
calculateUnusedObjects = calculateUnusedObjects,
hideDuplicateRows = hideDuplicateRows,
hideReduntantPrefabVariantLinks = hideReduntantPrefabVariantLinks,
hideNonOverriddenPrefabVariablesInAssets = hideNonOverriddenPrefabVariablesInAssets,
hideNonOverriddenPrefabVariablesInScenes = hideNonOverriddenPrefabVariablesInScenes,
noAssetDatabaseChanges = noAssetDatabaseChanges,
showDetailedProgressBar = showDetailedProgressBar
} );
@@ -778,28 +778,47 @@ namespace AssetUsageDetectorNamespace
IsExpanded = true;
} );
if( searchResult != null && searchResult.NumberOfGroups > 1 && !string.IsNullOrEmpty( treeViewState.searchTerm ) )
if( !string.IsNullOrEmpty( treeViewState.searchTerm ) )
{
if( contextMenu.GetItemCount() > 0 )
contextMenu.AddSeparator( "" );
contextMenu.AddItem( new GUIContent( "Apply Search to All Results" ), false, () =>
if( searchResult != null && searchResult.NumberOfGroups > 1 )
{
for( int i = 0; i < searchResult.NumberOfGroups; i++ )
contextMenu.AddItem( new GUIContent( "Apply Search to All Results" ), false, () =>
{
if( searchResult[i].treeView == null )
continue;
for( int i = 0; i < searchResult.NumberOfGroups; i++ )
{
if( searchResult[i].treeView == null )
continue;
string previousSearchTerm = searchResult[i].treeViewState.searchTerm ?? "";
SearchResultTreeView.SearchMode previousSearchMode = searchResult[i].treeViewState.searchMode;
string previousSearchTerm = searchResult[i].treeViewState.searchTerm ?? "";
SearchResultTreeView.SearchMode previousSearchMode = searchResult[i].treeViewState.searchMode;
searchResult[i].treeViewState.searchTerm = treeViewState.searchTerm ?? "";
searchResult[i].treeViewState.searchMode = treeViewState.searchMode;
searchResult[i].treeViewState.searchTerm = treeViewState.searchTerm ?? "";
searchResult[i].treeViewState.searchMode = treeViewState.searchMode;
if( treeViewState.searchTerm != previousSearchTerm || treeViewState.searchMode != previousSearchMode )
searchResult[i].treeView.RefreshSearch( previousSearchTerm );
}
} );
if( treeViewState.searchTerm != previousSearchTerm || treeViewState.searchMode != previousSearchMode )
searchResult[i].treeView.RefreshSearch( previousSearchTerm );
}
} );
}
IList<TreeViewItem> treeViewRows = treeView.GetRows();
if( treeViewRows.Count > 1 ) // References are at depth 1 so if there are any references, at least 2 rows must exist
{
contextMenu.AddItem( new GUIContent( "Hide Search Results" ), false, () =>
{
List<int> removedRows = new List<int>( treeViewRows.Count );
for( int i = treeViewRows.Count - 1; i >= 0; i-- )
{
if( treeViewRows[i].depth > 0 )
removedRows.Add( treeViewRows[i].id );
}
treeView.HideItems( removedRows );
} );
}
}
}
@@ -881,7 +900,7 @@ namespace AssetUsageDetectorNamespace
if( shouldUpdateInitialTreeViewNodeId )
treeViewState.initialNodeId = searchResult.nextTreeViewId;
treeView = new SearchResultTreeView( treeViewState, references, ( Type == GroupType.UnusedObjects ) ? SearchResultTreeView.TreeType.UnusedObjects : SearchResultTreeView.TreeType.Normal, searchResult != null ? searchResult.UsedObjects : null, searchResult != null && searchResult.SearchParameters.hideDuplicateRows, searchResult != null && searchResult.SearchParameters.hideReduntantPrefabVariantLinks, true );
treeView = new SearchResultTreeView( treeViewState, references, ( Type == GroupType.UnusedObjects ) ? SearchResultTreeView.TreeType.UnusedObjects : SearchResultTreeView.TreeType.Normal, searchResult != null ? searchResult.UsedObjects : null, searchResult != null && searchResult.SearchParameters.hideDuplicateRows, true );
if( isFirstInitialization )
{
@@ -124,7 +124,6 @@ namespace AssetUsageDetectorNamespace
private readonly TreeType treeType;
private readonly bool hideDuplicateRows;
private readonly bool hideReduntantPrefabVariantLinks;
private bool isSearching;
@@ -164,13 +163,12 @@ namespace AssetUsageDetectorNamespace
[System.Obsolete] private new string searchString { get; }
[System.Obsolete] private new bool hasSearch { get; }
public SearchResultTreeView( SearchResultTreeViewState state, List<ReferenceNode> references, TreeType treeType, HashSet<Object> usedObjectsSet, bool hideDuplicateRows, bool hideReduntantPrefabVariantLinks, bool usesExternalScrollView ) : base( state )
public SearchResultTreeView( SearchResultTreeViewState state, List<ReferenceNode> references, TreeType treeType, HashSet<Object> usedObjectsSet, bool hideDuplicateRows, bool usesExternalScrollView ) : base( state )
{
this.state = state;
this.references = references;
this.treeType = treeType;
this.hideDuplicateRows = hideDuplicateRows;
this.hideReduntantPrefabVariantLinks = hideReduntantPrefabVariantLinks;
highlightedSearchTextColor = "<color=#" + ColorUtility.ToHtmlStringRGBA( AssetUsageDetectorSettings.SearchMatchingTextColor ) + ">";
@@ -993,7 +991,7 @@ namespace AssetUsageDetectorNamespace
return referenceNodes.Contains( GetDataFromId( item.id ).node );
}
private void HideItems( IList<int> ids )
public void HideItems( IList<int> ids )
{
if( ids.Count > 0 )
{
@@ -1158,7 +1156,7 @@ namespace AssetUsageDetectorNamespace
if( selectedNodes.Count > 0 )
{
SearchResultTreeView isolatedTreeView = new SearchResultTreeView( new SearchResultTreeViewState(), selectedNodes, TreeType.IsolatedView, null, hideDuplicateRows, hideReduntantPrefabVariantLinks, false );
SearchResultTreeView isolatedTreeView = new SearchResultTreeView( new SearchResultTreeViewState(), selectedNodes, TreeType.IsolatedView, null, hideDuplicateRows, false );
isolatedTreeView.ExpandMainReferences();
SearchResultTreeViewIsolatedView.Show( new Vector2( EditorWindow.focusedWindow.position.width, Mathf.Max( isolatedTreeView.totalHeight, EditorGUIUtility.singleLineHeight * 5f ) + 1f ), isolatedTreeView, new GUIContent( selectedNodes[0].Label + ( selectedNodes.Count <= 1 ? "" : ( " (and " + ( selectedNodes.Count - 1 ) + " more)" ) ) ) );
+1 -1
View File
@@ -1,4 +1,4 @@
= Asset Usage Detector (v2.5.3) =
= Asset Usage Detector (v2.5.4) =
Documentation: https://github.com/yasirkula/UnityAssetUsageDetector
E-mail: yasirkula@gmail.com
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "com.yasirkula.assetusagedetector",
"displayName": "Asset Usage Detector",
"version": "2.5.3",
"version": "2.5.4",
"documentationUrl": "https://github.com/yasirkula/UnityAssetUsageDetector",
"changelogUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/releases",
"licensesUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/blob/master/LICENSE.txt",