From 31c2cebbccba45a00a755981dd6d0cdd0a0459e9 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期二, 14 八月 2018 17:28:38 +0800
Subject: [PATCH] Merge branch 'master' into leonard

---
 Assets/Editor/Tool/TextureRefrenceFinder.cs |  382 +++++++++++++++++++++++++++---------------------------
 1 files changed, 191 insertions(+), 191 deletions(-)

diff --git a/Assets/Editor/Tool/TextureRefrenceFinder.cs b/Assets/Editor/Tool/TextureRefrenceFinder.cs
index 73966cd..cb1ba4a 100644
--- a/Assets/Editor/Tool/TextureRefrenceFinder.cs
+++ b/Assets/Editor/Tool/TextureRefrenceFinder.cs
@@ -6,19 +6,19 @@
 using System.IO;
 using System.Text.RegularExpressions;
 
-public class TextureRefrenceFinder : EditorWindow
-{
-
-    static TextureRefrenceFinder window;
-
-    [UnityEditor.MenuItem("缇庢湳宸ュ叿/璐村浘寮曠敤鏌ユ壘宸ュ叿")]
-    static void Init()
-    {
-        window = GetWindow(typeof(TextureRefrenceFinder), false, "璐村浘寮曠敤鏌ユ壘宸ュ叿") as TextureRefrenceFinder;
-        window.Show();
-        window.autoRepaintOnSceneChange = true;
-    }
-
+public class TextureRefrenceFinder : EditorWindow
+{
+
+    static TextureRefrenceFinder window;
+
+    [UnityEditor.MenuItem("缇庢湳宸ュ叿/璐村浘寮曠敤鏌ユ壘宸ュ叿")]
+    static void Init()
+    {
+        window = GetWindow(typeof(TextureRefrenceFinder), false, "璐村浘寮曠敤鏌ユ壘宸ュ叿") as TextureRefrenceFinder;
+        window.Show();
+        window.autoRepaintOnSceneChange = true;
+    }
+
     static List<Texture> selectedTextures = new List<Texture>();
     static Texture selectedTexture;
 
@@ -27,194 +27,194 @@
     static List<Material> refrenceMaterials = new List<Material>();
 
     [MenuItem("Assets/閫夋嫨鍥剧墖")]
-    public static void SetSelectedTextures()
-    {
-        var assets = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets);
-        var total = assets.Length;
-        var index = 0;
-
-        try
-        {
-            selectedTextures.Clear();
-            foreach (var asset in assets)
-            {
-                var assetPath = AssetDatabase.GetAssetPath(asset);
-                var texture = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Texture));
-                if (texture != null)
-                {
-                    selectedTextures.Add((Texture)texture);
-                }
-
-                index++;
-
-                EditorUtility.DisplayProgressBar("鏌ユ壘鍥剧墖", assetPath, index / (float)total);
-            }
-        }
-        catch (Exception ex)
-        {
-            Debug.LogError(ex);
-        }
-        finally
-        {
-            selectedTexture = selectedTextures != null && selectedTextures.Count > 0 ? selectedTextures[0] : null;
-            EditorUtility.ClearProgressBar();
-        }
+    public static void SetSelectedTextures()
+    {
+        var assets = Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets);
+        var total = assets.Length;
+        var index = 0;
+
+        try
+        {
+            selectedTextures.Clear();
+            foreach (var asset in assets)
+            {
+                var assetPath = AssetDatabase.GetAssetPath(asset);
+                var texture = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Texture));
+                if (texture != null)
+                {
+                    selectedTextures.Add((Texture)texture);
+                }
+
+                index++;
+
+                EditorUtility.DisplayProgressBar("鏌ユ壘鍥剧墖", assetPath, index / (float)total);
+            }
+        }
+        catch (Exception ex)
+        {
+            Debug.LogError(ex);
+        }
+        finally
+        {
+            selectedTexture = selectedTextures != null && selectedTextures.Count > 0 ? selectedTextures[0] : null;
+            EditorUtility.ClearProgressBar();
+        }
     }
 
-    Vector2 textureScrollViewPosition = Vector2.zero;
+    Vector2 textureScrollViewPosition = Vector2.zero;
     Vector2 materialScrollViewPosition = Vector2.zero;
 
-    private void OnGUI()
-    {
-        EditorGUILayout.BeginVertical();
-
-        EditorGUILayout.LabelField("璐村浘");
-        EditorGUILayout.Space();
-
-        if (selectedTextures != null && selectedTextures.Count > 0)
-        {
-            EditorGUI.indentLevel++;
-            textureScrollViewPosition = EditorGUILayout.BeginScrollView(textureScrollViewPosition);
-            foreach (var texture in selectedTextures)
-            {
-                DrawTexture(texture);
-            }
-            EditorGUILayout.EndScrollView();
-
-            EditorGUI.indentLevel--;
-        }
-
-        EditorGUILayout.Space();
-        if (GUILayout.Button("鏌ユ壘鏉愯川"))
-        {
-            if (!findAllMaterials)
-            {
-                FindAllMaterials();
-            }
-
-            FindRefreceMaterials(selectedTexture);
-        }
-
-        EditorGUILayout.Space();
-
-        EditorGUILayout.LabelField("寮曠敤璐村浘鐨勬潗璐�");
-        EditorGUILayout.Space();
-        if (refrenceMaterials != null && refrenceMaterials.Count > 0)
-        {
-            EditorGUI.indentLevel++;
-            materialScrollViewPosition = EditorGUILayout.BeginScrollView(materialScrollViewPosition);
-            foreach (var material in refrenceMaterials)
-            {
-                DrawMaterial(material);
-            }
-            EditorGUILayout.EndScrollView();
-
-            EditorGUI.indentLevel--;
-        }
-
-        EditorGUILayout.Space();
-        EditorGUILayout.Space();
-        EditorGUILayout.EndVertical();
+    private void OnGUI()
+    {
+        EditorGUILayout.BeginVertical();
+
+        EditorGUILayout.LabelField("璐村浘");
+        EditorGUILayout.Space();
+
+        if (selectedTextures != null && selectedTextures.Count > 0)
+        {
+            EditorGUI.indentLevel++;
+            textureScrollViewPosition = EditorGUILayout.BeginScrollView(textureScrollViewPosition);
+            foreach (var texture in selectedTextures)
+            {
+                DrawTexture(texture);
+            }
+            EditorGUILayout.EndScrollView();
+
+            EditorGUI.indentLevel--;
+        }
+
+        EditorGUILayout.Space();
+        if (GUILayout.Button("鏌ユ壘鏉愯川"))
+        {
+            if (!findAllMaterials)
+            {
+                FindAllMaterials();
+            }
+
+            FindRefreceMaterials(selectedTexture);
+        }
+
+        EditorGUILayout.Space();
+
+        EditorGUILayout.LabelField("寮曠敤璐村浘鐨勬潗璐�");
+        EditorGUILayout.Space();
+        if (refrenceMaterials != null && refrenceMaterials.Count > 0)
+        {
+            EditorGUI.indentLevel++;
+            materialScrollViewPosition = EditorGUILayout.BeginScrollView(materialScrollViewPosition);
+            foreach (var material in refrenceMaterials)
+            {
+                DrawMaterial(material);
+            }
+            EditorGUILayout.EndScrollView();
+
+            EditorGUI.indentLevel--;
+        }
+
+        EditorGUILayout.Space();
+        EditorGUILayout.Space();
+        EditorGUILayout.EndVertical();
     }
 
-    private void DrawTexture(Texture _texture)
-    {
-        if (_texture == null)
-        {
-            return;
-        }
-
-        EditorGUILayout.BeginHorizontal();
-        EditorGUILayout.ObjectField(_texture.name, _texture, typeof(Texture), true);
-        if (EditorGUILayout.Toggle(_texture != null && _texture == selectedTexture))
-        {
-            selectedTexture = _texture;
-        }
-        EditorGUILayout.EndHorizontal();
+    private void DrawTexture(Texture _texture)
+    {
+        if (_texture == null)
+        {
+            return;
+        }
+
+        EditorGUILayout.BeginHorizontal();
+        EditorGUILayout.ObjectField(_texture.name, _texture, typeof(Texture), true);
+        if (EditorGUILayout.Toggle(_texture != null && _texture == selectedTexture))
+        {
+            selectedTexture = _texture;
+        }
+        EditorGUILayout.EndHorizontal();
+    }
+
+    private void DrawMaterial(Material _material)
+    {
+        if (_material == null)
+        {
+            return;
+        }
+
+        EditorGUILayout.ObjectField(_material.name, _material, typeof(Material), true);
     }
 
-    private void DrawMaterial(Material _material)
-    {
-        if (_material == null)
-        {
-            return;
-        }
-
-        EditorGUILayout.ObjectField(_material.name, _material, typeof(Material), true);
+    static void FindAllMaterials()
+    {
+        var path = Application.dataPath + "/Art";
+        var allFiles = new DirectoryInfo(path).GetFiles("*", SearchOption.AllDirectories);
+        var total = allFiles.Length;
+        var index = 0;
+
+        try
+        {
+            allMaterials.Clear();
+            foreach (var file in allFiles)
+            {
+                var assetPath = "Assets" + file.FullName.Replace("\\", "/").Replace(Application.dataPath, "");
+                var material = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Material));
+                if (material != null)
+                {
+                    allMaterials.Add((Material)material);
+                }
+
+                index++;
+                EditorUtility.DisplayProgressBar("鍒濆鍖栨潗璐�", assetPath, index / (float)total);
+            }
+        }
+        catch (Exception ex)
+        {
+            Debug.LogError(ex);
+        }
+        finally
+        {
+            findAllMaterials = true;
+            EditorUtility.ClearProgressBar();
+        }
     }
 
-    static void FindAllMaterials()
-    {
-        var path = Application.dataPath + "/Art";
-        var allFiles = new DirectoryInfo(path).GetFiles("*", SearchOption.AllDirectories);
-        var total = allFiles.Length;
-        var index = 0;
-
-        try
-        {
-            allMaterials.Clear();
-            foreach (var file in allFiles)
-            {
-                var assetPath = "Assets" + file.FullName.Replace("\\", "/").Replace(Application.dataPath, "");
-                var material = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Material));
-                if (material != null)
-                {
-                    allMaterials.Add((Material)material);
-                }
-
-                index++;
-                EditorUtility.DisplayProgressBar("鍒濆鍖栨潗璐�", assetPath, index / (float)total);
-            }
-        }
-        catch (Exception ex)
-        {
-            Debug.LogError(ex);
-        }
-        finally
-        {
-            findAllMaterials = true;
-            EditorUtility.ClearProgressBar();
-        }
-    }
-
-    static void FindRefreceMaterials(Texture _texture)
-    {
-        refrenceMaterials.Clear();
-        if (_texture == null)
-        {
-            return;
-        }
-
-        var guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(_texture));
-        var total = allMaterials.Count;
-        var index = 0;
-
-        try
-        {
-            foreach (var material in allMaterials)
-            {
-                var text = File.ReadAllText(AssetDatabase.GetAssetPath(material));
-                if (!string.IsNullOrEmpty(text) && Regex.IsMatch(text, guid))
-                {
-                    refrenceMaterials.Add(material);
-
-                    break;
-                }
-
-                index++;
-
-                EditorUtility.DisplayProgressBar("鏌ユ壘寮曠敤鏉愯川", material.name, index / (float)total);
-            }
-        }
-        catch (Exception ex)
-        {
-            Debug.Log(ex);
-        }
-        finally
-        {
-            EditorUtility.ClearProgressBar();
-        }
-
+    static void FindRefreceMaterials(Texture _texture)
+    {
+        refrenceMaterials.Clear();
+        if (_texture == null)
+        {
+            return;
+        }
+
+        var guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(_texture));
+        var total = allMaterials.Count;
+        var index = 0;
+
+        try
+        {
+            foreach (var material in allMaterials)
+            {
+                var text = File.ReadAllText(AssetDatabase.GetAssetPath(material));
+                if (!string.IsNullOrEmpty(text) && Regex.IsMatch(text, guid))
+                {
+                    refrenceMaterials.Add(material);
+
+                    break;
+                }
+
+                index++;
+
+                EditorUtility.DisplayProgressBar("鏌ユ壘寮曠敤鏉愯川", material.name, index / (float)total);
+            }
+        }
+        catch (Exception ex)
+        {
+            Debug.Log(ex);
+        }
+        finally
+        {
+            EditorUtility.ClearProgressBar();
+        }
+
     }
 
 }

--
Gitblit v1.8.0