Пример #1
0
 void EditKeyBindings(InspectorNavigator inspector)
 {
     var script = MonoScript.FromMonoBehaviour(inspector.breadcrumbs);
     var path = AssetDatabase.GetAssetPath(script);
     path = path.Substring(0, path.LastIndexOfAny(new[] { '/', '\\' }));
     path += "/Editor/KeyBindings.cs";
     script = AssetDatabase.LoadAssetAtPath(path, typeof(MonoScript)) as MonoScript;
     if (script != null)
     {
         Close();
         AssetDatabase.OpenAsset(script);
     }
 }
Пример #2
0
        void OnGUI()
        {
            if (Application.unityVersion[0] >= '5') EditorGUILayout.Space();
            inspector = InspectorNavigator.Instance;
            if (inspector == null)
            {
                InspectorNavigator.OpenWindow();
                inspector = InspectorNavigator.Instance;
            }
#if FULL_VERSION
            EditorGUILayout.LabelField("Inspector Navigator Version " + InspectorNavigator.CurrentVersion / 100 + "." + (InspectorNavigator.CurrentVersion % 100).ToString("00") + " [Full]", EditorStyles.boldLabel);
            EditorGUILayout.Space();
            EditorGUI.BeginChangeCheck();
            if (GUILayout.Button("Edit Navigator Key Bindings")) EditKeyBindings(inspector);
            EditorGUILayout.Space();
            inspector.MaxEnqueuedObjects = EditorGUILayout.IntField(new GUIContent("Max. enqueued objects", "Max. number of objects on Back/Forward queues"), inspector.MaxEnqueuedObjects);
            if (inspector.MaxEnqueuedObjects < 8) inspector.MaxEnqueuedObjects = 8; else if (inspector.MaxEnqueuedObjects > 512) inspector.MaxEnqueuedObjects = 512;
            inspector.MaxLabelWidth = EditorGUILayout.IntField(new GUIContent("Max. label width", "Maximum object label width in pixels (0: full)"), inspector.MaxLabelWidth);
            if (inspector.MaxLabelWidth < 0) inspector.MaxLabelWidth = 0;
            else if (inspector.MaxLabelWidth > 0 && inspector.MaxLabelWidth < 20) inspector.MaxLabelWidth = 20;
            if (EditorGUI.EndChangeCheck()) inspector.Repaint();
            EditorGUI.BeginChangeCheck();
            inspector.BarAlignment = (BarAlignment)EditorGUILayout.EnumPopup(new GUIContent("Bar alignment", "Set horizontal breadcrumb alignment preference"), inspector.BarAlignment);
            if (EditorGUI.EndChangeCheck()) inspector.Repaint();
            inspector.InsertNewObjects = EditorGUILayout.Toggle(new GUIContent("Insert new objects", "Insert objects, instead of clearing forward list"), inspector.InsertNewObjects);
            EditorGUI.BeginChangeCheck();
            inspector.RemoveUnnamedObjects = EditorGUILayout.Toggle(new GUIContent("Remove unnamed objs", "Remove breadcrumbs with no name"), inspector.RemoveUnnamedObjects);
            if (EditorGUI.EndChangeCheck() && inspector.RemoveUnnamedObjects) inspector.Repaint();
            var prevDupBehaviour = inspector.DuplicatesBehavior;
            inspector.DuplicatesBehavior = (DuplicatesBehavior)EditorGUILayout.EnumPopup(new GUIContent("Duplicated Objects", "What to do with duplicated objects"), inspector.DuplicatesBehavior);
            if (inspector.DuplicatesBehavior != prevDupBehaviour && inspector.DuplicatesBehavior == DuplicatesBehavior.RemoveAllDuplicates)
            {
                inspector.ClearDuplicates();
                inspector.Repaint();
            }
            inspector.CameraBehavior = (CameraBehavior)EditorGUILayout.EnumPopup(new GUIContent("Scene camera behavior", "What to do with the scene camera"), inspector.CameraBehavior);
            inspector.CheckForUpdates = EditorGUILayout.Toggle(new GUIContent("Check for updates", "Check if there's a new version"), inspector.CheckForUpdates);
            inspector.OtherNotifications = EditorGUILayout.Toggle(new GUIContent("Other notifications", "Show other wasabimole notifications"), inspector.OtherNotifications);
            EditorGUILayout.Space();
            EditorGUI.BeginChangeCheck();
            GUI.enabled = inspector.SerializeBreadcrumbs = EditorGUILayout.ToggleLeft(new GUIContent("Save InspectorBreadcrumbs as a scene object", "Serialize InspectorBreadcrumbs in every scene"), inspector.SerializeBreadcrumbs);
            if (EditorGUI.EndChangeCheck())
            {
                inspector.SetBreadcrumbsProperties();
                if (!inspector.SerializeBreadcrumbs && Event.current.type == EventType.Used)
                    if (EditorUtility.DisplayDialog("Remove breadcrumbs from all of your project scenes?", "Would you like to remove the Inspector Navigator's breadcrumbs object from all your existing project scenes? (might take a while if you have many big scenes)", "Yes, clean all scenes", "No, cancel"))
                        InspectorNavigator.ClearAllProjectBreadcrumbs();
            }
            var showBC = inspector.ShowBreadcrumbsObject;
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(18);
            inspector.ShowBreadcrumbsObject = EditorGUILayout.Toggle(new GUIContent("Show breadcrumbs obj", "Show breadcrumbs object in scene"), inspector.ShowBreadcrumbsObject);
            EditorGUILayout.EndHorizontal();
            if (showBC != inspector.ShowBreadcrumbsObject) inspector.SetBreadcrumbsProperties();
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(18);
            inspector.ForceDirty = EditorGUILayout.Toggle(new GUIContent("Mark scene as changed", "New selections mark scene as changed"), inspector.ForceDirty);
            EditorGUILayout.EndHorizontal();
            GUI.enabled = true;
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Object filters (inspectors to track):", EditorStyles.boldLabel);
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            inspector.ColorInstance = EditorGUILayout.ColorField(inspector.ColorInstance, GUILayout.Width(32));
            EditorGUILayout.Space();
            inspector.TrackObjects = EditorGUILayout.ToggleLeft("Track scene GameObjects", inspector.TrackObjects);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            inspector.ColorAsset = EditorGUILayout.ColorField(inspector.ColorAsset, GUILayout.Width(32));
            EditorGUILayout.Space();
            inspector.TrackAssets = EditorGUILayout.ToggleLeft("Track project Assets", inspector.TrackAssets);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            inspector.ColorTextAssets = EditorGUILayout.ColorField(inspector.ColorTextAssets, GUILayout.Width(32));
            EditorGUILayout.Space();
            inspector.TrackTextAssets = EditorGUILayout.ToggleLeft("Track Scripts & TextAssets", inspector.TrackTextAssets);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            inspector.ColorFolder = EditorGUILayout.ColorField(inspector.ColorFolder, GUILayout.Width(32));
            EditorGUILayout.Space();
            inspector.TrackFolders = EditorGUILayout.ToggleLeft("Track project Folders", inspector.TrackFolders);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            inspector.ColorScene = EditorGUILayout.ColorField(inspector.ColorScene, GUILayout.Width(32));
            EditorGUILayout.Space();
            inspector.TrackScenes = EditorGUILayout.ToggleLeft("Track project Scenes", inspector.TrackScenes);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            inspector.ColorProjectSettings = EditorGUILayout.ColorField(inspector.ColorProjectSettings, GUILayout.Width(32));
            EditorGUILayout.Space();
#if (UNITY_4_3||UNITY_4_5||UNITY_4_6)
            EditorGUI.BeginChangeCheck();
#endif
            inspector.TrackProjectSettings = EditorGUILayout.ToggleLeft("Track project Settings", inspector.TrackProjectSettings);
#if (UNITY_4_3||UNITY_4_5||UNITY_4_6)
            if (EditorGUI.EndChangeCheck() && inspector.TrackProjectSettings && Event.current.type == EventType.Used)
                if (!EditorUtility.DisplayDialog("Enable tracking Project Settings inspectors?", "A few users reported problems on builds after having the Inspector Navigator's breadcrumbs pointing to Project Settings on Unity 4.X, are you sure you want to track settings objects?\n\nNote: You can also use the navigator's menu option \"Clear all project breadcrumbs\" to delete all the breadcrumbs from your project scenes before performing a build.", "Yes, track settings", "No, cancel"))
                    inspector.TrackProjectSettings = false;
#endif
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            inspector.ColorAssetStoreInspector = EditorGUILayout.ColorField(inspector.ColorAssetStoreInspector, GUILayout.Width(32));
            EditorGUILayout.Space();
            inspector.TrackAssetStoreInspector = EditorGUILayout.ToggleLeft("Track Asset Store Inspector", inspector.TrackAssetStoreInspector);
            EditorGUILayout.EndHorizontal();
            if (EditorGUI.EndChangeCheck()) inspector.RemoveFilteredObjects();
#else
            EditorGUILayout.LabelField("Inspector Navigator Version " + InspectorNavigator.CurrentVersion / 100 + "." + (InspectorNavigator.CurrentVersion % 100).ToString("00") + " [Trial]", EditorStyles.boldLabel);
            EditorGUILayout.Space();
            EditorGUILayout.HelpBox("Default options can not be changed on trial version", MessageType.Warning);
            EditorGUILayout.Space();
            if (GUILayout.Button("Upgrade to full version")) NotificationWindow.OpenAssetStore("content/26181");
            EditorGUILayout.Space();
            GUI.enabled = false;
            GUILayout.Button("Edit Navigator Key Bindings");
            EditorGUILayout.Space();
            EditorGUILayout.IntField(new GUIContent("Max. enqueued objects", "Max. number of objects on Back/Forward queues"), 64);
            EditorGUILayout.IntField(new GUIContent("Max. label width", "Maximum object label width in pixels (0: full)"), 0);
            EditorGUILayout.EnumPopup(new GUIContent("Bar alignment", "Set horizontal breadcrumb alignment preference"), BarAlignment.Right);
            EditorGUILayout.Toggle(new GUIContent("Insert new objects", "Insert objects, instead of clearing forward list"), false);
            EditorGUILayout.Toggle(new GUIContent("Remove unnamed objs", "Remove breadcrumbs with no name"), false);
            EditorGUILayout.EnumPopup(new GUIContent("Duplicated Objects", "What to do with duplicated objects"), DuplicatesBehavior.RemoveWhenLocked);
            EditorGUILayout.EnumPopup(new GUIContent("Scene camera behavior", "What to do with the scene camera"), CameraBehavior.RestorePreviousCamera);
            EditorGUILayout.Toggle(new GUIContent("Check for updates", "Check if there's a new version"), true);
            EditorGUILayout.Toggle(new GUIContent("Other notifications", "Show other wasabimole notifications"), true);
            EditorGUILayout.Space();
            EditorGUILayout.ToggleLeft(new GUIContent("Save InspectorBreadcrumbs as a scene object", "Serialize InspectorBreadcrumbs in every scene"), true);
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(18);
            EditorGUILayout.Toggle(new GUIContent("Show breadcrumbs obj", "Show breadcrumbs object in scene"), false);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(18);
            EditorGUILayout.Toggle(new GUIContent("Mark scene as changed", "New selections mark scene as changed"), false);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Object filters (inspectors to track):", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            EditorGUILayout.ColorField(Color.white, GUILayout.Width(32));
            EditorGUILayout.Space();
            EditorGUILayout.ToggleLeft("Track scene GameObjects", true);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            EditorGUILayout.ColorField(Color.white, GUILayout.Width(32));
            EditorGUILayout.Space();
            EditorGUILayout.ToggleLeft("Track project Assets", true);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            EditorGUILayout.ColorField(Color.white, GUILayout.Width(32));
            EditorGUILayout.Space();
            EditorGUILayout.ToggleLeft("Track Scripts & TextAssets", false);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            EditorGUILayout.ColorField(Color.white, GUILayout.Width(32));
            EditorGUILayout.Space();
            EditorGUILayout.ToggleLeft("Track project Folders", false);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            EditorGUILayout.ColorField(Color.white, GUILayout.Width(32));
            EditorGUILayout.Space();
            EditorGUILayout.ToggleLeft("Track project Scenes", false);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            EditorGUILayout.ColorField(Color.white, GUILayout.Width(32));
            EditorGUILayout.Space();
            EditorGUILayout.ToggleLeft("Track project Settings", false);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            EditorGUILayout.ColorField(Color.white, GUILayout.Width(32));
            EditorGUILayout.Space();
            EditorGUILayout.ToggleLeft("Track AssetStore assets", false);
            EditorGUILayout.EndHorizontal();
            GUI.enabled = true;
#endif
            EditorGUILayout.Space();
            if (GUILayout.Button("Help / F.A.Q.")) Application.OpenURL(" http://www.wasabimole.com/inspector-navigator");
            if (GUILayout.Button("Visit website")) Application.OpenURL("http://wasabimole.com");
            EditorGUILayout.Space();
            if (logo == null)
            {
                logo = new Texture2D(1, 1, TextureFormat.ARGB32, false);
                logo.LoadImage(System.Convert.FromBase64String(dataLogo));
                logo.Apply();
                logo.hideFlags = HideFlags.HideAndDontSave;
            }
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(logo, "Label")) Application.OpenURL("http://wasabimole.com");
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.LabelField(" Inspector Navigator - © 2014, 2015 Wasabimole");
        }
Пример #3
0
 public static void OpenWindow()
 {
     var ins = GetWindow<InspectorNavigator>("Insp.Navigator", false, new System.Type[] { GetInspectorWindowType() });
     ins.minSize = new Vector2(84, 20);
     if (ins != null) _instance = ins;
 }