예제 #1
0
    protected virtual void OnGUI()
    {
        if (!SetPivot && Selection.activeGameObject)
        {
            oldpos = Selection.activeGameObject.transform.position;
        }
        GUI.BeginHorizontal();
        SetPivot = (GUI.Toggle(SetPivot, "Pivot", GUI.ExpandWidth(false)) && Selection.activeGameObject != null);

        var old = SetCam;

        SetCam = (GUI.Toggle(SetCam && Camera.main != null, "Cam", GUI.ExpandHeight(false))); //camset

        if (SetCam != old && SetCam == false)
        {
            ResetCam();
        }
        if (GUI.Button("Apply"))
        {
            ApplyAll();
        }
        if (GUI.Button("Add"))
        {
            if (!instances.Contains(Selection.activeObject.name))
            {
                instances.Add(Selection.activeObject.name);
                SaveParams();
            }
        }
        GUI.EndHorizontal();
        DrawObjects();
        DrawSearch();
    }
예제 #2
0
    protected virtual void OnGUI()
    {
        if (Camera.main == null)
        {
            return;
        }
        if (!SetPivot && Selection.activeGameObject)
        {
            oldpos = Selection.activeGameObject.transform.position;
        }
        GUI.BeginHorizontal();
        SetPivot = (GUI.Toggle(SetPivot, "Pivot", GUI.ExpandWidth(false)) && Selection.activeGameObject != null);

        var old = SetCam;

        SetCam = (GUI.Toggle(SetCam && Camera.main != null, "Cam", GUI.ExpandHeight(false))); //camset

        Camera.main.renderingPath = (RenderingPath)gui.EnumPopup(Camera.main.renderingPath);
        if (SetCam != old && SetCam == false)
        {
            ResetCam();
        }
        if (GUI.Button("Apply"))
        {
            ApplyAll();
        }
        if (GUI.Button("Add"))
        {
            if (!instances.Contains(Selection.activeObject.name))
            {
                instances.Add(Selection.activeObject.name);
                SaveParams();
            }
        }
        if (GUI.Button("Init"))
        {
            foreach (var a in Selection.gameObjects.Select(a => a.GetComponent <MonoBehaviour>()))
            {
                a.SendMessage("Init", SendMessageOptions.DontRequireReceiver);
            }
        }
        GUI.EndHorizontal();
        QualitySettings.shadowDistance = gui.FloatField("LightmapDist", QualitySettings.shadowDistance);
        if (Selection.activeGameObject != null)
        {
            LayerDistances();
            var bs = Selection.activeGameObject.GetComponent <Base>();
            if (bs != null)
            {
                bs.OnInspectorGUI();
            }
        }



        DrawObjects();
        DrawSearch();
    }
예제 #3
0
        void OnGUI()
        {
            if (!model.enable)
            {
                model.enable = ToggleLeft("Log", model.enable); return;
            }
            instance = this; // TODO: why do this here?
            BeginHorizontal();
            if (GL.Button("˂", GL.ExpandWidth(false)))
            {
                model.SelectPreviousFrame();
                SceneView.RepaintAll();
            }
            GL.Button(frameNo, GL.MaxWidth(48f));
            if (GL.Button("˃", GL.ExpandWidth(false)))
            {
                model.SelectNextFrame();
                SceneView.RepaintAll();
            }
            GL.FlexibleSpace();
            EndHorizontal();
            //
            scroll = BeginScrollView(scroll);
            GUI.backgroundColor = Color.black;
            var style = GUI.skin.textArea;
            var f     = font;

            if (f == null)
            {
                Debug.LogError("font not available");
            }
            style.font              = f;
            style.fontSize          = FontSize;
            style.normal.textColor  = Color.white * 0.9f;
            style.focused.textColor = Color.white;
            style.focused.textColor = Color.white;
            GL.TextArea(model.output, GL.ExpandHeight(true));
            EndScrollView();
            //
            GUI.backgroundColor = Color.white;
            //
            var w30 = GL.MaxWidth(30f);

            BeginHorizontal();
            model.enable = ToggleLeft($"Log", model.enable, GL.MaxWidth(60));
            model.trails = ToggleLeft("Trails", model.trails, GL.MaxWidth(50));
            GL.Label("Offset: ", GL.ExpandWidth(false));
            var rs = model.renderSettings;

            rs.offset = FloatField(model.renderSettings.offset, w30);
            GL.Label("Size: ", w30);
            rs.size = FloatField(rs.size, w30);
            GL.Label("Col: ", w30);
            rs.color = EditorGUILayout.ColorField(rs.color);
            EndHorizontal();
        }
예제 #4
0
    protected virtual void OnGUI()
    {
        if (!SetPivot && Selection.activeGameObject)
        {
            oldpos = Selection.activeGameObject.transform.position;
        }
        GUI.BeginHorizontal();
        SetPivot = (GUI.Toggle(SetPivot, "Pivot", GUI.ExpandWidth(false)) && Selection.activeGameObject != null);

        var old = SetCam;

        SetCam = (GUI.Toggle(SetCam && Camera.main != null, "Cam", GUI.ExpandHeight(false))); //camset

        if (SetCam != old && SetCam == false)
        {
            ResetCam();
        }

        if (GUI.Button("NextCam"))
        {
            NextCamera();
        }

        if (GUI.Button("Init"))
        {
            Inits();
        }
        GUI.EndHorizontal();
        QualitySettings.shadowDistance = gui.FloatField("LightmapDist", QualitySettings.shadowDistance);
        GUI.BeginHorizontal();

        GUI.EndHorizontal();
        GUI.BeginHorizontal();
        Base.debug = GUI.Toggle(Base.debug, "debug", GUI.ExpandWidth(false));
        GUI.EndHorizontal();

        foreach (var a in GameObject.FindGameObjectsWithTag("EditorGUI").Where(a => a != Selection.activeGameObject))
        {
            a.GetComponent <bs>().OnEditorGui();
        }

        if (Selection.activeGameObject != null)
        {
            var bs2 = Selection.activeGameObject.GetComponent <Base>();
            if (bs2 != null)
            {
                bs2.OnEditorGui();
            }
        }
        DrawSearch();
    }
예제 #5
0
    protected virtual void OnGUI()
    {
        if (!SetPivot && Selection.activeGameObject)
        {
            oldPivot = Selection.activeGameObject.transform.position;
        }
        SetPivot = (GUI.Toggle(SetPivot, "Pivot", GUI.ExpandWidth(false)) && Selection.activeGameObject != null);

        SetCam = (GUI.Toggle(SetCam && Camera.mainCamera != null, "Cam", GUI.ExpandHeight(false))); //camset
        QualitySettings.shadowDistance = gui.FloatField("LightmapDist", QualitySettings.shadowDistance);

        //OnGUIOther();
        OnGUIMono();
        DrawSearch();
    }
예제 #6
0
 public static GUILayoutOption ExpandHeight(bool v) => GL.ExpandHeight(v);
예제 #7
0
 public static GUILayoutOption AutoHeight() => GL.ExpandHeight(false);
예제 #8
0
    protected virtual void OnGUI()
    {
        if (Camera.main == null)
        {
            return;
        }
        if (!SetPivot && Selection.activeGameObject)
        {
            oldpos = Selection.activeGameObject.transform.position;
        }
        GUI.BeginHorizontal();
        SetPivot = (GUI.Toggle(SetPivot, "Pivot", GUI.ExpandWidth(false)) && Selection.activeGameObject != null);

        var old = SetCam;

        SetCam = (GUI.Toggle(SetCam && Camera.main != null, "Cam", GUI.ExpandHeight(false))); //camset

        Camera.main.renderingPath = (RenderingPath)gui.EnumPopup(Camera.main.renderingPath);
        if (SetCam != old && SetCam == false)
        {
            ResetCam();
        }
        if (GUI.Button("Apply"))
        {
            ApplyAll();
        }
        if (GUI.Button("Add"))
        {
            if (!instances.Contains(Selection.activeObject.name))
            {
                instances.Add(Selection.activeObject.name);
                SaveParams();
            }
        }
        if (GUI.Button("Init"))
        {
            Inits();
        }
        GUI.EndHorizontal();
        QualitySettings.shadowDistance = gui.FloatField("LightmapDist", QualitySettings.shadowDistance);
        if (Selection.activeGameObject != null) // Layer Distances
        {
            var ls   = Camera.main.layerCullDistances;
            var lr   = Selection.activeGameObject.layer;
            var oldv = ls[lr];
            ls[lr] = gui.FloatField("LayerDist", ls[lr]);
            if (oldv != ls[lr])
            {
                Camera.main.layerCullDistances = ls;
            }
        }
        GUI.BeginHorizontal();
        bake = GUI.Toggle(bake, "Bake", GUI.ExpandWidth(false));

        lfactor = EditorGUILayout.FloatField(lfactor, GUI.Width(30));
        GUI.Label("ambient", GUI.Width(30));
        dfactor = EditorGUILayout.FloatField(dfactor, GUI.Width(30));
        GUI.Label("Directional", GUI.Width(30));
        //if (GUI.Button("SetupLevel"))
        //    LevelSetup();
        GUI.EndHorizontal();
        GUI.BeginHorizontal();
        EditorPrefs.SetBool("Debug", GUI.Toggle(EditorPrefs.GetBool("Debug"), "debug", GUI.ExpandWidth(false)));
        web = GUI.Toggle(web, "web", GUI.ExpandWidth(false));
        GUI.EndHorizontal();
        if (GUI.Button("Build"))
        {
            Build();
            return;
        }
        if (Selection.activeGameObject != null)
        {
            var bs2 = Selection.activeGameObject.GetComponent <Base>();
            if (bs2 != null)
            {
                bs2.OnEditorGui();
            }
        }
        DrawObjects();
        DrawSearch();
    }
예제 #9
0
 /// <summary>
 /// Draws simple vertical GUI line
 /// </summary>
 public static void VerticalRule()
 {
     Gl.Box("", Gl.ExpandHeight(true), Gl.Width(2));
 }
예제 #10
0
        void OnGUI()
        {
            if (!Config.enable)
            {
                Config.enable = ToggleLeft("Enable Logging", Config.enable); return;
            }
            //
            model.current = Selection.activeGameObject;
            instance      = this;
            BeginHorizontal();
            Config.useSelection = ToggleLeft("Use Selection", Config.useSelection,
                                             GL.MaxWidth(90f));
            Config.allFrames = ToggleLeft("History", Config.allFrames,
                                          GL.MaxWidth(60));
            // TODO - make return type filtering available with the global history
            if (model.applicableSelection)
            {
                GL.Label("→", GL.MaxWidth(25f));
                Config.rtypeIndex = Popup(Config.rtypeIndex, rtypeOptions);
            }
            EndHorizontal();
            if (!Config.useSelection)
            {
                model.current = null;
            }
            BeginHorizontal();
            int frameNo = browsing ? selectedFrame.index : Time.frameCount;

            if (GL.Button("˂", GL.ExpandWidth(false)))
            {
                SelectPrev();
            }
            GL.Button($"#{frameNo}", GL.MaxWidth(48f));
            if (GL.Button("˃", GL.ExpandWidth(false)))
            {
                SelectNext();
            }
            GL.FlexibleSpace();
            Config.step = ToggleLeft("Step", Config.step, GL.MaxWidth(48f));
            EndHorizontal();
            scroll = BeginScrollView(scroll);
            GUI.backgroundColor = Color.black;
            var style = GUI.skin.textArea;
            var f     = font;

            if (f == null)
            {
                Debug.LogError("font not available");
            }
            style.font              = f;
            style.fontSize          = FontSize;
            style.normal.textColor  = Color.white * 0.9f;
            style.focused.textColor = Color.white;
            style.focused.textColor = Color.white;
            string log = model.Output(useHistory, rtypeOptions[Config.rtypeIndex]);

            if (currentLog != log && Config.step)
            {
                Ed.isPaused = true;
            }
            currentLog = log;
            GL.TextArea(browsing ? selectedFrame.Format() : log,
                        GL.ExpandHeight(true));
            EndScrollView();
            GUI.backgroundColor = Color.white;
            BeginHorizontal();
            Config.enable = ToggleLeft(
                $"Enable Logging ({Logger.injectionTimeMs}ms)",
                Config.enable, GL.ExpandWidth(true));
            if (!Application.isPlaying)
            {
                if (GL.Button($"Clear", GL.MaxWidth(90f)))
                {
                    Clear();
                }
            }
            EndHorizontal();
            BeginHorizontal();
            GL.Label("Trail offset: ", GL.MaxWidth(60f));
            Config.trailOffset = FloatField(Config.trailOffset,
                                            GL.MaxWidth(30f));
            GL.Label("Size: ", GL.MaxWidth(30f));
            Config.handleSize = FloatField(Config.handleSize, GL.MaxWidth(30f));
            EndHorizontal();
        }
예제 #11
0
    protected virtual void OnGUI()
    {
        if (Camera.main == null)
        {
            return;
        }
        if (!SetPivot && Selection.activeGameObject)
        {
            oldpos = Selection.activeGameObject.transform.position;
        }
        GUI.BeginHorizontal();
        SetPivot = (GUI.Toggle(SetPivot, "Pivot", GUI.ExpandWidth(false)) && Selection.activeGameObject != null);

        var old = SetCam;

        SetCam = (GUI.Toggle(SetCam && Camera.main != null, "Cam", GUI.ExpandHeight(false))); //camset

        Camera.main.renderingPath = (RenderingPath)gui.EnumPopup(Camera.main.renderingPath);
        if (SetCam != old && SetCam == false)
        {
            ResetCam();
        }
        if (GUI.Button("Apply"))
        {
            ApplyAll();
        }
        if (GUI.Button("Add"))
        {
            if (!instances.Contains(Selection.activeObject.name))
            {
                instances.Add(Selection.activeObject.name);
                SaveParams();
            }
        }
        if (GUI.Button("Init"))
        {
            Inits();
        }
        GUI.EndHorizontal();
        QualitySettings.shadowDistance = gui.FloatField("LightmapDist", QualitySettings.shadowDistance);
        GUI.BeginHorizontal();

        GUI.EndHorizontal();
        GUI.BeginHorizontal();
        //EditorPrefs.SetBool("Debug", GUI.Toggle(EditorPrefs.GetBool("Debug"), "debug", GUI.ExpandWidth(false)));
        Base.debug          = GUI.Toggle(Base.debug, "debug", GUI.ExpandWidth(false));
        Base.disableScripts = GUI.Toggle(Base.disableScripts, "disableScripts", GUI.ExpandWidth(false));

        GUI.EndHorizontal();

        if (Selection.activeGameObject != null)
        {
            var bs2 = Selection.activeGameObject.GetComponent <Base>();
            if (bs2 != null)
            {
                bs2.OnEditorGui();
            }
        }
        DrawObjects();
        DrawSearch();
    }
예제 #12
0
 public static GUILayoutOption AutoHeight()
 {
     return(GL.ExpandHeight(false));
 }
예제 #13
0
 public static GUILayoutOption ExpandHeight(bool v)
 {
     return(GL.ExpandHeight(v));
 }