Exemple #1
0
        void DrawPostProcessingModelButton(string label, string name, PostProcessingModelFake model, EditorWindow window, Rect rect)
        {
            // if ()
            if (model != null && model.enabled)
            {
                EditorGUI.DrawRect(rect, new Color(0.33f, 0.6f, 0.8f, 0.4f));
            }
            EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link);
            if (GUI.Button(rect, Params.CONTENT(label, "enable/disable " + label.Replace('\n', ' ')), Params.Button))
            {
                Undo.RecordObject(profile, "enable/disable " + label);

                if (model == null)
                {
                    AddModel(name, profile).enabled = true;
                }
                else
                {
                    model.enabled = !model.enabled;
                }

                EditorUtility.SetDirty(profile);

                Params.RepaintImages();
            }
        } //! TOP FAST BUTTIONS
 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 
 void DrawPostProcessingModelButton(string name, PostProcessingModelFake model, EditorWindow window, Rect rect)
 {
     if (model.enabled)
     {
         EditorGUI.DrawRect(rect, new Color(0.33f, 0.6f, 0.8f, 0.4f));
     }
     EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link);
     if (Params.TransparentButton(rect, Params.CONTENT(name, "enable/disable " + name.Replace('\n', ' '))))
     {
         Undo.RecordObject(profile, "enable/disable " + name);
         model.enabled = !model.enabled;
         EditorUtility.SetDirty(profile);
         Params.RepaintImages();
     }
 } //! TOP FAST BUTTIONS
Exemple #4
0
        void DrawPostProcessingModelButton(string name, PostProcessingModelFake model, EditorWindow window, float leftWidth)
        {
            var rect = EditorGUILayout.GetControlRect(GUILayout.Width(Math.Min((window.position.width - leftWidth - 10 - 40) / 7, 100)), GUILayout.Height(40));

            if (model.enabled)
            {
                EditorGUI.DrawRect(rect, new Color(0.33f, 0.6f, 0.8f, 0.4f));
            }
            EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link);
            if (GUI.Button(rect, Params.CONTENT(name, "enable/disable " + name.Replace('\n', ' ')), Params.Button))
            {
                Undo.RecordObject(profile, "enable/disable " + name);
                model.enabled = !model.enabled;
                EditorUtility.SetDirty(profile);
                window.Repaint();
            }
        } //! TOP FAST BUTTIONS
Exemple #5
0
        void DrawPostProcessingModelButton(string label, string field, EditorWindow window, Rect rect, int offset)
        {
            var currentComponent = (MonoBehaviour)((ISupportedPostComponent)this).MonoComponent;
            var enable           = (bool)Params.GetFieldValue(field, currentComponent, ((ISupportedPostComponent)this).MonoComponentType);

            if (enable)
            {
                EditorGUI.DrawRect(rect, new Color(0.33f, 0.6f, 0.8f, 0.4f));
            }
            EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link);
            if (GUI.Button(rect, Params.CONTENT(label, "enable/disable " + label.Replace('\n', ' ')), Params.Button))
            {
                Undo.RecordObject(currentComponent, "enable/disable");
                Params.SetFieldValue(field, currentComponent, !enable, ((ISupportedPostComponent)this).MonoComponentType);
                EditorUtility.SetDirty(currentComponent);
                Params.RepaintImages();
            }
        } //! TOP FAST BUTTIONS
Exemple #6
0
        void DrawPostProcessingModelButton(string name, EditorWindow window, Rect rect, int offset)
        {
            var currentComponent = (MonoBehaviour)((ISupportedPostComponent)this).MonoComponent;
            var enable           = ((int)(float)Type.GetValue(currentComponent, null) & (1 << offset)) != 0;

            if (enable)
            {
                EditorGUI.DrawRect(rect, new Color(0.33f, 0.6f, 0.8f, 0.4f));
            }
            EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link);
            if (Params.TransparentButton(rect, Params.CONTENT(name, "enable/disable " + name.Replace('\n', ' '))))
            {
                var newType = (int)Type.GetValue(currentComponent, null) & ~(1 << offset);
                if (!enable)
                {
                    newType |= 1 << offset;
                }
                EditorUtility.SetDirty(currentComponent);
                Params.RepaintImages();
            }
        } //! TOP FAST BUTTIONS
Exemple #7
0
        void ISupportedPostComponent.LeftSideGUI(EditorWindow window, float width)
        {
            var currentComponent = (MonoBehaviour)((ISupportedPostComponent)this).MonoComponent;

            //profile = currentComponent.profile;
            //profile = Params.GetPropertyValue( "profile", currentComponent ) as ScriptableObject;
            profile = Params.GetFieldValue(PROFILEFIELD, currentComponent) as ScriptableObject;

            var changedProfile = EditorGUILayout.ObjectField(profile, PostProcessingProfileType, false) as ScriptableObject;

            if (changedProfile != profile)
            {
                Undo.RecordObject(currentComponent, "Change PostProcessing Profile");
                //profile = Params.SetPropertyValue( "profile", currentComponent, changedProfile ) as ScriptableObject;
                SET_PROFILE(currentComponent, changedProfile);
                SetLast(changedProfile);
                EditorUtility.SetDirty(currentComponent);
                EditorUtility.SetDirty(Camera.main.gameObject);
            }

            /*  GUILayout.BeginHorizontal( GUILayout.Width( width ) );
             * for (int i = 0 ; i < LastList.Count ; i++) {
             *  if (!LastList[i]) continue;
             *  var al = Params.Button.alignment;
             *  Params.Button.alignment = TextAnchor.MiddleLeft;
             *  var result = GUILayout.Button( Params.CONTENT(LastList[i].name, "Set " + LastList[i].name) , Params.Button, GUILayout.Width( width / LastList.Count ), GUILayout.Height( 14 ) );
             *  Params.Button.alignment = al;
             *  if (result) {
             *    Undo.RecordObject( currentComponent, "Change PostProcessing Profile" );
             *    // Params.SetPropertyValue( "profile", currentComponent, LastList[i] );
             *    SET_PROFILE( currentComponent, LastList[i] );
             *    EditorUtility.SetDirty( currentComponent );
             *    EditorUtility.SetDirty( Camera.main.gameObject );
             *  }
             *  EditorGUIUtility.AddCursorRect( GUILayoutUtility.GetLastRect(), MouseCursor.Link );
             *
             * }
             * GUILayout.EndHorizontal();*/

            //GUILayout.Space( 10 );
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(Params.CONTENT("Default Profile", "Set Default Profile")))
            {
                SET_DEFAULTPROFILE(currentComponent);
            }
            GUI.enabled = profile;
            if (GUILayout.Button(Params.CONTENT("New Copy", "Create and set a copy of current profile")))
            {
                var json       = EditorJsonUtility.ToJson(profile);
                var path       = AssetDatabase.GenerateUniqueAssetPath("Assets/NewCameraProfile.asset");
                var newProfile = CreateProfile(path);
                EditorJsonUtility.FromJsonOverwrite(json, newProfile);
                EditorUtility.SetDirty(newProfile);
                AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
                Undo.RecordObject(currentComponent, "Change PostProcessing Profile");
                //Params.SetPropertyValue( "profile", currentComponent, newProfile );
                SET_PROFILE(currentComponent, newProfile);
                SetLast(newProfile);
                EditorUtility.SetDirty(currentComponent);
                EditorUtility.SetDirty(Camera.main.gameObject);
            }
            GUI.enabled = true;


            GUILayout.EndHorizontal();

            if (!profile)
            {
                return;
            }

            //ModelType = GetField( "fog", profile ).FieldType.BaseType;
            if (!((ISupportedPostComponent)this).LutEffectExist)
            {
                GUILayout.Label("LUT texture disabled", Params.Label);
                if (GUILayout.Button("enable LUT texture", GUILayout.Height(200)))
                {
                    Undo.RecordObject(Camera.main.gameObject, "enable LUT texture");
                    ((ISupportedPostComponent)this).LutEffectExist = true;
                    EditorUtility.SetDirty(Camera.main.gameObject);
                }
                //return;
            }

            if (!p_to_e.ContainsKey(profile))
            {
                p_to_e.Add(profile, Editor.CreateEditor(profile));
            }
            var e = p_to_e[profile];

            if (!e)
            {
                GUILayout.Label("Internal Plugin Error", Params.Label);
                return;
            }



            GUILayout.Space(10);
            if (GUILayout.Button("Refresh Overrides"))
            {
                ResetEditor();
            }

            Params.scroll.x = Params.scrollX;
            Params.scroll.y = Params.scrollY;
            Params.scroll   = GUILayout.BeginScrollView(Params.scroll, alwaysShowVertical: true, alwaysShowHorizontal: false);
            Params.scrollX.Set(Params.scroll.x);
            Params.scrollY.Set(Params.scroll.y);
            try {
                e.OnInspectorGUI();
            } catch {
                ResetEditor();
            }

            GUILayout.EndScrollView();
        } //! POSTPROCESSING COMPONENT GUI
Exemple #8
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];
        ////////////////////////////
        //! POSTPROCESSING COMPONENT GUI *** //

        void ISupportedPostComponent.LeftSideGUI(EditorWindow window, float width)
        {
            var currentComponent = (MonoBehaviour)((ISupportedPostComponent)this).MonoComponent;
            //profile = currentComponent.profile;
            //   profile = GetFieldValue( "profile", currentComponent ) as ScriptableObject;

            var changedProfile = EditorGUILayout.ObjectField(profile, PostProcessingProfileType, false) as ScriptableObject;

            if (changedProfile != profile)
            {
                Undo.RecordObject(currentComponent, "Change PostProcessing Profile");
                //profile = SetFieldValue( "profile", currentComponent, changedProfile ) as ScriptableObject;
                SetLast(changedProfile);
                m_profile = changedProfile;
                EditorUtility.SetDirty(currentComponent);
                EditorUtility.SetDirty(Camera.main.gameObject);
            }

            GUILayout.BeginHorizontal(GUILayout.Width(width));
            for (int i = 0; i < LastList.Count; i++)
            {
                if (!LastList[i])
                {
                    continue;
                }
                var al = Params.Button.alignment;
                Params.Button.alignment = TextAnchor.MiddleLeft;
                var result = GUILayout.Button(Params.CONTENT(LastList[i].name, "Set " + LastList[i].name), Params.Button, GUILayout.Width(width / LastList.Count), GUILayout.Height(14));
                Params.Button.alignment = al;
                if (result)
                {
                    Undo.RecordObject(currentComponent, "Change PostProcessing Profile");
                    m_profile = SetFieldValue("profile", currentComponent, LastList[i]) as ScriptableObject;
                    EditorUtility.SetDirty(currentComponent);
                    EditorUtility.SetDirty(Camera.main.gameObject);
                }
                EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
            }
            GUILayout.EndHorizontal();

            //GUILayout.Space( 10 );
            GUILayout.BeginHorizontal(GUILayout.Width(width));
            if (GUILayout.Button(Params.CONTENT("Default Profile", "Set Default Profile")))
            {
                var defaultProfile = AssetDatabase.LoadAssetAtPath(Params.EditorResourcesPath + "/CameraProfile Unity PostProcessing 1.0.asset", PostProcessingProfileType) as ScriptableObject;
                if (!defaultProfile)
                {
                    defaultProfile = CreateProfile(Params.EditorResourcesPath + "/CameraProfile Unity PostProcessing 1.0.asset");
                }
                Undo.RecordObject(currentComponent, "Change PostProcessing Profile");
                m_profile = SetFieldValue("profile", currentComponent, defaultProfile) as ScriptableObject;
                SetLast(defaultProfile);
                EditorUtility.SetDirty(currentComponent);
                EditorUtility.SetDirty(Camera.main.gameObject);
            }
            GUI.enabled = profile;
            if (GUILayout.Button(Params.CONTENT("New Copy", "Create and set a copy of current profile")))
            {
                var json       = EditorJsonUtility.ToJson(profile);
                var newProfile = CreateProfile(AssetDatabase.GenerateUniqueAssetPath("Assets/NewCameraProfile.asset"));
                EditorJsonUtility.FromJsonOverwrite(json, newProfile);
                EditorUtility.SetDirty(newProfile);
                Undo.RecordObject(currentComponent, "Change PostProcessing Profile");
                m_profile = SetFieldValue("profile", currentComponent, newProfile) as ScriptableObject;
                SetLast(newProfile);
                EditorUtility.SetDirty(currentComponent);
                EditorUtility.SetDirty(Camera.main.gameObject);
            }
            GUI.enabled = true;


            GUILayout.EndHorizontal();

            if (!profile)
            {
                return;
            }

            //ModelType = GetField( "fog", profile ).FieldType.BaseType;

            if (!p_to_e.ContainsKey(profile))
            {
                p_to_e.Add(profile, Editor.CreateEditor(profile));
            }
            var e = p_to_e[profile];

            if (!e)
            {
                GUILayout.Label("Internal Plugin Error", Params.Label);
                return;
            }



            GUILayout.Space(10);

            Params.scroll.x = Params.scrollX;
            Params.scroll.y = Params.scrollY;
            Params.scroll   = GUILayout.BeginScrollView(Params.scroll, alwaysShowVertical: true, alwaysShowHorizontal: false);
            Params.scrollX.Set(Params.scroll.x);
            Params.scrollY.Set(Params.scroll.y);
            e.OnInspectorGUI();
            GUILayout.EndScrollView();
        } //! POSTPROCESSING COMPONENT GUI