Inheritance: EditorWindow
コード例 #1
0
 public void OnDisable()
 {
     if (this.m_GradientLibraryEditorState != null)
     {
         this.m_GradientLibraryEditorState.TransferEditorPrefsState(false);
     }
     GradientPicker.s_GradientPicker = null;
 }
コード例 #2
0
 public static void Show(Gradient newGradient, bool hdr, Action <Gradient> onGradientChanged)
 {
     GradientPicker.PrepareShow(hdr);
     GradientPicker.s_GradientPicker.m_DelegateView = null;
     GradientPicker.s_GradientPicker.m_Delegate     = onGradientChanged;
     GradientPicker.s_GradientPicker.Init(newGradient, hdr);
     GradientPreviewCache.ClearCache();
 }
コード例 #3
0
        public void OnDisable()
        {
            //EditorApplication.playmodeStateChanged -= OnPlayModeStateChanged;
            if (m_GradientLibraryEditorState != null)
            {
                m_GradientLibraryEditorState.TransferEditorPrefsState(false);
            }

            s_GradientPicker = null;
        }
コード例 #4
0
        public static void Show(Gradient newGradient, bool hdr)
        {
            GUIView current = GUIView.current;

            GradientPicker.PrepareShow(hdr);
            GradientPicker.s_GradientPicker.m_DelegateView = current;
            GradientPicker.s_GradientPicker.m_Delegate     = null;
            GradientPicker.s_GradientPicker.Init(newGradient, hdr);
            GradientPreviewCache.ClearCache();
        }
コード例 #5
0
        private void PresetClickedCallback(int clickCount, object presetObject)
        {
            Gradient gradient = presetObject as Gradient;

            if (gradient == null)
            {
                Debug.LogError((object)("Incorrect object passed " + presetObject));
            }
            GradientPicker.SetCurrentGradient(gradient);
            this.gradientChanged = true;
        }
コード例 #6
0
ファイル: GradientPicker.cs プロジェクト: randomize/VimConfig
 public void OnDisable()
 {
     if (this.m_GradientLibraryEditorState != null)
     {
         this.m_GradientLibraryEditorState.TransferEditorPrefsState(false);
     }
     if (this.m_GradientEditor != null)
     {
         this.m_GradientEditor.Clear();
     }
     s_GradientPicker = null;
 }
コード例 #7
0
 static void PrepareShow(bool hdr)
 {
     if (s_GradientPicker == null)
     {
         string title = hdr ? "HDR Gradient Editor" : "Gradient Editor";
         s_GradientPicker = (GradientPicker)GetWindow(typeof(GradientPicker), true, title, false);
         Vector2 minSize = new Vector2(360, 224);
         Vector2 maxSize = new Vector2(1900, 3000);
         s_GradientPicker.minSize        = minSize;
         s_GradientPicker.maxSize        = maxSize;
         s_GradientPicker.wantsMouseMove = true;
         s_GradientPicker.ShowAuxWindow(); // Use this if auto close on lost focus is wanted.
     }
     else
     {
         s_GradientPicker.Repaint(); // Ensure we get a OnGUI so we refresh if new gradient
     }
 }
コード例 #8
0
 private static void PrepareShow(bool hdr)
 {
     if (GradientPicker.s_GradientPicker == null)
     {
         string title = (!hdr) ? "Gradient Editor" : "HDR Gradient Editor";
         GradientPicker.s_GradientPicker = (GradientPicker)EditorWindow.GetWindow(typeof(GradientPicker), true, title, false);
         Vector2 minSize = new Vector2(360f, 224f);
         Vector2 maxSize = new Vector2(1900f, 3000f);
         GradientPicker.s_GradientPicker.minSize        = minSize;
         GradientPicker.s_GradientPicker.maxSize        = maxSize;
         GradientPicker.s_GradientPicker.wantsMouseMove = true;
         GradientPicker.s_GradientPicker.ShowAuxWindow();
     }
     else
     {
         GradientPicker.s_GradientPicker.Repaint();
     }
 }
コード例 #9
0
 public static void Show(Gradient newGradient)
 {
   GUIView current = GUIView.current;
   if ((UnityEngine.Object) GradientPicker.s_GradientPicker == (UnityEngine.Object) null)
   {
     GradientPicker.s_GradientPicker = (GradientPicker) EditorWindow.GetWindow(typeof (GradientPicker), true, "Gradient Editor", false);
     Vector2 vector2_1 = new Vector2(360f, 224f);
     Vector2 vector2_2 = new Vector2(1900f, 3000f);
     GradientPicker.s_GradientPicker.minSize = vector2_1;
     GradientPicker.s_GradientPicker.maxSize = vector2_2;
     GradientPicker.s_GradientPicker.wantsMouseMove = true;
     GradientPicker.s_GradientPicker.ShowAuxWindow();
   }
   else
     GradientPicker.s_GradientPicker.Repaint();
   GradientPicker.s_GradientPicker.m_DelegateView = current;
   GradientPicker.s_GradientPicker.Init(newGradient);
 }
コード例 #10
0
        static void PrepareShow(bool hdr, ColorSpace colorSpace)
        {
            if (s_GradientPicker == null)
            {
                string title = hdr ? "HDR Gradient Editor" : "Gradient Editor";
                if (colorSpace == ColorSpace.Linear)
                {
                    title += " (linear)";
                }
                s_GradientPicker = (GradientPicker)GetWindow(typeof(GradientPicker), true, title, false);
                Vector2 minSize = new Vector2(360, 224);
                Vector2 maxSize = new Vector2(1900, 3000);
                s_GradientPicker.minSize        = minSize;
                s_GradientPicker.maxSize        = maxSize;
                s_GradientPicker.wantsMouseMove = true;
                Undo.undoRedoPerformed         += s_GradientPicker.OnUndoPerformed;
            }

            s_GradientPicker.ShowAuxWindow(); // Use this if auto close on lost focus is wanted.
        }
コード例 #11
0
        public static void Show(Gradient newGradient)
        {
            GUIView current = GUIView.current;

            if ((UnityEngine.Object)GradientPicker.s_GradientPicker == (UnityEngine.Object)null)
            {
                GradientPicker.s_GradientPicker = (GradientPicker)EditorWindow.GetWindow(typeof(GradientPicker), true, "Gradient Editor", false);
                Vector2 vector2_1 = new Vector2(360f, 224f);
                Vector2 vector2_2 = new Vector2(1900f, 3000f);
                GradientPicker.s_GradientPicker.minSize        = vector2_1;
                GradientPicker.s_GradientPicker.maxSize        = vector2_2;
                GradientPicker.s_GradientPicker.wantsMouseMove = true;
                GradientPicker.s_GradientPicker.ShowAuxWindow();
            }
            else
            {
                GradientPicker.s_GradientPicker.Repaint();
            }
            GradientPicker.s_GradientPicker.m_DelegateView = current;
            GradientPicker.s_GradientPicker.Init(newGradient);
        }
コード例 #12
0
        public static void Show(Gradient newGradient)
        {
            GUIView current = GUIView.current;

            if (s_GradientPicker == null)
            {
                s_GradientPicker = (GradientPicker)EditorWindow.GetWindow(typeof(GradientPicker), true, "Gradient Editor", false);
                Vector2 vector  = new Vector2(360f, 224f);
                Vector2 vector2 = new Vector2(1900f, 3000f);
                s_GradientPicker.minSize        = vector;
                s_GradientPicker.maxSize        = vector2;
                s_GradientPicker.wantsMouseMove = true;
                s_GradientPicker.ShowAuxWindow();
            }
            else
            {
                s_GradientPicker.Repaint();
            }
            s_GradientPicker.m_DelegateView = current;
            s_GradientPicker.Init(newGradient);
        }
コード例 #13
0
        public static void Show(Gradient newGradient)
        {
            GUIView current = GUIView.current;

            if (GradientPicker.s_GradientPicker == null)
            {
                GradientPicker.s_GradientPicker = (GradientPicker)EditorWindow.GetWindow(typeof(GradientPicker), true, "Gradient Editor", false);
                Vector2 minSize = new Vector2(360f, 224f);
                Vector2 maxSize = new Vector2(1900f, 3000f);
                GradientPicker.s_GradientPicker.minSize        = minSize;
                GradientPicker.s_GradientPicker.maxSize        = maxSize;
                GradientPicker.s_GradientPicker.wantsMouseMove = true;
                GradientPicker.s_GradientPicker.ShowAuxWindow();
            }
            else
            {
                GradientPicker.s_GradientPicker.Repaint();
            }
            GradientPicker.s_GradientPicker.m_DelegateView = current;
            GradientPicker.s_GradientPicker.Init(newGradient);
            GradientPreviewCache.ClearCache();
        }
コード例 #14
0
 private void OnEditButtonClicked(string libraryPath)
 {
     GradientPicker.Show(new Gradient(), true);
     GradientPicker.instance.currentPresetLibrary = libraryPath;
 }
コード例 #15
0
        internal static Gradient DoGradientField(Rect position, int id, Gradient value, SerializedProperty property, bool hdr)
        {
            Event evt = Event.current;

            switch (evt.GetTypeForControl(id))
            {
            case EventType.MouseDown:
                if (position.Contains(evt.mousePosition))
                {
                    if (evt.button == 0)
                    {
                        s_GradientID = id;
                        GUIUtility.keyboardControl = id;
                        Gradient gradient = property != null ? property.gradientValue : value;
                        GradientPicker.Show(gradient, hdr);
                        GUIUtility.ExitGUI();
                    }
                    else if (evt.button == 1)
                    {
                        if (property != null)
                        {
                            GradientContextMenu.Show(property.Copy());
                        }
                        // TODO: make work for Gradient value
                    }
                }
                break;

            case EventType.Repaint:
            {
                Rect r2 = new Rect(position.x + 1, position.y + 1, position.width - 2, position.height - 2);        // Adjust for box drawn on top
                if (property != null)
                {
                    GradientEditor.DrawGradientSwatch(r2, property, Color.white);
                }
                else
                {
                    GradientEditor.DrawGradientSwatch(r2, value, Color.white);
                }
                EditorStyles.colorPickerBox.Draw(position, GUIContent.none, id);
                break;
            }

            case EventType.ExecuteCommand:
                if (s_GradientID == id && evt.commandName == GradientPicker.GradientPickerChangedCommand)
                {
                    GUI.changed = true;
                    GradientPreviewCache.ClearCache();
                    HandleUtility.Repaint();
                    if (property != null)
                    {
                        property.gradientValue = GradientPicker.gradient;
                    }

                    return(GradientPicker.gradient);
                }
                break;

            case EventType.ValidateCommand:
                if (s_GradientID == id && evt.commandName == EventCommandNames.UndoRedoPerformed)
                {
                    if (property != null)
                    {
                        GradientPicker.SetCurrentGradient(property.gradientValue);
                    }
                    GradientPreviewCache.ClearCache();
                    return(value);
                }
                break;

            case EventType.KeyDown:
                if (GUIUtility.keyboardControl == id && (evt.keyCode == KeyCode.Space || evt.keyCode == KeyCode.Return || evt.keyCode == KeyCode.KeypadEnter))
                {
                    Event.current.Use();
                    Gradient gradient = property != null ? property.gradientValue : value;
                    GradientPicker.Show(gradient, hdr);
                    GUIUtility.ExitGUI();
                }
                break;
            }
            return(value);
        }
コード例 #16
0
ファイル: GradientPicker.cs プロジェクト: randomize/VimConfig
 public static void Show(Gradient newGradient)
 {
     GUIView current = GUIView.current;
     if (s_GradientPicker == null)
     {
         s_GradientPicker = (GradientPicker) EditorWindow.GetWindow(typeof(GradientPicker), true, "Gradient Editor", false);
         Vector2 vector = new Vector2(360f, 224f);
         Vector2 vector2 = new Vector2(1900f, 3000f);
         s_GradientPicker.minSize = vector;
         s_GradientPicker.maxSize = vector2;
         s_GradientPicker.wantsMouseMove = true;
         s_GradientPicker.ShowAuxWindow();
     }
     else
     {
         s_GradientPicker.Repaint();
     }
     s_GradientPicker.m_DelegateView = current;
     s_GradientPicker.Init(newGradient);
 }