Exemple #1
0
 /// <summary>
 /// 目标文件夹GUI
 /// </summary>
 private void OnFolderGUI()
 {
     GUILayout.BeginHorizontal();
     GUILayout.Label("Target Folder:", GUILayout.Width(100));
     _folder     = EditorGUILayout.ObjectField(_folder, typeof(DefaultAsset), false) as DefaultAsset;
     GUI.enabled = _folder != null && _textureResizer == null;
     if (GUILayout.Button("Search", EditorStyles.miniButtonLeft, GUILayout.Width(50)))
     {
         _folderPath     = AssetDatabase.GetAssetPath(_folder);
         _textureResizer = new TextureResizer(new string[] { _folderPath });
         for (int i = 0; i < _textureResizer.Agents.Count; i++)
         {
             EditorUtility.DisplayProgressBar("Textrue Load", _textureResizer.Agents[i].Path, (float)i / _textureResizer.Agents.Count);
             _textureResizer.Agents[i].LoadValue();
         }
         EditorUtility.ClearProgressBar();
         _nameFilter = "";
         ResetDisplayAgents();
     }
     GUI.enabled = _textureResizer != null;
     if (GUILayout.Button("Clear", EditorStyles.miniButtonRight, GUILayout.Width(50)))
     {
         _textureResizer.Dispose();
         _textureResizer = null;
         _agents         = null;
         _nameFilter     = "";
     }
     GUI.enabled = true;
     GUILayout.EndHorizontal();
 }
Exemple #2
0
 private void OnDestroy()
 {
     if (_textureResizer != null)
     {
         _textureResizer.Dispose();
         _textureResizer = null;
     }
 }
Exemple #3
0
 public static void ResizeToMultipleOf4All()
 {
     if (EditorUtility.DisplayDialog("Prompt", "Are you sure you want to resize to multiple of 4 at all texture2d? this is maybe time consuming!", "Yes", "No"))
     {
         List <TextrueResizeFeedback> feedbacks = null;
         TimeSpan timeSpan = ExecutionInTimeMonitor(() =>
         {
             TextureResizer resizer = new TextureResizer();
             feedbacks = resizer.ResizeToMultipleOf4();
             resizer.Dispose();
         });
         TextrueResizeFeedbackWindow.OpenWindow(feedbacks, timeSpan);
     }
 }