}//!DrawPresets


    bool DrawCell(Rect rect, Texture2D tex, string name, bool selected, ISupportedPostComponent component)
    {
      rect = Params.Shrink( rect, 2 );
      if (Event.current.type == EventType.Repaint) GUI.skin.window.Draw( rect, new GUIContent(), 0 );
      rect = Params.Shrink( rect, 2 );

      if (selected) EditorGUI.DrawRect( rect, Color.red );

      var tr = rect;
      var lr = tr;
      tr.height -= 16;
      tr = Params.Shrink( tr, 2 );
      if (tex) GUI.DrawTexture( tr, tex );
      else GUI.DrawTexture( tr, Texture2D.blackTexture );

      lr.y += lr.height -= 16;
      lr.height = 16;
      GUI.Label( lr, name );

      if (selected)
      {
        lr.width /= 2;
        lr.x += lr.width;
        lr.width -= 10;
        var newAmount = GUI.HorizontalSlider( lr, component.LutAmount,  0,1);
        if (newAmount != component.LutAmount)
        {
          component.CREATE_UNDO( "set post blend" );
          component.LutAmount = newAmount;
          component.SET_DIRTY();
          SceneView.RepaintAll();
        }
      }

#if !P128
      var favcontains = favorites.ContainsKey( name );
      var fav_r = rect;
      var SIZE = Math.Min(32,fav_r.height* 0.3f);
      fav_r.x += fav_r.width - SIZE - 5;
      fav_r.y += 5;
      fav_r.width = fav_r.height = SIZE;
      if (favcontains || selected || Event.current.control)
      {
        GUI.DrawTexture( fav_r, favorites.ContainsKey( name ) ? favicon_enable : favicon_disable );
        EditorGUIUtility.AddCursorRect( fav_r, MouseCursor.Link );
        if (GUI.Button( fav_r, favContent, Params.Button ))
        {
          if (favcontains) RemoveFavorite( name );
          else CreateFavorite( name );
        }
      }
#endif



      //  if (selected) GUI.DrawTexture( rect, Button.active.background );

      return GUI.Button( rect, "", Params.Button );
    }
示例#2
0
        void DrawPresets(ISupportedPostComponent component)
        {
            var zoom          = (int)Mathf.Clamp(Params.zoomFactor + 1, 1, 3);
            int cellHeight    = (int)((125 + 16) / ((zoom - 1) / 2f + 1));
            int CAPTUREHeight = (int)((125) / ((zoom - 1) / 2f + 1));
            var WIN_HEIGHT    = position.height - (40 + 20 + 24 + 20);


            var sortNotInverse = ((int)Params.sortInverse & (1 << (int)Params.sortMode)) == 0;
            var targetArray    = default_gradients;

            switch ((int)Params.sortMode)
            {
            case 0: targetArray = sortNotInverse ? default_gradients : inverse_default_gradients; break;

            case 1: targetArray = sortNotInverse ? bright_gradients : inverse_bright_gradients; break;

            case 2: targetArray = sortNotInverse ? hue_gradients : inverse_hue_gradients; break;

            case 3: targetArray = sortNotInverse ? compareToFirst_gradients : inverse_compareToFirst_gradients; break;
            }//sort type

            var l                   = component.LutTexture;
            int selectIndex         = -1;
            int filteredSelectIndex = -1;
            var __i                 = -1;
            var __M                 = -1;

            for (__i = 0; __i < targetArray.Count; __i++)
            {
                if (!SeartchValidate(targetArray[__i].name))
                {
                    continue;
                }
                if (Params.showFav == 1 && !favorites.ContainsKey(targetArray[__i].name))
                {
                    continue;
                }
                __M++;
                if (selectIndex == -1 && l == targetArray[__i].gradientTexture)
                {
                    filteredSelectIndex = __M;
                    selectIndex         = __i;
                }
            }

            // var XXX = Math.Min(3 * zoom, Math.Max(1, M + 1));
            var XXX            = 3 * zoom;
            int displaingCount = Mathf.CeilToInt(WIN_HEIGHT / cellHeight + 1) * XXX;

            var scrollX = Params.presetScrollX;
            var scrollY = Params.presetScrollY;

            if (Params.showFav == 1)
            {
                scrollX = Params.favScrollX;
                scrollY = Params.favScrollY;
            }

            if (mayResetScroll)
            {
                mayResetScroll = false;
                if (filteredSelectIndex != -1)
                {
                    var fixedcellHeight = cellHeight;
                    //(float)Params.presetScrollY + " " + filteredSelectIndex / XXX * cellHeight + " " + WIN_HEIGHT + " " + (filteredSelectIndex / XXX * cellHeight +
                    //Debug.Log( fixedcellHeight > Params.presetScrollY + WIN_HEIGHT );
                    if (filteredSelectIndex / XXX * fixedcellHeight < scrollY)
                    {
                        scrollY.Set(filteredSelectIndex / XXX * fixedcellHeight);
                    }
                    else if (filteredSelectIndex / XXX * fixedcellHeight + fixedcellHeight > scrollY + WIN_HEIGHT)
                    {
                        scrollY.Set(filteredSelectIndex / XXX * fixedcellHeight + fixedcellHeight - WIN_HEIGHT);
                    }
                }
            }//frame scroll


            Params.scroll.x = scrollX;
            Params.scroll.y = scrollY;
            Params.scroll   = GUILayout.BeginScrollView(Params.scroll);
            scrollX.Set(Params.scroll.x);
            scrollY.Set(Params.scroll.y);



            GUILayout.BeginVertical();
            var  height           = Mathf.Ceil(gradients.Length / (float)XXX);
            int  wasRender        = 0;
            int  __FirstRenderInc = -1;
            bool needRepaint      = false;

            var newCheck = component.GetHashString();

            if (Params.AutoRefresh == 1 && !string.Equals(newCheck, oldCheck, StringComparison.Ordinal))
            {
                oldCheck = newCheck;
                ClearImages(false);
                currentWindow.Repaint();
            }//refrest if changed



            __i = -1;
            Rect line          = new Rect();
            bool renderTexture = false;
            bool newLine       = false;

            if (__M == -1)
            {
                if (Params.showFav == 1)
                {
                    GUILayout.Label("No Favorite Elements", Params.Label);
                }
                else
                {
                    GUILayout.Label("No elements '" + (string)Params.filtres + "' found", Params.Label);
                }
            }
            else
            {
                line        = EditorGUILayout.GetControlRect(GUILayout.Height((__M / XXX + 1) * cellHeight));
                line.height = cellHeight;
                line.y     -= line.height;
                int __renderInc = -1;

                for (int y = 0; y < height; y++)
                {
                    newLine = true;


                    for (int x = 0; x < XXX; x++)
                    {
                        __i++;
                        //var i = x + y * XXX;
                        if (__i >= targetArray.Count)
                        {
                            break;
                        }

                        if (!SeartchValidate(targetArray[__i].name))
                        {
                            x--;
                            continue;
                        }
                        if (Params.showFav == 1 && !favorites.ContainsKey(targetArray[__i].name))
                        {
                            x--;
                            continue;
                        }

                        if (newLine)
                        {
                            newLine = false;
                            //line = EditorGUILayout.GetControlRect( GUILayout.Height( cellHeight ) );
                            line.y       += line.height;
                            renderTexture = line.y + line.height >= Params.scroll.y && line.y - line.height <= Params.scroll.y + WIN_HEIGHT;
                        }



                        var rect = line;
                        rect.width = line.width / XXX;
                        rect.x     = rect.width * x;

                        if (!renderTexture)
                        {
                            continue;
                        }
                        __renderInc++;

                        if (__FirstRenderInc == -1)
                        {
                            __FirstRenderInc = __renderInc;
                        }

                        if (renderedScreen.Length != targetArray.Count)
                        {
                            System.Array.Resize(ref renderedScreen, targetArray.Count);
                            ClearImages(false);
                            currentWindow.Repaint();
                        }

                        if (renderedIndex < __FirstRenderInc)
                        {
                            renderedIndex = __FirstRenderInc;
                        }

                        /* if (Params.showFav == 1)
                         * Debug.Log( (wasRender < (Params.zoomFactor + 1) * IMAGE_RENDER_PER_FRAME) + " " + (renderedIndex % displaingCount) + " " + __renderInc + " " + __FirstRenderInc );*/

                        if (wasRender < (Params.zoomFactor + 1) * IMAGE_RENDER_PER_FRAME && renderedIndex % displaingCount == (__renderInc - __FirstRenderInc))
                        {
                            if ((int)rect.width - 10 > 0 && !renderedDoubleCheck[__i])
                            {
                                renderedIndex++;

                                component.CameraPredrawAction(); // PRE

                                //memory
                                var oldLutEnable  = component.LutEnable;
                                var oldLutTexture = component.LutTexture;
                                var oldAmount     = component.LutAmount;
                                //change
                                component.LutEnable  = true;
                                component.LutTexture = (targetArray[__i]).gradientTexture;
                                component.LutAmount  = (1);

                                var oldAnti = component.AntiAliasEnable;
                                component.AntiAliasEnable = false;
                                //draw
                                if (renderedScreen[__i])
                                {
                                    DestroyImmediate(renderedScreen[__i], true);
                                }
                                renderedDoubleCheck[__i]  = renderedScreen[__i] = TakeScreen(Camera.main, (int)rect.width - 10, CAPTUREHeight);
                                component.AntiAliasEnable = oldAnti;

                                //restore
                                component.LutEnable  = oldLutEnable;
                                component.LutTexture = (oldLutTexture);
                                component.LutAmount  = (oldAmount);

                                component.CameraPostDrawAction(); // POST

                                wasRender++;
                            }
                        }

                        var screen = renderedScreen[__i];

                        if (!renderedDoubleCheck[__i])
                        {
                            needRepaint = true;
                        }

                        if (DrawCell(rect, screen, targetArray[__i].name, selectIndex == __i, component))
                        {
                            WasElementsChanged = true;
                            component.CREATE_UNDO("set " + targetArray[__i].name);
                            component.LutTexture = (targetArray[__i].gradientTexture);
                            if (!component.LutEnable)
                            {
                                component.LutAmount = (1);
                            }
                            component.LutEnable = true;
                            component.SET_DIRTY();
                            UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
                        }
                    }
                }
            }


            GUILayout.EndVertical();


            if (wasRender < (Params.zoomFactor + 1) * IMAGE_RENDER_PER_FRAME)
            {
                // renderedIndex = firstI;
                renderedIndex += (int)(Params.zoomFactor + 1) * IMAGE_RENDER_PER_FRAME - wasRender;
                //needRepaint = true;
            }
            if (needRepaint)
            {
                Repaint();
            }
            GUILayout.EndScrollView();
        }//!DrawPresets
示例#3
0
        void OnGUI()
        {
            if (!SceneManager.GetActiveScene().IsValid())
            {
                return;
            }

            if (!currentWindow)
            {
                currentWindow = Resources.FindObjectsOfTypeAll(Params.WindowType).FirstOrDefault() as EditorWindow;
                if (currentWindow)
                {
                    ResetWindow();
                }
            }
            if (!currentWindow)
            {
                return;
            }

            if (SceneManager.GetActiveScene().GetHashCode() != EditorPrefs.GetInt("EModules/" + Params.TITLE + "/Scene", -1))
            {
                ResetWindow();
            }

            if (Params.Label == null)
            {
                Params.Label           = new GUIStyle(GUI.skin.label);
                Params.Label.fontSize  = 14;
                Params.Label.fontStyle = FontStyle.Bold;

                Params.Button = new GUIStyle(GUI.skin.button);
                // Button.fontSize = 14;
                var t = new Texture2D(1, 1, TextureFormat.ARGB32, false, true);
                t.hideFlags = HideFlags.DontSave;
                t.SetPixel(0, 0, new Color(0, 0.1f, 0.4f, 0.3f));
                t.Apply();
                Params.Button.normal.background  = null;
                Params.Button.hover.background   = null;
                Params.Button.focused.background = null;
                Params.Button.active.background  = t;
            }


            if (!Camera.main)
            {
                GUILayout.Label("No Camera", Params.Label);
                return;
            }

            ISupportedPostComponent currentComponent = null;
            MonoBehaviour           c1 = null;
            MonoBehaviour           c2 = null;

            if (Params.PostProcessingBehaviourType != null)
            {
                c1 = Camera.main.GetComponent(Params.PostProcessingBehaviourType) as MonoBehaviour;
            }
            if (Params.AmplifyBaseType != null)
            {
                c2 = Camera.main.GetComponent(Params.AmplifyBaseType) as MonoBehaviour;
            }

            if (c1 && c1.enabled)
            {
                currentComponent = postPresets_UnityPostGUI;
            }
            else if (c2 && c2.enabled)
            {
                currentComponent = postPresets_AmplifyPostGUI;
            }
            else if (c1)
            {
                currentComponent = postPresets_UnityPostGUI;
            }
            else if (c2)
            {
                currentComponent = postPresets_AmplifyPostGUI;
            }
            else if (Params.PostProcessingBehaviourType != null)
            {
                currentComponent = postPresets_UnityPostGUI;
            }
            else if (Params.AmplifyBaseType != null)
            {
                currentComponent = postPresets_AmplifyPostGUI;
            }


            if (currentComponent == null)
            {
                GUILayout.Label("Unity PostProcessing or AmplifyColor not imported", Params.Label);
                if (GUILayout.Button("Download Unity 'Post Processing Stack'", GUILayout.Height(40)))
                {
                    Application.OpenURL("https://www.assetstore.unity3d.com/#!/content/83912");
                }
                if (GUILayout.Button("Download 'Amplify Color'", GUILayout.Height(40)))
                {
                    Application.OpenURL(" https://www.assetstore.unity3d.com/en/#!/content/1894");
                }
                return;
            }


            // Left column ////
            GUILayout.BeginHorizontal();
            var leftwidth = Mathf.Clamp(position.width / 3f, 200, 350);

            GUILayout.BeginVertical(GUILayout.Width(leftwidth));
            GUILayout.Label("Camera: " + Camera.main.name, Params.Label);
            if (GUI.Button(GUILayoutUtility.GetLastRect(), "", Params.Button))
            {
                Selection.objects = new[] { Camera.main.gameObject }
            }
            ;
            EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);


            if (currentComponent.MonoComponent == null)
            {
                if (GUILayout.Button("Add " + currentComponent.MonoComponentType + " Script", GUILayout.Height(200)))
                {
                    Undo.RecordObject(Camera.main.gameObject, "Add " + currentComponent.MonoComponentType + " Script");
                    Camera.main.gameObject.AddComponent(currentComponent.MonoComponentType);
                    EditorUtility.SetDirty(Camera.main.gameObject);
                }
                return;
            }

            if (!currentComponent.MonoComponent.enabled)
            {
                GUILayout.Label(currentComponent.MonoComponent.GetType().Name + " Component Disabled", Params.Label);
                if (GUILayout.Button("Enable " + currentComponent.MonoComponent.GetType().Name + " Component", GUILayout.Height(200)))
                {
                    Undo.RecordObject(currentComponent.MonoComponent, "Enable " + currentComponent.MonoComponent.GetType().Name + " Component");
                    currentComponent.MonoComponent.enabled = true;
                    EditorUtility.SetDirty(currentComponent.MonoComponent);
                    UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
                }
                return;
            }

            if (widthCheck == null)
            {
                widthCheck = position.width;
            }
            if (widthCheck.Value != position.width)
            {
                widthCheck = position.width;
                ClearImages(false);
                currentWindow.Repaint();
            }

            //! *** POSTPROCESSING COMPONENT GUI *** //
            currentComponent.LeftSideGUI(this, leftwidth);
            //! *** POSTPROCESSING COMPONENT GUI *** //

            if (GUILayout.Button("http://emodules.me/", Params.Button))
            {
                Application.OpenURL("http://emodules.me/");
            }
            EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);

            GUILayout.EndVertical();
            // Left column

            GUILayout.Space(10);

            leftwidth += 20;

            //! PRESETS GRID GUI
            if (currentComponent.IsValid)
            {
                GUILayout.BeginVertical();
                ////////////////////////
                currentComponent.TopFastButtonsGUI(this, leftwidth);
                ////////////////////////
                FiltresAndSorting(this, leftwidth);
                ////////////////////////
                DrawPresets(currentComponent);
                ////////////////////////
                GUILayout.EndVertical();
            }
            //! PRESETS GRID GUI

            GUILayout.EndHorizontal();
        }//!OnGUI

        void FiltresAndSorting(EditorWindow window, float leftWidth)
        {
#if !P128
            GUI.enabled = true;
#else
            GUI.enabled = false;
#endif

            // FILTRES
            //var filtresCount = filtername_to_filterindex.Values.Max();

            /*for (int i = 0 ; i < filtresCount ; i++)
             * {
             * var filtMask = 1 << i;
             * var enable = ((int)Params.filtres & filtMask) != 0;
             * var captureI=i;
             * var name = filtername_to_filterindex.Where(f=>f.Value == captureI).Select(f=>f.Key).Aggregate((a,b)=>a+'\n' +b);
             * if (Button( GetRect( leftWidth, 40, window, 8 ), name, enable ))
             * {
             *  if (enable) Params.filtres.Set( ((int)Params.filtres & ~filtMask) );
             *  else Params.filtres.Set( ((int)Params.filtres | filtMask) );
             *  renderedDoubleCheck = new Texture2D[gradients.Length];
             *  window.Repaint();
             * }
             * }*/
            GUILayout.BeginHorizontal();
            var lineR = GetRect(leftWidth, 16, window, 1); //SPACE
            GUILayout.EndHorizontal();
            var seaR = lineR;
            seaR.width  *= 0.7f;
            lineR.x     += seaR.width + 40;
            lineR.width -= seaR.width + 40;
            var newFilter = EditorGUI.TextField(seaR, "Search: ", (string)Params.filtres);
            if (newFilter != Params.filtres)
            {
                Params.filtres.Set(newFilter);
                window.Repaint();
            }
            seaR.x    += seaR.width;
            seaR.width = 20;
            if (GUI.Button(seaR, "X"))
            {
                Params.filtres.Set("");
                EditorGUI.FocusTextInControl(null);
                ClearImages(true);
                window.Repaint();
            }
            EditorGUIUtility.AddCursorRect(lineR, MouseCursor.Link);
            if (GUI.Button(lineR, "Show Favorites", Params.Button))
            {
                Params.showFav.Set(1 - Params.showFav);
                ClearImages(true);
                if (Params.showFav == 0)
                {
                    mayResetScroll = WasElementsChanged;
                }
                WasElementsChanged = false;
                window.Repaint();
            }
            if (Params.showFav == 1)
            {
                EditorGUI.DrawRect(lineR, new Color(0.8f, 0.6f, 0.33f, 0.4f));
            }
            lineR.x    += lineR.width;
            lineR.width = 16;
#if !P128
            GUI.DrawTexture(lineR, favicon_enable);
#endif
            // FILTRES


            // SORTING
            GUILayout.BeginHorizontal();
            var D = 8;
            var r = GetRect(leftWidth, 20, window, D);
            GUI.Label(r, "Sorting:");
            for (int i = 0; i < 4; i++)
            {
                var sortNotInverse = ((int)Params.sortInverse & (1 << i)) == 0;
                if (Button(GetRect(leftWidth, 20, window, D), sotrNames[i] + (Params.sortMode == i ? (sortNotInverse ? "▼" : "▲") : ""), Params.sortMode == i, "Set Ordering Method"))
                {
                    if (Params.sortMode == i)
                    {
                        if (!sortNotInverse)
                        {
                            Params.sortInverse.Set(((int)Params.sortInverse & ~(1 << i)));
                        }
                        else
                        {
                            Params.sortInverse.Set(((int)Params.sortInverse | (1 << i)));
                        }
                    }
                    else
                    {
                        Params.sortMode.Set((float)i);
                    }
                    ClearImages(true);
                    window.Repaint();
                }
            }

            GUI.enabled = true;

            GetRect(leftWidth, 20, window, D); //SPACE
            GUI.Label(GetRect(leftWidth, 20, window, D), "Zoom:");

            var ZoomRect = GetRect(leftWidth, 20, window, D);
            ZoomRect.width /= 3;
            for (int i = 0; i < 3; i++)
            {
                if (Button(ZoomRect, "x" + (i + 1) * 3, Params.zoomFactor == i, "Set Zooming Factor"))
                {
                    Params.zoomFactor.Set(i);
                    ClearImages(true);
                    window.Repaint();
                }
                ZoomRect.x += ZoomRect.width;
            }
            GUILayout.EndHorizontal();
            // SORTING
        }//!FiltresAndSorting

        Rect GetRect(float leftWidth, float height, EditorWindow window, int divider)
        {
            return(EditorGUILayout.GetControlRect(GUILayout.Width(Math.Min((window.position.width - leftWidth - 10 - 40) / divider, 700 / divider)), GUILayout.Height(height)));
        }

        bool Button(Rect rect, string name, bool enable, string helpTExt = null)
        {
            if (enable)
            {
                EditorGUI.DrawRect(rect, new Color(0.33f, 0.6f, 0.8f, 0.4f));
            }
            EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link);
            var content = Params.CONTENT(name, helpTExt ?? "enable/disable " + name.Replace('\n', ' '));
            var result  = (GUI.Button(rect, content));

            //if (enable) EditorGUI.DrawRect( rect, new Color( 0.33f, 0.6f, 0.8f, 0.4f ) );
            if (Event.current.type == EventType.Repaint && enable)
            {
                GUI.skin.button.Draw(rect, content, true, true, true, true);
            }
            if (enable)
            {
                EditorGUI.DrawRect(rect, new Color(0.33f, 0.6f, 0.8f, 0.4f));
            }
            return(result);
        } //! TOP FAST BUTTIONS

        float?widthCheck;

        Texture2D[] renderedDoubleCheck = new Texture2D[0];
        Texture2D[] renderedScreen      = new Texture2D[0];
    void OnGUI()
    {
      if (!SceneManager.GetActiveScene().IsValid()) return;

      if (!currentWindow)
      {
        currentWindow = Resources.FindObjectsOfTypeAll( Params.WindowType ).FirstOrDefault() as EditorWindow;
        if (currentWindow) ResetWindow();
      }
      if (!currentWindow) return;

      if (SceneManager.GetActiveScene().GetHashCode() != EditorPrefs.GetInt( "EModules/" + Params.TITLE + "/Scene", -1 )) ResetWindow();

      if (Params.Label == null)
      {
        Params.Label = new GUIStyle( GUI.skin.label );
        Params.Label.fontSize = 14;
        Params.Label.fontStyle = FontStyle.Bold;

        Params.Button = new GUIStyle( GUI.skin.button );
        // Button.fontSize = 14;
        var t = new Texture2D(1,1,TextureFormat.ARGB32,false,true);
        t.hideFlags = HideFlags.DontSave;
        t.SetPixel( 0, 0, new Color( 0, 0.1f, 0.4f, 0.3f ) );
        t.Apply();
        Params.Button.normal.background = null;
        Params.Button.hover.background = null;
        Params.Button.focused.background = null;
        Params.Button.active.background = t;
      }


      if (!Camera.main)
      {
        GUILayout.Label( "No Camera", Params.Label );
        return;
      }

      ISupportedPostComponent currentComponent = null;
      MonoBehaviour c1 = null;
      MonoBehaviour c2 = null;
      if (Params.PostProcessingBehaviourType != null)
        c1 = Camera.main.GetComponent( Params.PostProcessingBehaviourType ) as MonoBehaviour;
      if (Params.AmplifyBaseType != null)
        c2 = Camera.main.GetComponent( Params.AmplifyBaseType ) as MonoBehaviour;

      if (c1 && c1.enabled) currentComponent = postPresets_UnityPostGUI;
      else if (c2 && c2.enabled) currentComponent = postPresets_AmplifyPostGUI;
      else if (c1) currentComponent = postPresets_UnityPostGUI;
      else if (c2) currentComponent = postPresets_AmplifyPostGUI;
      else if (Params.PostProcessingBehaviourType != null) currentComponent = postPresets_UnityPostGUI;
      else if (Params.AmplifyBaseType != null) currentComponent = postPresets_AmplifyPostGUI;


      if (currentComponent == null)
      {
        GUILayout.Label( "Unity PostProcessing or AmplifyColor not imported", Params.Label );
        if (GUILayout.Button( "Download Unity 'Post Processing Stack'", GUILayout.Height( 40 ) ))
        {
          Application.OpenURL( "https://www.assetstore.unity3d.com/#!/content/83912" );
        }
        if (GUILayout.Button( "Download 'Amplify Color'", GUILayout.Height( 40 ) ))
        {
          Application.OpenURL( " https://www.assetstore.unity3d.com/en/#!/content/1894" );
        }
        return;
      }


      // Left column ////
      GUILayout.BeginHorizontal();
      var leftwidth =  Mathf.Clamp( position.width / 3f, 200, 350 );

      GUILayout.BeginVertical( GUILayout.Width( leftwidth ) );
      GUILayout.Label( "Camera: " + Camera.main.name, Params.Label );
      if (GUI.Button( GUILayoutUtility.GetLastRect(), "", Params.Button )) Selection.objects = new[] { Camera.main.gameObject };
      EditorGUIUtility.AddCursorRect( GUILayoutUtility.GetLastRect(), MouseCursor.Link );


      if (currentComponent.MonoComponent == null)
      {
        if (GUILayout.Button( "Add " + currentComponent.MonoComponentType + " Script", GUILayout.Height( 200 ) ))
        {
          Undo.RecordObject( Camera.main.gameObject, "Add " + currentComponent.MonoComponentType + " Script" );
          Camera.main.gameObject.AddComponent( currentComponent.MonoComponentType );
          EditorUtility.SetDirty( Camera.main.gameObject );
        }
        return;
      }

      if (!currentComponent.MonoComponent.enabled)
      {
        GUILayout.Label( currentComponent.MonoComponent.GetType().Name + " Component Disabled", Params.Label );
        if (GUILayout.Button( "Enable " + currentComponent.MonoComponent.GetType().Name + " Component", GUILayout.Height( 200 ) ))
        {
          Undo.RecordObject( currentComponent.MonoComponent, "Enable " + currentComponent.MonoComponent.GetType().Name + " Component" );
          currentComponent.MonoComponent.enabled = true;
          EditorUtility.SetDirty( currentComponent.MonoComponent );
          UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
        }
        return;
      }

      if (widthCheck == null) widthCheck = position.width;
      if (widthCheck.Value != position.width)
      {
        widthCheck = position.width;
        ClearImages( false );
        currentWindow.Repaint();
      }

      //! *** POSTPROCESSING COMPONENT GUI *** //
      currentComponent.LeftSideGUI( this, leftwidth );
      //! *** POSTPROCESSING COMPONENT GUI *** //

      if (GUILayout.Button( "http://emodules.me/", Params.Button )) Application.OpenURL( "http://emodules.me/" );
      EditorGUIUtility.AddCursorRect( GUILayoutUtility.GetLastRect(), MouseCursor.Link );

      GUILayout.EndVertical();
      // Left column

      GUILayout.Space( 10 );

      leftwidth += 20;

      //! PRESETS GRID GUI
      if (currentComponent.IsValid)
      {
        GUILayout.BeginVertical();
        ////////////////////////
        currentComponent.TopFastButtonsGUI( this, leftwidth );
        ////////////////////////
        FiltresAndSorting( this, leftwidth );
        ////////////////////////
        DrawPresets( currentComponent );
        ////////////////////////
        GUILayout.EndVertical();
      }
      //! PRESETS GRID GUI

      GUILayout.EndHorizontal();



    }//!OnGUI