示例#1
0
        public override void OnInspectorGUI()
        {
            UAI = target as UMAAssetIndexer;

            if (Event.current.type == EventType.Layout)
            {
                Cleanup();
            }

            ShowTypes();

            // Draw and handle the Drag/Drop
            GUILayout.Space(20);
            Rect dropArea = GUILayoutUtility.GetRect(0.0f, 50.0f, GUILayout.ExpandWidth(true));

            GUI.Box(dropArea, "Drag Indexable Assets here. Non indexed assets will be ignored.");
            GUILayout.Space(20);
            DropAreaGUI(dropArea);

            System.Type[] Types = UAI.GetTypes();
            if (Toggles.Count != Types.Length)
            {
                SetFoldouts(false);
            }

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Reindex Names"))
            {
                UAI.RebuildIndex();
            }
            if (GUILayout.Button("Add Build References"))
            {
                UAI.AddReferences();
                Resources.UnloadUnusedAssets();
            }
            GUILayout.EndHorizontal();


            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Rebuild From Project (Adds Everything)"))
            {
                UAI.Clear();
                UAI.AddEverything(IncludeText);
                Resources.UnloadUnusedAssets();
            }
            IncludeText = GUILayout.Toggle(IncludeText, "Include TextAssets");
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Clear References"))
            {
                UAI.ClearReferences();
                Resources.UnloadUnusedAssets();
            }
            if (GUILayout.Button("Clear All"))
            {
                UAI.Clear();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Collapse All"))
            {
                SetFoldouts(false);
            }

            if (GUILayout.Button("Expand All"))
            {
                SetFoldouts(true);
            }

            GUILayout.EndHorizontal();

            //bool PreSerialize = UAI.SerializeAllObjects;
            ////UAI.SerializeAllObjects = EditorGUILayout.Toggle("Serialize for build (SLOW)", UAI.SerializeAllObjects);
            //if (UAI.SerializeAllObjects != PreSerialize)
            //{
            //	UAI.ForceSave();
            //}
            UAI.AutoUpdate = EditorGUILayout.Toggle("Process Updates", UAI.AutoUpdate);
            GUILayout.BeginHorizontal();

            Filter = EditorGUILayout.TextField("Filter Library", Filter);
            GUI.SetNextControlName("TheDumbUnityBuggyField");
            if (GUILayout.Button("-", GUILayout.Width(20)))
            {
                Filter = "";
                // 10 year old unity bug that no one wants to fix.
                GUI.FocusControl("TheDumbUnityBuggyField");
            }
            GUILayout.EndHorizontal();

            bool   HasErrors  = false;
            string ErrorTypes = "";

            NotInBuildCount = 0;

            foreach (System.Type t in Types)
            {
                if (t != typeof(AnimatorController))                 // Somewhere, a kitten died because I typed that.
                {
                    if (ShowArray(t, Filter))
                    {
                        HasErrors   = true;
                        ErrorTypes += t.Name + " ";
                    }
                }
            }
            string bldMessage = "(" + NotInBuildCount + ") Item(s) not in build";

            GUILayout.BeginHorizontal();
            if (HasErrors)
            {
                GUILayout.Label(ErrorTypes + "Have error items! " + bldMessage);
            }
            else
            {
                GUILayout.Label("All items appear OK. " + bldMessage);
            }
            GUILayout.EndHorizontal();
        }