示例#1
0
 void OnPostDrawResultItem(ScrollableObjectList list, string path)
 {
     if (AssetMenu.IsMouseDownInLastRect())
     {
         var o = AssetDatabase.LoadAssetAtPath(path, typeof(UnityObject));
         AssetMenu.PopupObjectHelperMenu(o);
     }
 }
示例#2
0
        void OnGUI()
        {
            OnKeyEvent();
            var e = Event.current;

            EditorGUIUtility.labelWidth = 100f;

            if (Target == null && !string.IsNullOrEmpty(guid) && guid.Length == 32)
            {
                var assetPath = AssetDatabase.GUIDToAssetPath(guid);
                if (!string.IsNullOrEmpty(assetPath))
                {
                    Target     = AssetDatabase.LoadAssetAtPath(assetPath, typeof(UnityObject));
                    targetPath = assetPath;
                }
            }
            Target = EditorGUILayout.ObjectField(Target, typeof(UnityObject), false);
            if (Target != null && AssetMenu.IsMouseDownInLastRect())
            {
                AssetMenu.PopupObjectHelperMenu(Target);
            }
            if (Target == null)
            {
                targetPath = null;
            }
            else
            {
                targetPath = AssetDatabase.GetAssetPath(Target);
                guid       = AssetDatabase.AssetPathToGUID(targetPath);
            }
            var newGUID = EditorGUILayout.TextField("GUID", guid ?? "");

            if (newGUID != guid)
            {
                guid       = newGUID;
                Target     = null;
                targetPath = null;
            }
            EditorGUILayout.TextField("Path", targetPath ?? "");

            if (Target != null && Target != beforeTarget)
            {
                beforeTarget = Target;
                objectList.Clear();
                engine.Start(targetPath, isRecursive, AddObjectList);
            }

            EditorGUILayout.BeginHorizontal();
            if (!engine.IsInitialized)
            {
                EditorGUILayout.LabelField("initialize ...");
            }
            else
            {
                EditorGUILayout.LabelField(string.Format("references: {0} {1}", objectList.Count, engine.IsSearching ? "..." : ""));
            }
            if (AssetDependencyDatabase.IsFullScanRunning())
            {
                EditorGUILayout.LabelField(string.Format("scan: {0}", AssetDependencyDatabase.GetScanQueueCount()));
            }
            else
            {
                EditorGUILayout.LabelField("");
            }
            EditorGUILayout.EndHorizontal();

            objectList.Draw();

            AssetMenu.DequeueContextAction();
        }