Space() public static method

Make a small space between the previous control and the following.

public static Space ( ) : void
return void
示例#1
0
            private void OnGUI()
            {
                EGL.LabelField("Use Settings");
                settings = EGL.ObjectField(settings, typeof(ImportSettings), false) as ImportSettings;

                EGL.Space();

                if (settings && CenteredButton("OK"))
                {
                    var reference = new MetaSpriteImportData
                    {
                        metaSpriteSettingsGuid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(settings))
                    };
                    foreach (var path in assetPaths)
                    {
                        var import = AssetImporter.GetAtPath(path);
                        import.userData = JsonUtility.ToJson(reference);
                        import.SaveAndReimport();
                    }

                    finishedAction(settings);
                    this.Close();
                }

                if (CenteredButton("Cancel"))
                {
                    this.Close();
                }
            }
示例#2
0
            void OnGUI()
            {
                EGL.LabelField("Use Settings");
                settings = (ImportSettings)EGL.ObjectField(settings, typeof(ImportSettings), false);

                EGL.Space();

                if (settings && CenteredButton("OK"))
                {
                    foreach (var path in paths)
                    {
                        var instance = ScriptableObject.CreateInstance <ImportSettingsReference>();
                        instance.settings = settings;

                        Directory.CreateDirectory(Path.GetDirectoryName(path));
                        AssetDatabase.CreateAsset(instance, path);
                    }

                    finishedAction(settings);
                    this.Close();
                }

                if (CenteredButton("Cancel"))
                {
                    this.Close();
                }
            }
    void ShowSettings()
    {
        LandmassEditorUtilities editorUtilities = LandmassEditorUtilities.Instance;
        ImporterConfiguration   importCfg       = editorUtilities.ImportCfg;

        EGL.BeginVertical();
        {
            EGL.Separator();

            GUILayout.Label("LOD Levels");

            EGL.BeginVertical(GuiUtils.Skin.box);
            {
                if (importCfg.LodLevels.Count >= 4)
                {
                    GUI.enabled = false;
                }
                if (GUILayout.Button("Add LOD Level"))
                {
                    importCfg.LodLevels.Add(new LodLevel());
                    importCfg.IsDirty = true; // Todo: Nasty
                }
                GUI.enabled = true;

                // Show the list of LODS
                EGL.BeginVertical();
                {
                    _lodScrollPos = EGL.BeginScrollView(_lodScrollPos, GUILayout.MinHeight(96f), GUILayout.MaxHeight(Screen.height));
                    {
                        var removeThese = new List <LodLevel>();
                        int i           = 0;
                        foreach (LodLevel lod in importCfg.LodLevels)
                        {
                            if (ShowLodLevel(lod, i))
                            {
                                removeThese.Add(lod);
                                importCfg.IsDirty = true; // Nasty
                            }
                            i++;
                        }
                        foreach (LodLevel lod in removeThese)
                        {
                            importCfg.LodLevels.Remove(lod);
                        }
                    }
                    EGL.EndScrollView();
                }
                EGL.EndVertical();

                EGL.Space();

                GUILayout.Label("Control how many assets are processed in one go.");
                importCfg.BatchLimit = EGL.IntField("Batch limit", importCfg.BatchLimit);
                GUILayout.Label("Larger batches mean faster processing but require\nmore memory. Change this with care, or Unity's\nmemory might run out!");
            }
            EGL.EndVertical();
        }
        EGL.EndVertical();
    }
示例#4
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        neb = target as Nebula;

        EGL.Space();
        EGL.FloatField("Radius", neb.dimensions.magnitude);
    }
    bool ShowLodLevel(LodLevel lod, int index)
    {
        bool removeThis = false;

        EGL.BeginVertical(GuiUtils.Skin.box);
        {
            GUILayout.Label("[" + index + "]");

            lod.Level = EGL.IntField("Lod Level", lod.Level);
            GUILayout.BeginHorizontal();
            {
                lod.FolderPath = EGL.TextField("Folder Path", lod.FolderPath);
                if (GUILayout.Button("Browse", GUILayout.Width(50f)))
                {
                    lod.FolderPath = UPath.GetProjectPath(EditorUtility.OpenFolderPanel("Browse", lod.FolderPath, Application.dataPath));
                }
            }
            GUILayout.EndHorizontal();

            lod.GridSize = EGL.IntField("Grid Size", lod.GridSize);

            lod.HeightmapResolution = EGL.IntField("Heightmap Resolution (px)", lod.HeightmapResolution);
            lod.SplatmapResolution  = EGL.IntField("Splatmap Resolution (px)", lod.SplatmapResolution);

            lod.HasDetailMap = EGL.Toggle("Use Detail Map?", lod.HasDetailMap);
            lod.HasTreeMap   = EGL.Toggle("Use Tree Map?", lod.HasTreeMap);

            if (lod.HasDetailMap)
            {
                lod.DetailmapResolution      = EGL.IntField("Detailmap Resolution (px)", lod.DetailmapResolution);
                lod.DetailResolutionPerPatch = EGL.IntField("Detailmap Patch Size (px)", lod.DetailResolutionPerPatch);
            }

            EGL.Space();

            GUILayout.Label("In-game terrain dimensions.");
            lod.TerrainWidth  = EGL.FloatField("Width & Length (m)", lod.TerrainWidth);
            lod.TerrainHeight = EGL.FloatField("Height (m)", lod.TerrainHeight);

            EGL.Space();

            GUILayout.Label("Relief Terrain Configuration");
            lod.ColormapResolution  = EGL.IntField("Colormap Resolution", lod.ColormapResolution);
            lod.NormalmapResolution = EGL.IntField("Normalmap Resolution", lod.NormalmapResolution);


            EGL.Space();

            if (GUILayout.Button("Remove", GUILayout.Width(64f), GUILayout.Height(64f)))
            {
                removeThis = true;
            }
        }
        EGL.EndVertical();

        return(removeThis);
    }
示例#6
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            var tree   = (BehaviourTree)target;
            var script = tree.source;

            if (script)
            {
                if (script.notCompiled)
                {
                    EGL.HelpBox("Script is not compiled.", MessageType.Error);
                }
                if (script.notUpToDate)
                {
                    EGL.HelpBox("Script is not up to date.", MessageType.Warning);
                }
                if (script.compileOkay)
                {
                    EGL.HelpBox("Script is compiled and up to date.", MessageType.Info);
                }
                if (GL.Button("Compile"))
                {
                    script.Compile();
                }
            }

            if (Application.isPlaying)
            {
                EGL.Space();
                EGL.LabelField("Conditions");
                GUI.enabled = false;
                foreach (var cond in tree.blackboard)
                {
                    var k = cond.Key;
                    var v = cond.Value;
                    if (v is float)
                    {
                        EGL.FloatField(k, (float)v);
                    }
                    else if (v is int)
                    {
                        EGL.IntField(k, (int)v);
                    }
                    else if (v is bool)
                    {
                        EGL.Toggle(k, (bool)v);
                    }
                    else if (v is string)
                    {
                        EGL.TextField(k, (string)v);
                    }
                }
                GUI.enabled = true;
                Repaint();
            }
        }
示例#7
0
        public override void OnInspectorGUI()
        {
            var settings = (ImportSettings)target;

            EditorGUI.BeginChangeCheck();

            using (new GL.HorizontalScope(EditorStyles.toolbar)) {
                GL.Label("Options");
            }

            settings.baseName     = EGL.TextField("Base Name", settings.baseName);
            settings.spriteTarget = EGL.TextField("Target Child Object", settings.spriteTarget);
            EGL.Space();

            settings.ppu       = EGL.IntField("Pixel Per Unit", settings.ppu);
            settings.alignment = (SpriteAlignment)EGL.EnumPopup("Default Align", settings.alignment);
            if (settings.alignment == SpriteAlignment.Custom)
            {
                settings.customPivot = EGL.Vector2Field("Custom Pivot", settings.customPivot);
            }

            settings.densePacked       = EGL.Toggle("Dense Pack", settings.densePacked);
            settings.border            = EGL.IntField("Border", settings.border);
            settings.automaticReimport = EGL.Toggle("Automatic Reimport", settings.automaticReimport);

            EGL.Space();
            using (new GL.HorizontalScope(EditorStyles.toolbar)) {
                GL.Label("Output");
            }

            settings.atlasOutputDirectory = PathSelection("Atlas Directory", settings.atlasOutputDirectory);
            settings.clipOutputDirectory  = PathSelection("Anim Clip Directory", settings.clipOutputDirectory);

            settings.controllerPolicy = (AnimControllerOutputPolicy)EGL.EnumPopup("Anim Controller Policy", settings.controllerPolicy);
            if (settings.controllerPolicy == AnimControllerOutputPolicy.CreateOrOverride)
            {
                settings.animControllerOutputPath = PathSelection("Anim Controller Directory", settings.animControllerOutputPath);
            }

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(settings);
            }
        }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        EGL.Space();

        AsteroidField field = (AsteroidField)target;

        field.AsteroidGameObject = (GameObject)EGL.ObjectField(new GUIContent("Asteroid Game Object", "The game object that represents the spawned asteroids"), field.AsteroidGameObject, typeof(GameObject), false);

        field.InnerRadius = EGL.FloatField(new GUIContent("Inner Radius", "The inner radius of the field"), field.InnerRadius);
        field.OuterRadius = EGL.Slider("Outer Radius", field.OuterRadius, field.InnerRadius, 10000 + field.InnerRadius);

        EGL.Space();

        scaleUsesRange = EGL.Toggle(new GUIContent("Scale uses range?", "Whether the asteroids spawned should pick a scale from a specified range."), scaleUsesRange);

        if (scaleUsesRange)
        {
            field.AsteroidLowerScale = EGL.Slider("Lower range", field.AsteroidLowerScale, 0, 20);
            field.AsteroidUpperScale = EGL.Slider("Upper range", field.AsteroidUpperScale, field.AsteroidLowerScale, field.AsteroidLowerScale + 20);
        }

        else
        {
            field.AsteroidScale = EGL.Slider("Scale", field.AsteroidScale, 0, 20);
        }

        using (new EditorGUI.DisabledScope(field.AsteroidGameObject == null))
        {
            if (GUILayout.Button("Generate Field"))
            {
                field.GenerateField(scaleUsesRange);
            }
        }

        if (GUILayout.Button("Clear Field"))
        {
            field.ClearField();
        }
    }
    public override void OnInspectorGUI()
    {
        field = (AsteroidField)target;

        EGL.LabelField("Settings", EditorStyles.boldLabel);
        field.hideFlags        = (HideFlags)EGL.EnumPopup("Hide Flags", field.hideFlags);
        field.desiredAsteroids = EGL.IntField("Desired Asteroids", field.desiredAsteroids);
        EGL.Space();

        EGL.LabelField("GameObject", EditorStyles.boldLabel);
        ShowGameObjectInformation();
        EGL.Space();

        EGL.LabelField("Radius", EditorStyles.boldLabel);
        ShowRadiusInfromation();
        EGL.Space();

        EGL.LabelField("Scale", EditorStyles.boldLabel);
        ShowScaleInformation();
        EGL.Space();

        ShowButtons();
    }
示例#10
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        var engine = target as Engine;

        if (Application.isPlaying == false)
        {
            return;
        }

        EGL.LabelField("Speed: " + engine.Speed);

        EGL.Space();
        ShowButtons(engine);
        EGL.Space();

        EGL.LabelField("Pitch: " + engine.Pitch);
        EGL.LabelField("Yaw: " + engine.Yaw);
        EGL.LabelField("Roll: " + engine.Roll);

        engine.Strafe   = EGL.Slider("Strafe", engine.Strafe, -1, 1);
        engine.Throttle = EGL.Slider("Throttle", engine.Throttle, 0, 1);
    }
示例#11
0
        private void DoColorSpaceGUI()
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.m_ShowColors = GUILayout.Toggle(this.m_ShowColors, ColorPicker.styles.colorToggle, EditorStyles.foldout, new GUILayoutOption[0]);
            GUI.enabled       = this.m_ShowColors;
            if (GUILayout.Button(ColorPicker.styles.colorCycle, GUIStyle.none, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(false)
            }))
            {
                this.m_OldColorBoxMode = (this.m_ColorBoxMode = (this.m_ColorBoxMode + 1) % ColorPicker.ColorBoxMode.EyeDropper);
            }
            GUI.enabled = true;
            GUILayout.EndHorizontal();
            if (this.m_ShowColors)
            {
                bool changed = GUI.changed;
                GUILayout.BeginHorizontal(new GUILayoutOption[]
                {
                    GUILayout.ExpandHeight(false)
                });
                Rect aspectRect = GUILayoutUtility.GetAspectRect(1f, ColorPicker.styles.pickerBox, new GUILayoutOption[]
                {
                    GUILayout.MinWidth(64f),
                    GUILayout.MinHeight(64f),
                    GUILayout.MaxWidth(256f),
                    GUILayout.MaxHeight(256f)
                });
                EditorGUILayout.Space();
                Rect rect = GUILayoutUtility.GetRect(8f, 32f, 64f, 128f, ColorPicker.styles.pickerBox);
                rect.height = aspectRect.height;
                GUILayout.EndHorizontal();
                GUI.changed = false;
                switch (this.m_ColorBoxMode)
                {
                case ColorPicker.ColorBoxMode.SV_H:
                    this.Slider3D(aspectRect, rect, ref this.m_S, ref this.m_V, ref this.m_H, ColorPicker.styles.pickerBox, ColorPicker.styles.thumb2D, ColorPicker.styles.thumbVert);
                    if (GUI.changed)
                    {
                        this.HSVToRGB();
                    }
                    break;

                case ColorPicker.ColorBoxMode.HV_S:
                    this.Slider3D(aspectRect, rect, ref this.m_H, ref this.m_V, ref this.m_S, ColorPicker.styles.pickerBox, ColorPicker.styles.thumb2D, ColorPicker.styles.thumbVert);
                    if (GUI.changed)
                    {
                        this.HSVToRGB();
                    }
                    break;

                case ColorPicker.ColorBoxMode.HS_V:
                    this.Slider3D(aspectRect, rect, ref this.m_H, ref this.m_S, ref this.m_V, ColorPicker.styles.pickerBox, ColorPicker.styles.thumb2D, ColorPicker.styles.thumbVert);
                    if (GUI.changed)
                    {
                        this.HSVToRGB();
                    }
                    break;

                case ColorPicker.ColorBoxMode.BG_R:
                    this.Slider3D(aspectRect, rect, ref this.m_B, ref this.m_G, ref this.m_R, ColorPicker.styles.pickerBox, ColorPicker.styles.thumb2D, ColorPicker.styles.thumbVert);
                    if (GUI.changed)
                    {
                        this.RGBToHSV();
                    }
                    break;

                case ColorPicker.ColorBoxMode.BR_G:
                    this.Slider3D(aspectRect, rect, ref this.m_B, ref this.m_R, ref this.m_G, ColorPicker.styles.pickerBox, ColorPicker.styles.thumb2D, ColorPicker.styles.thumbVert);
                    if (GUI.changed)
                    {
                        this.RGBToHSV();
                    }
                    break;

                case ColorPicker.ColorBoxMode.RG_B:
                    this.Slider3D(aspectRect, rect, ref this.m_R, ref this.m_G, ref this.m_B, ColorPicker.styles.pickerBox, ColorPicker.styles.thumb2D, ColorPicker.styles.thumbVert);
                    if (GUI.changed)
                    {
                        this.RGBToHSV();
                    }
                    break;

                case ColorPicker.ColorBoxMode.EyeDropper:
                    EyeDropper.DrawPreview(Rect.MinMaxRect(aspectRect.x, aspectRect.y, rect.xMax, aspectRect.yMax));
                    break;
                }
                GUI.changed |= changed;
            }
        }
示例#12
0
        void OnGUI()
        {
            Event e = Event.current;

            LoadIcons();
            LogEntries.wrapped.UpdateEntries();

            if (!m_HasUpdatedGuiStyles)
            {
                m_LineHeight   = Mathf.RoundToInt(Constants.ErrorStyle.lineHeight);
                m_BorderHeight = Constants.ErrorStyle.border.top + Constants.ErrorStyle.border.bottom;
                UpdateListView();
            }

            GUILayout.BeginHorizontal(Constants.Toolbar);

            if (GUILayout.Button(Constants.ClearLabel, Constants.MiniButton))
            {
                LogEntries.Clear();
                GUIUtility.keyboardControl = 0;
            }

            int currCount = LogEntries.wrapped.GetCount();

            if (m_ListView.totalRows != currCount && m_ListView.totalRows > 0)
            {
                // scroll bar was at the bottom?
                if (m_ListView.scrollPos.y >= m_ListView.rowHeight * m_ListView.totalRows - ms_LVHeight)
                {
                    m_ListView.scrollPos.y = currCount * RowHeight - ms_LVHeight;
                }
            }

            if (LogEntries.wrapped.searchFrame)
            {
                LogEntries.wrapped.searchFrame = false;
                int selectedIndex = LogEntries.wrapped.GetSelectedEntryIndex();
                if (selectedIndex != -1)
                {
                    int showIndex = selectedIndex + 1;
                    if (currCount > showIndex)
                    {
                        int showCount = ms_LVHeight / RowHeight;
                        showIndex = showIndex + showCount / 2;
                    }
                    m_ListView.scrollPos.y = showIndex * RowHeight - ms_LVHeight;
                }
            }

            EditorGUILayout.Space();

            bool wasCollapsed = LogEntries.wrapped.collapse;

            LogEntries.wrapped.collapse = GUILayout.Toggle(wasCollapsed, Constants.CollapseLabel, Constants.MiniButton);

            bool collapsedChanged = (wasCollapsed != LogEntries.wrapped.collapse);

            if (collapsedChanged)
            {
                // unselect if collapsed flag changed
                m_ListView.row = -1;

                // scroll to bottom
                m_ListView.scrollPos.y = LogEntries.wrapped.GetCount() * RowHeight;
            }

            SetFlag(ConsoleFlags.ClearOnPlay, GUILayout.Toggle(HasFlag(ConsoleFlags.ClearOnPlay), Constants.ClearOnPlayLabel, Constants.MiniButton));
#if UNITY_2019_1_OR_NEWER
            SetFlag(ConsoleFlags.ClearOnBuild, GUILayout.Toggle(HasFlag(ConsoleFlags.ClearOnBuild), Constants.ClearOnBuildLabel, Constants.MiniButton));
#endif
            SetFlag(ConsoleFlags.ErrorPause, GUILayout.Toggle(HasFlag(ConsoleFlags.ErrorPause), Constants.ErrorPauseLabel, Constants.MiniButton));

#if UNITY_2018_3_OR_NEWER
            ConnectionGUILayout.AttachToPlayerDropdown(m_ConsoleAttachToPlayerState, EditorStyles.toolbarDropDown);
#endif

            EditorGUILayout.Space();

            if (m_DevBuild)
            {
                GUILayout.FlexibleSpace();
                SetFlag(ConsoleFlags.StopForAssert, GUILayout.Toggle(HasFlag(ConsoleFlags.StopForAssert), Constants.StopForAssertLabel, Constants.MiniButton));
                SetFlag(ConsoleFlags.StopForError, GUILayout.Toggle(HasFlag(ConsoleFlags.StopForError), Constants.StopForErrorLabel, Constants.MiniButton));
            }

            GUILayout.FlexibleSpace();

            // Search bar
            GUILayout.Space(4f);
            SearchField(e);

            int errorCount = 0, warningCount = 0, logCount = 0;
            LogEntries.wrapped.GetCountsByType(ref errorCount, ref warningCount, ref logCount);
            EditorGUI.BeginChangeCheck();
            bool setLogFlag     = GUILayout.Toggle(LogEntries.wrapped.HasFlag((int)ConsoleFlags.LogLevelLog), new GUIContent((logCount <= 999 ? logCount.ToString() : "999+"), logCount > 0 ? iconInfoSmall : iconInfoMono), Constants.MiniButton);
            bool setWarningFlag = GUILayout.Toggle(LogEntries.wrapped.HasFlag((int)ConsoleFlags.LogLevelWarning), new GUIContent((warningCount <= 999 ? warningCount.ToString() : "999+"), warningCount > 0 ? iconWarnSmall : iconWarnMono), Constants.MiniButton);
            bool setErrorFlag   = GUILayout.Toggle(LogEntries.wrapped.HasFlag((int)ConsoleFlags.LogLevelError), new GUIContent((errorCount <= 999 ? errorCount.ToString() : "999+"), errorCount > 0 ? iconErrorSmall : iconErrorMono), Constants.MiniButton);
            // Active entry index may no longer be valid
            if (EditorGUI.EndChangeCheck())
            {
            }

            LogEntries.wrapped.SetFlag((int)ConsoleFlags.LogLevelLog, setLogFlag);
            LogEntries.wrapped.SetFlag((int)ConsoleFlags.LogLevelWarning, setWarningFlag);
            LogEntries.wrapped.SetFlag((int)ConsoleFlags.LogLevelError, setErrorFlag);

            if (GUILayout.Button(new GUIContent(errorCount > 0 ? iconFirstErrorSmall : iconFirstErrorMono, Constants.FirstErrorLabel), Constants.MiniButton))
            {
                int firstErrorIndex = LogEntries.wrapped.GetFirstErrorEntryIndex();
                if (firstErrorIndex != -1)
                {
                    SetActiveEntry(firstErrorIndex);
                    LogEntries.wrapped.searchFrame = true;
                }
            }

            GUILayout.EndHorizontal();

            SplitterGUILayout.BeginVerticalSplit(spl);
            int rowHeight = RowHeight;
            EditorGUIUtility.SetIconSize(new Vector2(rowHeight, rowHeight));
            GUIContent tempContent      = new GUIContent();
            int        id               = GUIUtility.GetControlID(0);
            int        rowDoubleClicked = -1;

            /////@TODO: Make Frame selected work with ListViewState
            using (new GettingLogEntriesScope(m_ListView))
            {
                int  selectedRow      = -1;
                bool openSelectedItem = false;
                bool collapsed        = LogEntries.wrapped.collapse;
                foreach (ListViewElement el in ListViewGUI.ListView(m_ListView, Constants.Box))
                {
                    if (e.type == EventType.MouseDown && e.button == 0 && el.position.Contains(e.mousePosition))
                    {
                        m_ListView.row = el.row;
                        selectedRow    = el.row;
                        if (e.clickCount == 2)
                        {
                            openSelectedItem = true;
                        }
                    }
                    else if (e.type == EventType.Repaint)
                    {
                        int    mode           = 0;
                        int    entryCount     = 0;
                        int    searchIndex    = 0;
                        int    searchEndIndex = 0;
                        string text           = LogEntries.wrapped.GetEntryLinesAndFlagAndCount(el.row, ref mode, ref entryCount,
                                                                                                ref searchIndex, ref searchEndIndex);
                        ConsoleFlags flag       = (ConsoleFlags)mode;
                        bool         isSelected = LogEntries.wrapped.IsEntrySelected(el.row);

                        // Draw the background
                        GUIStyle s = el.row % 2 == 0 ? Constants.OddBackground : Constants.EvenBackground;
                        s.Draw(el.position, false, false, isSelected, false);

                        // Draw the icon
#if !UNITY_2017_3_OR_NEWER
                        if (Constants.LogStyleLineCount == 1)
                        {
                            Rect rt = el.position;
                            rt.x     += 6f;
                            rt.y     += 2f;
                            rt.width  = 16f;
                            rt.height = 16f;
                            GUI.DrawTexture(rt, GetIconForErrorMode(flag, false));
                        }
                        else
#endif
                        {
                            GUIStyle iconStyle = GetStyleForErrorMode(flag, true, Constants.LogStyleLineCount == 1);
                            iconStyle.Draw(el.position, false, false, isSelected, false);
                        }

                        // Draw the text
                        tempContent.text = text;
                        GUIStyle errorModeStyle = GetStyleForErrorMode(flag, false, Constants.LogStyleLineCount == 1);

                        if (string.IsNullOrEmpty(LogEntries.wrapped.searchString) || searchIndex == -1 || searchIndex >= text.Length)
                        {
                            errorModeStyle.Draw(el.position, tempContent, id, isSelected);
                        }
                        else
                        {
                            errorModeStyle.DrawWithTextSelection(el.position, tempContent, GUIUtility.keyboardControl, searchIndex, searchEndIndex);
                        }

                        if (collapsed)
                        {
                            Rect badgeRect = el.position;
                            tempContent.text = entryCount.ToString(CultureInfo.InvariantCulture);
                            Vector2 badgeSize = Constants.CountBadge.CalcSize(tempContent);
                            badgeRect.xMin  = badgeRect.xMax - badgeSize.x;
                            badgeRect.yMin += ((badgeRect.yMax - badgeRect.yMin) - badgeSize.y) * 0.5f;
                            badgeRect.x    -= 5f;
                            GUI.Label(badgeRect, tempContent, Constants.CountBadge);
                        }
                    }
                }

                if (selectedRow != -1)
                {
                    if (m_ListView.scrollPos.y >= m_ListView.rowHeight * m_ListView.totalRows - ms_LVHeight)
                    {
                        m_ListView.scrollPos.y = m_ListView.rowHeight * m_ListView.totalRows - ms_LVHeight - 1;
                    }
                }

                // Make sure the selected entry is up to date
                if (m_ListView.totalRows == 0 || m_ListView.row >= m_ListView.totalRows || m_ListView.row < 0)
                {
                }
                else
                {
                    if (m_ListView.selectionChanged)
                    {
                        SetActiveEntry(m_ListView.row);
                    }
                }

                // Open entry using return key
                if ((GUIUtility.keyboardControl == m_ListView.ID) && (e.type == EventType.KeyDown) && (e.keyCode == KeyCode.Return) && (m_ListView.row != 0))
                {
                    selectedRow      = m_ListView.row;
                    openSelectedItem = true;
                }

                if (e.type != EventType.Layout && ListViewGUI.ilvState.rectHeight != 1)
                {
                    ms_LVHeight = ListViewGUI.ilvState.rectHeight;
                }

                if (openSelectedItem)
                {
                    rowDoubleClicked = selectedRow;
                    e.Use();
                }

                if (selectedRow != -1)
                {
                    SetActiveEntry(selectedRow);
                }
            }

            // Prevent dead locking in EditorMonoConsole by delaying callbacks (which can log to the console) until after LogEntries.EndGettingEntries() has been
            // called (this releases the mutex in EditorMonoConsole so logging again is allowed). Fix for case 1081060.
            if (rowDoubleClicked != -1)
            {
                LogEntries.wrapped.StacktraceListView_RowGotDoubleClicked();
            }

            EditorGUIUtility.SetIconSize(Vector2.zero);

            StacktraceListView(e, tempContent);

            SplitterGUILayout.EndVerticalSplit();

            // Copy & Paste selected item
            if ((e.type == EventType.ValidateCommand || e.type == EventType.ExecuteCommand) && e.commandName == "Copy")
            {
                if (e.type == EventType.ExecuteCommand)
                {
                    LogEntries.wrapped.StacktraceListView_CopyAll();
                }
                e.Use();
            }
        }
示例#13
0
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                m_MaterialEditor.ShaderProperty(unlit, Styles.unlitText.text);
                bool bUnlit = (unlit.floatValue != 0.0f);

                BlendModePopup();

                if (!bUnlit)
                {
                    SpecularModePopup();
                }

                if (!bUnlit)
                {
                    m_MaterialEditor.ShaderProperty(receiveShadows, Styles.receiveShadowsText.text);
                }

                m_MaterialEditor.ShaderProperty(renderBackfaces, Styles.renderBackfacesText.text);

                EditorGUILayout.Space();

                //GUILayout.Label( Styles.primaryMapsText, EditorStyles.boldLabel );
                DoAlbedoArea(material);
                if (!bUnlit)
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, bumpMap, bumpMap.textureValue != null ? bumpScale : null);
                    DoSpecularMetallicArea(material);
                    m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                    if (occlusionMap.textureValue != null)
                    {
                        m_MaterialEditor.ShaderProperty(occlusionStrengthDirectDiffuse, Styles.occlusionStrengthDirectDiffuseText.text, 2);
                        m_MaterialEditor.ShaderProperty(occlusionStrengthDirectSpecular, Styles.occlusionStrengthDirectSpecularText.text, 2);
                        m_MaterialEditor.ShaderProperty(occlusionStrengthIndirectDiffuse, Styles.occlusionStrengthIndirectDiffuseText.text, 2);
                        m_MaterialEditor.ShaderProperty(occlusionStrengthIndirectSpecular, Styles.occlusionStrengthIndirectSpecularText.text, 2);
                    }
                    m_MaterialEditor.ShaderProperty(cubeMapScalar, Styles.cubeMapScalarText.text, 0);
                }
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                DoEmissionArea(material);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                if (!bUnlit)
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.overrideLightmapText, overrideLightmap);
                }

                EditorGUI.BeginChangeCheck();         // !!! AV - This is from Unity's script. Can these Begin/End calls be nested like this?
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset;             // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }

                if (worldAlignedTexture != null)
                {
                    m_MaterialEditor.ShaderProperty(worldAlignedTexture, Styles.worldAlignedTextureText.text);

                    if (worldAlignedTexture.floatValue != 0.0f)
                    {
                        EditorGUI.indentLevel = 2;
                        Vector3GUI(Styles.worldAlignedTextureSizeText, worldAlignedTextureSize);
                        Vector3GUI(Styles.worldAlignedTextureNormalText, worldAlignedTextureNormal);
                        Vector3GUI(Styles.worldAlignedTexturePositionText, worldAlignedTexturePosition);
                        EditorGUI.indentLevel = 0;
                    }
                }

                EditorGUILayout.Space();

                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                if (!bUnlit)
                {
                    m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                }
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged(( Material )obj);
                }

                foreach (var obj in specularMode.targets)
                {
                    MaterialChanged(( Material )obj);
                }
            }
        }
示例#14
0
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            // Detect any changes to the material
            EditorGUI.BeginChangeCheck();
            {
                BlendModePopup();

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.ShaderProperty(outLineWidth, "OutLineWidth");
                m_MaterialEditor.ShaderProperty(outLineColor, "OutLineColor");
                DoAlbedoArea(material);
                DoSpecularMetallicArea();
                DoNormalArea();
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                DoEmissionArea(material);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();

                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);

                // Third properties
                GUILayout.Label(Styles.forwardText, EditorStyles.boldLabel);
                if (highlights != null)
                {
                    m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText);
                }
                if (reflections != null)
                {
                    m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText);
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var obj in blendMode.targets)
                {
                    MaterialChanged((Material)obj, m_WorkflowMode);
                }
            }

            EditorGUILayout.Space();

            // NB renderqueue editor is not shown on purpose: we want to override it based on blend mode
            GUILayout.Label(Styles.advancedText, EditorStyles.boldLabel);
            m_MaterialEditor.EnableInstancingField();
            m_MaterialEditor.DoubleSidedGIField();
        }
示例#15
0
        void OnGUI()
        {
            if (!profile)
            {
                return;
            }

            if (Selection.activeObject != profile && Selection.activeObject is TransitionProfile)
            {
                BeginEdit(Selection.activeObject as TransitionProfile);
            }

            globalPanel = (GlobalPanelType)GL.Toolbar((int)globalPanel, new string[] { "States", "Params", "Tags", "Transitions" }, EditorStyles.toolbarButton);

            switch (globalPanel)
            {
            case GlobalPanelType.States: {
                profile.controller = (AnimatorController)EGL.ObjectField("Controller", profile.controller, typeof(AnimatorController), allowSceneObjects: false);

                if (profile.controller)
                {
                    EGL.BeginHorizontal();
                    EGL.PrefixLabel("Layer");
                    profile.controllerLayer = EGL.IntField(profile.controllerLayer);

                    // GL.FlexibleSpace();
                    if (GL.Button("Sync", EditorStyles.miniButtonRight, GL.Width(40)) && profile.controller)
                    {
                        SyncControllerStates();
                        statePanelView.Reload();
                    }
                    EGL.EndHorizontal();
                }
                EGL.Space();

                if (statePanelView == null)
                {
                    statePanelView = new StatesTreeView(statePanelState, profile);
                    statePanelView.searchString = "";

                    searchFieldState.downOrUpArrowKeyPressed += statePanelView.SetFocusAndEnsureSelectedItem;
                }
                statePanelView.searchString = ToolbarSearchField(statePanelView.searchString, searchFieldState);
                statePanelView.OnGUI(GUILayoutUtility.GetRect(0, 10000, 0, 10000));
            } break;

            case GlobalPanelType.Parameters: {
                if (paramPanelView == null)
                {
                    paramPanelView = new ParamsTreeView(paramPanelState, profile);
                    paramPanelView.searchString = "";
                }

                paramPanelView.searchString = ToolbarSearchField(paramPanelView.searchString, searchFieldParam);

                paramPanelView.OnGUI(GUILayoutUtility.GetRect(0, 10000, 0, 10000));
            } break;

            case GlobalPanelType.Tags: {
                if (tagsPanelView == null)
                {
                    tagsPanelView = new TagsTreeView(tagsPanelState, profile);
                }

                tagsPanelView.searchString = ToolbarSearchField(tagsPanelView.searchString, searchFieldTag);

                tagsPanelView.OnGUI(GUILayoutUtility.GetRect(0, 10000, 0, 10000));

                var selection = tagsPanelView.GetSelection();
                if (selection.Any())
                {
                    string selectedTag   = profile.tags[selection.First()];
                    var    relatedStates = profile.states.Where(state => state.HasTagAnyFrame(Animator.StringToHash(selectedTag))).Select(it => it.stateName);

                    string statesStr = string.Join(",", relatedStates.ToArray());
                    GL.Label(statesStr, EditorStyles.textArea);
                }
            } break;

            default: { // Transitions
                if (transitionPanelView == null)
                {
                    transitionPanelView = new TransitionTreeView(transitionPanelState, profile);
                }

                EditorGUI.BeginChangeCheck();
                transitionPanelView.fromStateFilter   = searchFieldFromState.OnGUI("From State", transitionPanelView.fromStateFilter);
                transitionPanelView.targetStateFilter = searchFieldTargetState.OnGUI("Target State", transitionPanelView.targetStateFilter);
                if (EditorGUI.EndChangeCheck())
                {
                    transitionPanelView.Reload();
                }
                EGL.Space();

                transitionPanelView.OnGUI(GUILayoutUtility.GetRect(0, 10000, 0, 10000));

                Repaint();
            } break;
            }
        }
示例#16
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            var pb = (LayerPresetLoader)target;

            if (isGettingLayers)
            {
                EGL.Space();
                EGL.Space();
                EGL.LabelField("Loading Layers...");
                return;
            }
            if (layersList.Count == 0)
            {
                isGettingLayers = true;
                LayerLoader.Init();
                new Thread(GetLayersList).Start();
            }
            EGL.Space();
            EGL.Space();
            EGL.LabelField("Presets");
            EGL.Space();
            for (int i = 0; i < pb.presets.Count; i++)
            {
                using (new HorizontalGroup())
                {
                    pb.presets[i].presetName =
                        EGL.TextField(
                            string.IsNullOrEmpty(pb.presets[i].presetName)
                                ? "Preset " + (i + 1)
                                : pb.presets[i].presetName, pb.presets[i].presetName);
                    if (GUILayout.Button("X"))
                    {
                        pb.presets[i] = null;
                        pb.presets.RemoveAt(i);
                        return;
                    }
                }
                EditorGUI.indentLevel++;
                EGL.LabelField("Flat Layers");
                EditorGUI.indentLevel++;
                filter = EGL.TextField("shared layer filter", filter);
                var filteredList = new List <string>(layersList);
                var preset       = pb.presets[i];
                for (int j = 0; j < pb.presets[i].layersInPreset.Count; j++)
                {
                    using (new HorizontalGroup())
                    {
                        if (layersList.Contains(pb.presets[i].layersInPreset[j]))
                        {
                            if (!string.IsNullOrEmpty(filter))
                            {
                                filteredList = layersList.Where(entry => entry.ToLower().Contains(filter.ToLower()) || entry == pb.presets[i].layersInPreset[j]).ToList();
                            }
                            pb.presets[i].layersInPreset[j] =
                                filteredList[
                                    EGL.Popup(j == 0 ? "Base Layer" : "Layer", filteredList.IndexOf(preset.layersInPreset[j]),
                                              filteredList.ToArray())];
                        }
                        else
                        {
                            return;
                        }
                        if (GUILayout.Button("X"))
                        {
                            pb.presets[i].RemoveLayer(j);
                            return;
                        }
                    }
                }
                if (pb.presets[i].layersInPreset.Count < 3)
                {
                    using (new HorizontalGroup())
                    {
                        //var nLayer = layersList[EGL.Popup("Layer", 0, layersList.ToArray())];
                        EGL.LabelField("New Overlay Layer");
                        if (GUILayout.Button("+"))
                        {
                            pb.presets[i].AddOverlayLayer(layersList[0]);
                            break;
                        }
                    }
                }
                EditorGUI.indentLevel--;
                EGL.LabelField("Volumetric Layers");
                EditorGUI.indentLevel++;
                for (int j = 0; j < pb.presets[i].volumetricLayers.Count; j++)
                {
                    using (new HorizontalGroup())
                    {
                        if (!string.IsNullOrEmpty(pb.presets[i].volumetricLayers[j]))
                        {
                            if (layersList.Contains(pb.presets[i].volumetricLayers[j]))
                            {
                                if (!string.IsNullOrEmpty(filter))
                                {
                                    filteredList = layersList.Where(entry => entry.ToLower().Contains(filter.ToLower()) || entry == pb.presets[i].volumetricLayers[j]).ToList();
                                }
                                pb.presets[i].volumetricLayers[j] =
                                    filteredList[
                                        EGL.Popup("Layer " + j, filteredList.IndexOf(preset.volumetricLayers[j]),
                                                  filteredList.ToArray())];
                            }
                            if (GUILayout.Button("X"))
                            {
                                pb.presets[i].volumetricLayers[j] = "";
                            }
                        }
                        else
                        {
                            if (GUILayout.Button("Activate"))
                            {
                                pb.presets[i].volumetricLayers[j] = "MODIS_Fires_All";
                            }
                        }
                    }
                }
                EditorGUI.indentLevel--;
                EditorGUI.indentLevel--;
                EGL.Space();
            }
            using (new HorizontalGroup())
            {
                if (GUILayout.Button("+"))
                {
                    pb.presets.Add(new Preset());
                }
            }
            if (GUI.changed)
            {
                Undo.RegisterCompleteObjectUndo(pb, "Preset change");
                EditorUtility.SetDirty(pb);
            }
        }
示例#17
0
        public void ShaderPropertiesGUI(Material material)
        {
            // Use default labelWidth
            EditorGUIUtility.labelWidth = 0f;

            bool blendModeChanged = false;

            {
                blendModeChanged = BlendModePopup();

                // Primary properties
                GUILayout.Label(Styles.primaryMapsText, EditorStyles.boldLabel);
                DoAlbedoArea(material);
                DoSpecularMetallicArea();
                DoNormalArea();
                m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightMap.textureValue != null ? heigtMapScale : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.occlusionText, occlusionMap, occlusionMap.textureValue != null ? occlusionStrength : null);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailMaskText, detailMask);
                DoEmissionArea(material);
                EditorGUI.BeginChangeCheck();
                m_MaterialEditor.TextureScaleOffsetProperty(albedoMap);
                if (EditorGUI.EndChangeCheck())
                {
                    emissionMap.textureScaleAndOffset = albedoMap.textureScaleAndOffset; // Apply the main texture scale and offset to the emission texture as well, for Enlighten's sake
                }
                EditorGUILayout.Space();

                // Secondary properties
                GUILayout.Label(Styles.secondaryMapsText, EditorStyles.boldLabel);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailAlbedoText, detailAlbedoMap);
                m_MaterialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, detailNormalMap, detailNormalMapScale);
                m_MaterialEditor.TextureScaleOffsetProperty(detailAlbedoMap);
                m_MaterialEditor.ShaderProperty(uvSetSecondary, Styles.uvSetLabel.text);

                // Third properties
                GUILayout.Label(Styles.forwardText, EditorStyles.boldLabel);
                if (highlights != null)
                {
                    m_MaterialEditor.ShaderProperty(highlights, Styles.highlightsText);
                }
                if (reflections != null)
                {
                    m_MaterialEditor.ShaderProperty(reflections, Styles.reflectionsText);
                }

                EditorGUILayout.Space();

                GUILayout.Label(Styles.advancedText, EditorStyles.boldLabel);

                m_MaterialEditor.RenderQueueField();
            }
            if (blendModeChanged)
            {
                foreach (var obj in blendMode.targets)
                {
                    SetupMaterialWithBlendMode((Material)obj, (BlendMode)((Material)obj).GetFloat("_Mode"), true);
                }
            }

            m_MaterialEditor.EnableInstancingField();
            m_MaterialEditor.DoubleSidedGIField();
        }
示例#18
0
        public override void OnInspectorGUI()
        {
            bool targetChanged = false;

            if (target != state)
            {
                addStatePortionName = "";
                targetChanged       = true;
            }
            state = (State)target;

            if (targetChanged)
            {
                var layer     = state.profile.controller.layers[state.profile.controllerLayer];
                var animState = Utils.FindState(layer.stateMachine, state.stateName);
                clip = animState.motion as AnimationClip;

                var sb = new System.Text.StringBuilder();

                var events = AnimationUtility.GetAnimationEvents(clip);
                sb.AppendFormat("Events ({0}) ", events.Length).AppendLine();
                if (events.Length > 0)
                {
                    foreach (var ev in events)
                    {
                        sb.Append(string.Format("{0,4}", (int)FrameUtil.Time2Frame(ev.time))).Append("F ");
                        sb.Append(ev.functionName);
                        sb.AppendLine();
                    }
                }
                sb.AppendLine();

                var bindings = AnimationUtility.GetCurveBindings(clip);
                sb.AppendFormat("Bindings ({0})", bindings.Length).AppendLine();
                foreach (var binding in bindings)
                {
                    sb.Append("  ").Append(binding.path).Append(binding.path == "" ? "" : "/")
                    .Append("<").Append(binding.type.Name).Append(">.")
                    .Append(binding.propertyName).AppendLine();
                }

                summary = sb.ToString();
            }

            EditorGUI.BeginChangeCheck();

            EGL.LabelField("Name", state.stateName);
            EGL.LabelField("Frames", state.frames.ToString());

            bool lastGUIEnabled = GUI.enabled;

            GUI.enabled = false;
            EGL.ObjectField("Clip", clip, typeof(AnimationClip), allowSceneObjects: false);
            GUI.enabled = lastGUIEnabled;

            if (summary.Length > 0)
            {
                EGL.HelpBox(summary, MessageType.None);
            }

            state.tags = InspectTags(state.tags);
            EGL.Space();

            using (new EGL.VerticalScope(EditorStyles.helpBox)) {
                ++EditorGUI.indentLevel;
                InspectBehaviourList(state.behaviours);
                --EditorGUI.indentLevel;
                EGL.Space();
            }

            EGL.LabelField("Portions");
            var portions = state.portions;

            for (int i = 0; i < portions.Count; ++i)
            {
                var portion = portions[i];

                bool active = activePortions.Contains(portion);
                active = EGL.Foldout(active, portion.name);
                if (active)
                {
                    activePortions.Add(portion);
                }
                else
                {
                    activePortions.Remove(portion);
                }

                if (active)
                {
                    ++EditorGUI.indentLevel;

                    EGL.BeginHorizontal();
                    portion.name = EGL.TextField("Name", portion.name);
                    // GL.FlexibleSpace();
                    if (GL.Button("-", GUILayout.Width(30)))
                    {
                        portions.RemoveAt(i);
                        --i;
                    }
                    EGL.EndHorizontal();

                    portion.range      = EditorGUIUtil.FrameRangeSlider("Range", portion.range, state.frames);
                    portion.includeEnd = EGL.Toggle("Include nt>=1", portion.includeEnd);
                    portion.tags       = InspectTags(portion.tags);

                    using (new EGL.VerticalScope(EditorStyles.helpBox)) {
                        InspectBehaviourList(portion.behaviours);
                    }

                    --EditorGUI.indentLevel;
                }
            }

            EGL.Space();
            EGL.Space();
            EGL.BeginHorizontal();
            addStatePortionName = EGL.TextField(addStatePortionName);
            if (GUI.enabled && GL.Button("Add Portion", GL.Width(90)))
            {
                var portion = new StatePortion {
                    name = addStatePortionName
                };
                portions.Add(portion);

                addStatePortionName = "";
            }
            EGL.EndHorizontal();

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(state);
            }
        }
示例#19
0
        private void SceneBakeSettings()
        {
            ComponentBasedWorkflowButton();

            if (m_SettingsObject == null || m_SettingsObject.targetObject == null)
            {
                InitSceneBakeSettings();
            }

            m_SettingsObject.Update();

            EditorGUILayout.LabelField(s_Styles.m_AgentSizeHeader, EditorStyles.boldLabel);

            // Draw image
            const float kDiagramHeight   = 120.0f;
            Rect        agentDiagramRect = EditorGUILayout.GetControlRect(false, kDiagramHeight);

            NavMeshEditorHelpers.DrawAgentDiagram(agentDiagramRect, m_AgentRadius.floatValue, m_AgentHeight.floatValue, m_AgentClimb.floatValue, m_AgentSlope.floatValue);

            //Agent Settings
            var radius = EditorGUILayout.FloatField(s_Styles.m_AgentRadiusContent, m_AgentRadius.floatValue);

            if (radius >= 0.001f && !Mathf.Approximately(radius - m_AgentRadius.floatValue, 0.0f))
            {
                m_AgentRadius.floatValue = radius;
                // Update cellsize based on radius unless cellsize is set manually.
                if (m_ManualCellSize.boolValue == false)
                {
                    m_CellSize.floatValue = (2.0f * m_AgentRadius.floatValue) / 6.0f;
                }
            }
            // If radius is really small warn the user about it and instruct common use case for small radius.
            if (m_AgentRadius.floatValue < 0.05f && m_ManualCellSize.boolValue == false)
            {
                EditorGUILayout.HelpBox("The agent radius you've set is really small, this can slow down the build.\nIf you intended to allow the agent to move close to the borders and walls, please adjust voxel size in advaced settings to ensure correct bake.", MessageType.Warning);
            }

            var height = EditorGUILayout.FloatField(s_Styles.m_AgentHeightContent, m_AgentHeight.floatValue);

            if (height >= 0.001f && !Mathf.Approximately(height - m_AgentHeight.floatValue, 0.0f))
            {
                m_AgentHeight.floatValue = height;
            }

            const float kMaxSlopeAngle = 60.0f;

            EditorGUILayout.Slider(m_AgentSlope, 0.0f, kMaxSlopeAngle, s_Styles.m_AgentSlopeContent);
            if (m_AgentSlope.floatValue > kMaxSlopeAngle)
            {
                EditorGUILayout.HelpBox("The maximum slope should be set to less than " + kMaxSlopeAngle + " degrees to prevent NavMesh build artifacts on slopes. ", MessageType.Warning);
            }

            //Step height
            var newClimb = EditorGUILayout.FloatField(s_Styles.m_AgentClimbContent, m_AgentClimb.floatValue);

            if (newClimb >= 0.0f && !Mathf.Approximately(m_AgentClimb.floatValue - newClimb, 0.0f))
            {
                m_AgentClimb.floatValue = newClimb;
            }

            if (m_AgentClimb.floatValue > m_AgentHeight.floatValue)
            {
                // Actual clamping happens in NavMeshBuilder.cpp ConfigureConfig()
                EditorGUILayout.HelpBox("Step height should be less than agent height.\nClamping step height to " + m_AgentHeight.floatValue + " internally when baking.", MessageType.Warning);
            }

            // Detect when agent slope and step height conflict.
            float cs = m_CellSize.floatValue;
            float ch = cs * 0.5f; // From NavMeshBuilder.cpp:ConfigureConfig()
            int   walkableClimbVx = (int)Mathf.Ceil(m_AgentClimb.floatValue / ch);

            // Recast treats voxels whose neighbours min/max height difference is more than step height.
            float slopeHeightPerVoxel = Mathf.Tan(m_AgentSlope.floatValue / 180.0f * Mathf.PI) * cs;
            int   slopeVx             = (int)Mathf.Ceil(slopeHeightPerVoxel * 2.0f / ch);

            if (slopeVx > walkableClimbVx)
            {
                // Recommend new values.
                float betterSlope      = (walkableClimbVx * ch) / (cs * 2.0f);
                float betterSlopeAngle = Mathf.Atan(betterSlope) / Mathf.PI * 180.0f;
                float betterStep       = (slopeVx - 1) * ch;
                EditorGUILayout.HelpBox("Step Height conflicts with Max Slope. This makes some slopes unwalkable.\nConsider decreasing Max Slope to < " + betterSlopeAngle.ToString("0.0", CultureInfo.InvariantCulture.NumberFormat) + " degrees.\nOr, increase Step Height to > " + betterStep.ToString("0.00") + ".", MessageType.Warning);
            }

            EditorGUILayout.Space();

            EditorGUILayout.LabelField(s_Styles.m_OffmeshHeader, EditorStyles.boldLabel);

            //Drop height
            var newDropHeight = EditorGUILayout.FloatField(s_Styles.m_AgentDropContent, m_LedgeDropHeight.floatValue);

            if (newDropHeight >= 0.0f && !Mathf.Approximately(newDropHeight - m_LedgeDropHeight.floatValue, 0.0f))
            {
                m_LedgeDropHeight.floatValue = newDropHeight;
            }

            //Jump distance
            var newJumpDistance = EditorGUILayout.FloatField(s_Styles.m_AgentJumpContent, m_MaxJumpAcrossDistance.floatValue);

            if (newJumpDistance >= 0.0f && !Mathf.Approximately(newJumpDistance - m_MaxJumpAcrossDistance.floatValue, 0.0f))
            {
                m_MaxJumpAcrossDistance.floatValue = newJumpDistance;
            }

            EditorGUILayout.Space();

            //Advanced Settings
            m_Advanced = GUILayout.Toggle(m_Advanced, s_Styles.m_AdvancedHeader, EditorStyles.foldout);

            if (m_Advanced)
            {
                EditorGUI.indentLevel++;

                // Cell size
                var manualCellSize = EditorGUILayout.Toggle(s_Styles.m_ManualCellSizeContent, m_ManualCellSize.boolValue);
                if (manualCellSize != m_ManualCellSize.boolValue)
                {
                    m_ManualCellSize.boolValue = manualCellSize;
                    // When unchecking the manual control, revert to automatic value.
                    if (!manualCellSize)
                    {
                        m_CellSize.floatValue = (2.0f * m_AgentRadius.floatValue) / 6.0f;
                    }
                }

                EditorGUI.indentLevel++;
                using (new EditorGUI.DisabledScope(!m_ManualCellSize.boolValue))
                {
                    var cellSize = EditorGUILayout.FloatField(s_Styles.m_CellSizeContent, m_CellSize.floatValue);
                    if (cellSize > 0.0f && !Mathf.Approximately(cellSize - m_CellSize.floatValue, 0.0f))
                    {
                        m_CellSize.floatValue = Math.Max(0.01f, cellSize);
                    }
                    if (cellSize < 0.01f)
                    {
                        EditorGUILayout.HelpBox("The voxel size should be larger than 0.01.", MessageType.Warning);
                    }

                    float voxelsPerRadius = m_CellSize.floatValue > 0 ? (m_AgentRadius.floatValue / m_CellSize.floatValue) : 0.0f;
                    EditorGUILayout.LabelField(" ", voxelsPerRadius.ToString("0.00", CultureInfo.InvariantCulture.NumberFormat) + " voxels per agent radius", EditorStyles.miniLabel);

                    if (m_ManualCellSize.boolValue)
                    {
                        // Make sure these calculations match the ones in NavMeshBuilder.cpp ConfigureConfig()
                        const float kCellSizeToHeightRatio = 0.5f;
                        float       cellheight             = m_CellSize.floatValue * kCellSizeToHeightRatio;
                        // Some places inside Recast store height as a byte, make sure the ratio between
                        // the agent height and cell height does not exceed this limit.
                        if ((int)Mathf.Floor(m_AgentHeight.floatValue / cellheight) > 250)
                        {
                            float goodValue = (m_AgentHeight.floatValue / 250.0f) / kCellSizeToHeightRatio;
                            EditorGUILayout.HelpBox("The number of voxels per agent height is too high. This will reduce the accuracy of the navmesh. Consider using voxel size of at least " + goodValue.ToString("0.000", CultureInfo.InvariantCulture.NumberFormat) + ".", MessageType.Warning);
                        }

                        if (voxelsPerRadius < 1.0f)
                        {
                            float goodValue = m_AgentRadius.floatValue / 2.0f;
                            EditorGUILayout.HelpBox("The number of voxels per agent radius is too small. The agent may not avoid walls and ledges properly. Consider using a voxel size less than " + goodValue.ToString("0.000", CultureInfo.InvariantCulture.NumberFormat) + " (2 voxels per agent radius).", MessageType.Warning);
                        }
                        else if (voxelsPerRadius > 8.0f)
                        {
                            float goodValue = m_AgentRadius.floatValue / 8.0f;
                            EditorGUILayout.HelpBox("The number of voxels per agent radius is too high. It can cause excessive build times. Consider using voxel size closer to " + goodValue.ToString("0.000", CultureInfo.InvariantCulture.NumberFormat) + " (8 voxels per radius).", MessageType.Warning);
                        }
                    }

                    if (m_ManualCellSize.boolValue)
                    {
                        EditorGUILayout.HelpBox("Voxel size controls how accurately the navigation mesh is generated from the level geometry. A good voxel size is 2-4 voxels per agent radius. Making voxel size smaller will increase build time.", MessageType.None);
                    }
                }
                EditorGUI.indentLevel--;

                EditorGUILayout.Space();

                // Min region area
                var minRegionArea = EditorGUILayout.FloatField(s_Styles.m_MinRegionAreaContent, m_MinRegionArea.floatValue);
                if (minRegionArea >= 0.0f && minRegionArea != m_MinRegionArea.floatValue)
                {
                    m_MinRegionArea.floatValue = minRegionArea;
                }

                EditorGUILayout.Space();

                //Height mesh
                var accurate = EditorGUILayout.Toggle(s_Styles.m_AgentPlacementContent, m_AccuratePlacement.boolValue);
                if (accurate != m_AccuratePlacement.boolValue)
                {
                    m_AccuratePlacement.boolValue = accurate;
                }

                EditorGUI.indentLevel--;
            }

            m_SettingsObject.ApplyModifiedProperties();
            BakeButtons();
        }
示例#20
0
        public override void OnInspectorGUI()
        {
            transition = (Transition)target;

            EditorGUI.BeginChangeCheck();

            var fromName    = transition.fromState.GetStatePreview();
            var toName      = transition.targetInfo;
            var displayName = fromName + "->" + toName;

            EGL.LabelField(displayName);
            EGL.Space();

            FromStateFilterInspector(transition.profile, transition.fromState, ref fromStateRect);
            EGL.Space();

            transition.triggerRangeType = (TriggerRangeType)EGL.EnumPopup("Trigger Range Type", transition.triggerRangeType);

            if (transition.triggerRangeType == TriggerRangeType.Range)
            {
                transition.triggerRange = EditorGUIUtil.FrameRangeInput("Trigger Frame", transition.triggerRange);
            }
            if (transition.triggerRangeType == TriggerRangeType.FrameSinceExec || transition.triggerRangeType == TriggerRangeType.FrameSinceExecBefore)
            {
                transition.triggerFrameSinceExec = EGL.IntField("Frame Since Exec", transition.triggerFrameSinceExec);
            }

            transition.timeBuffer = EGL.FloatField("Time Buffer", transition.timeBuffer);

            using (new EGL.VerticalScope(EditorStyles.helpBox))  {
                var conds      = transition.conditions;
                var paramNames = transition.profile.parameters.Select(it => it.name).ToArray();

                using (new EGL.HorizontalScope()) {
                    EGL.LabelField("Conditions", EditorStyles.boldLabel);
                    GL.FlexibleSpace();
                    if (GL.Button("+", GL.Width(30)))
                    {
                        conds.Add(new Condition());
                    }
                }
                for (int i = 0; i < conds.Count; ++i)
                {
                    var cond = conds[i];

                    EGL.BeginHorizontal();

                    int condSelectIndex = Mathf.Max(0, Array.IndexOf(paramNames, cond.name));

                    // cond.name = EGL.TextField(cond.name, GL.Width(70));
                    condSelectIndex = EGL.Popup(condSelectIndex, paramNames);
                    cond.name       = paramNames[condSelectIndex];

                    var param = transition.profile.FindParam(cond.name);
                    if (param == null)
                    {
                        EGL.LabelField("!Doesn't exist");
                    }
                    else
                    {
                        var type = param.type;
                        if (type == ParamType.Bool)
                        {
                            cond.boolValue = EGL.Toggle(cond.boolValue);
                        }
                        else if (type != ParamType.Trigger) // Trigger 不需要编辑
                        {
                            cond.cmp = (Cmp)EGL.EnumPopup(cond.cmp, GL.Width(50));

                            if (type == ParamType.Int)
                            {
                                cond.intValue = EGL.IntField(cond.intValue);
                            }
                            else
                            {
                                cond.floatValue = EGL.FloatField(cond.floatValue);
                            }
                        }
                    }

                    GL.FlexibleSpace();
                    if (GL.Button("-", GL.Width(30)))
                    {
                        conds.RemoveAt(i);
                        --i;
                    }

                    EGL.EndHorizontal();
                }
            }

            EGL.LabelField("", GUI.skin.horizontalSlider);

            transition.actionType = (ActionType)EGL.EnumPopup("Action", transition.actionType);

            if (transition.actionType == ActionType.ChangeState)
            {
                EGL.BeginHorizontal();
                EGL.PrefixLabel("Target State");
                EditorGUIUtil.AutoCompleteList(transition.targetStateName, allStateNames,
                                               str => transition.targetStateName = str, ref targetStateRect);

                transition.targetStateFrame = EGL.IntField(transition.targetStateFrame, GL.Width(30));
                EGL.LabelField("F", GUILayout.Width(20));

                var targetState = transition.profile.FindState(transition.targetStateName);
                if (targetState)
                {
                    if (GL.Button("Focus"))
                    {
                        Utils.FocusEditingAnimation(transition.profile, targetState.stateName);
                    }
                }
                EGL.EndHorizontal();

                if (!targetState)
                {
                    EGL.HelpBox("No target state " + targetState, MessageType.Error);
                }
            }
            else // SendMessage
            {
                transition.messageName = EGL.TextField("Message Name", transition.messageName);

                EGL.Space();
                transition.messageParType = (MessageParType)EGL.EnumPopup("Parameter Type", transition.messageParType);

                switch (transition.messageParType)
                {
                case MessageParType.Int:
                    transition.messageParInt = EGL.IntField("Value", transition.messageParInt);
                    break;

                case MessageParType.Float:
                    transition.messageParFloat = EGL.FloatField("Value", transition.messageParFloat);
                    break;

                case MessageParType.Bool:
                    transition.messageParBool = EGL.Toggle("Value", transition.messageParBool);
                    break;
                }
            }

            transition.priority    = EGL.IntField("Priority", transition.priority);
            transition.shouldDelay = EGL.Toggle("Should Delay", transition.shouldDelay);
            if (transition.shouldDelay)
            {
                transition.delay = EGL.FloatField("Delay", transition.delay);
            }

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(transition);
            }

            if (transition.fromState.type == FromStateType.State)
            {
                EGL.LabelField("", GUI.skin.horizontalSlider);
                using (new EGL.VerticalScope(EditorStyles.helpBox)) {
                    EGL.LabelField("From State", EditorStyles.boldLabel);
                    ++EditorGUI.indentLevel;
                    var fromState = transition.profile.FindState(transition.fromState.stateOrTagName);
                    if (fromState)
                    {
                        GUI.enabled = false;
                        if (!fromStateEditor || fromStateEditor.target != fromState)
                        {
                            if (fromStateEditor)
                            {
                                DestroyImmediate(fromStateEditor);
                            }
                            fromStateEditor = Editor.CreateEditor(fromState);
                        }

                        fromStateEditor.OnInspectorGUI();
                        GUI.enabled = true;
                    }
                    --EditorGUI.indentLevel;
                }
            }
        }
示例#21
0
 void PrivacyModuleGUI()
 {
     DrawModuleHeader();
     EGL.Space();
     DrawModuleMainGUI();
 }
示例#22
0
        public override void OnPaintInspectorGUI()
        {
            EditorGUI.BeginChangeCheck();
            randomBrush.pickRandomTiles = EditorGUILayout.Toggle("Pick Random Tiles", randomBrush.pickRandomTiles);
            using (new EditorGUI.DisabledScope(!randomBrush.pickRandomTiles))
            {
                randomBrush.addToRandomTiles = EditorGUILayout.Toggle("Add To Random Tiles", randomBrush.addToRandomTiles);
            }

            EditorGUI.BeginChangeCheck();
            randomBrush.randomTileSetSize = EditorGUILayout.Vector3IntField("Tile Set Size", randomBrush.randomTileSetSize);
            if (EditorGUI.EndChangeCheck())
            {
                for (int i = 0; i < randomBrush.randomTileSets.Length; ++i)
                {
                    int sizeCount = randomBrush.randomTileSetSize.x * randomBrush.randomTileSetSize.y *
                                    randomBrush.randomTileSetSize.z;
                    randomBrush.randomTileSets[i].randomTiles = new TileBase[sizeCount];
                }
            }
            int randomTileSetCount = EditorGUILayout.DelayedIntField("Number of Tiles", randomBrush.randomTileSets != null ? randomBrush.randomTileSets.Length : 0);

            if (randomTileSetCount < 0)
            {
                randomTileSetCount = 0;
            }
            if (randomBrush.randomTileSets == null || randomBrush.randomTileSets.Length != randomTileSetCount)
            {
                Array.Resize(ref randomBrush.randomTileSets, randomTileSetCount);
                for (int i = 0; i < randomBrush.randomTileSets.Length; ++i)
                {
                    int sizeCount = randomBrush.randomTileSetSize.x * randomBrush.randomTileSetSize.y *
                                    randomBrush.randomTileSetSize.z;
                    if (randomBrush.randomTileSets[i].randomTiles == null ||
                        randomBrush.randomTileSets[i].randomTiles.Length != sizeCount)
                    {
                        randomBrush.randomTileSets[i].randomTiles = new TileBase[sizeCount];
                    }
                }
            }

            if (randomTileSetCount > 0)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Place random tiles.");

                for (int i = 0; i < randomTileSetCount; i++)
                {
                    EditorGUILayout.LabelField("Tile Set " + (i + 1));
                    for (int j = 0; j < randomBrush.randomTileSets[i].randomTiles.Length; ++j)
                    {
                        randomBrush.randomTileSets[i].randomTiles[j] = (TileBase)EditorGUILayout.ObjectField("Tile " + (j + 1), randomBrush.randomTileSets[i].randomTiles[j], typeof(TileBase), false, null);
                    }
                }
            }

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(randomBrush);
            }
        }
        public override void OnInspectorGUI()
        {
            //Bug fix: 1018456 Moved the HandleLowPassFilter method before updating the serializedObjects
            HandleLowPassFilter();

            serializedObject.Update();

            if (m_LowpassObject != null)
            {
                m_LowpassObject.Update();
            }


            UpdateWrappersAndLegend();

            EditorGUILayout.PropertyField(m_AudioClip, Styles.audioClipLabel);
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(m_OutputAudioMixerGroup, Styles.outputMixerGroupLabel);
            EditorGUILayout.PropertyField(m_Mute);
            if (AudioUtil.canUseSpatializerEffect)
            {
                EditorGUILayout.PropertyField(m_Spatialize, Styles.spatializeLabel);
                using (new EditorGUI.DisabledScope(!m_Spatialize.boolValue))
                {
                    EditorGUILayout.PropertyField(m_SpatializePostEffects, Styles.spatializePostEffectsLabel);
                }
            }
            EditorGUILayout.PropertyField(m_BypassEffects);
            if (targets.Any(t => (t as AudioSource).outputAudioMixerGroup != null))
            {
                using (new EditorGUI.DisabledScope(true))
                {
                    EditorGUILayout.PropertyField(m_BypassListenerEffects);
                }
            }
            else
            {
                EditorGUILayout.PropertyField(m_BypassListenerEffects);
            }
            EditorGUILayout.PropertyField(m_BypassReverbZones);

            EditorGUILayout.PropertyField(m_PlayOnAwake);
            EditorGUILayout.PropertyField(m_Loop);

            EditorGUILayout.Space();
            EditorGUIUtility.sliderLabels.SetLabels(Styles.priorityLeftLabel, Styles.priorityRightLabel);
            EditorGUILayout.IntSlider(m_Priority, 0, 256, Styles.priorityLabel);
            EditorGUIUtility.sliderLabels.SetLabels(null, null);
            EditorGUILayout.Space();
            EditorGUILayout.Slider(m_Volume, 0f, 1.0f, Styles.volumeLabel);
            EditorGUILayout.Space();
            EditorGUILayout.Slider(m_Pitch, -3.0f, 3.0f, Styles.pitchLabel);

            EditorGUILayout.Space();

            EditorGUIUtility.sliderLabels.SetLabels(Styles.panLeftLabel, Styles.panRightLabel);
            EditorGUILayout.Slider(m_Pan2D, -1f, 1f, Styles.panStereoLabel);
            EditorGUIUtility.sliderLabels.SetLabels(null, null);
            EditorGUILayout.Space();

            // 3D Level control
            EditorGUIUtility.sliderLabels.SetLabels(Styles.spatialLeftLabel, Styles.spatialRightLabel);
            AnimProp(Styles.spatialBlendLabel, m_AudioCurves[kSpatialBlendCurveID].curveProp, 0.0f, 1.0f, false);
            EditorGUIUtility.sliderLabels.SetLabels(null, null);
            EditorGUILayout.Space();

            // 3D Level control
            AnimProp(Styles.reverbZoneMixLabel, m_AudioCurves[kReverbZoneMixCurveID].curveProp, 0.0f, 1.1f, false);
            EditorGUILayout.Space();

            m_Expanded3D = EditorGUILayout.Foldout(m_Expanded3D, "3D Sound Settings", true);
            if (m_Expanded3D)
            {
                EditorGUI.indentLevel++;
                Audio3DGUI();
                EditorGUI.indentLevel--;
            }

            serializedObject.ApplyModifiedProperties();
            if (m_LowpassObject != null)
            {
                m_LowpassObject.ApplyModifiedProperties();
            }
        }
        private void DrawGUI()
        {
            if (m_RenderSettings == null || m_RenderSettings.targetObject != RenderSettings.GetRenderSettings())
            {
                InitSettings();
            }

            Material skyboxMaterial = m_SkyboxMaterial.objectReferenceValue as Material;

            m_bShowEnvironment = EditorGUILayout.FoldoutTitlebar(m_bShowEnvironment, Styles.env_top, true);

            if (m_bShowEnvironment)
            {
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(m_SkyboxMaterial, Styles.env_skybox_mat);
                if (skyboxMaterial && !EditorMaterialUtility.IsBackgroundMaterial(skyboxMaterial))
                {
                    EditorGUILayout.HelpBox(Styles.skyboxWarning.text, MessageType.Warning);
                }

                EditorGUILayout.PropertyField(m_Sun, Styles.env_skybox_sun);
                EditorGUILayout.Space();

                EditorGUILayout.LabelField(Styles.env_amb_top);
                EditorGUI.indentLevel++;

                EditorGUILayout.IntPopup(m_AmbientSource, Styles.kFullAmbientSource, Styles.kFullAmbientSourceValues, Styles.env_amb_src);
                switch ((AmbientMode)m_AmbientSource.intValue)
                {
                case AmbientMode.Trilight:
                {
                    EditorGUI.BeginChangeCheck();
                    Color newValueUp   = EditorGUILayout.ColorField(Styles.ambientUp, m_AmbientSkyColor.colorValue, true, false, true);
                    Color newValueMid  = EditorGUILayout.ColorField(Styles.ambientMid, m_AmbientEquatorColor.colorValue, true, false, true);
                    Color newValueDown = EditorGUILayout.ColorField(Styles.ambientDown, m_AmbientGroundColor.colorValue, true, false, true);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_AmbientSkyColor.colorValue     = newValueUp;
                        m_AmbientEquatorColor.colorValue = newValueMid;
                        m_AmbientGroundColor.colorValue  = newValueDown;
                    }
                }
                break;

                case AmbientMode.Flat:
                {
                    EditorGUI.BeginChangeCheck();
                    Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_AmbientSkyColor.colorValue = newValue;
                    }
                }
                break;

                case AmbientMode.Skybox:
                    if (skyboxMaterial == null)
                    {
                        EditorGUI.BeginChangeCheck();
                        Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true);
                        if (EditorGUI.EndChangeCheck())
                        {
                            m_AmbientSkyColor.colorValue = newValue;
                        }
                    }
                    else
                    {
                        // Ambient intensity - maximum is kEmissiveRGBMMax
                        EditorGUILayout.Slider(m_AmbientIntensity, 0.0F, 8.0F, Styles.env_amb_int);
                    }
                    break;
                }

                // ambient GI - realtime / baked
                bool realtimeGISupported = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Realtime);
                bool bakedGISupported    = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Baked);

                if ((m_EnabledBakedGI.boolValue || m_EnabledRealtimeGI.boolValue) && (bakedGISupported || realtimeGISupported))
                {
                    int[] modeVals = { 0, 1 };

                    if (m_EnabledBakedGI.boolValue && m_EnabledRealtimeGI.boolValue)
                    {
                        // if the user has selected the only state that is supported, then gray it out
                        using (new EditorGUI.DisabledScope(((m_AmbientLightingMode.intValue == 0) && realtimeGISupported && !bakedGISupported) || ((m_AmbientLightingMode.intValue == 1) && bakedGISupported && !realtimeGISupported)))
                        {
                            EditorGUILayout.IntPopup(m_AmbientLightingMode, Styles.AmbientLightingModes, modeVals, Styles.AmbientLightingMode);
                        }

                        // if they have selected a state that isnt supported, show dialog, and still make the box editable
                        if (((m_AmbientLightingMode.intValue == 0) && !realtimeGISupported) ||
                            ((m_AmbientLightingMode.intValue == 1) && !bakedGISupported))
                        {
                            EditorGUILayout.HelpBox("The following mode is not supported and will fallback on " + (((m_AmbientLightingMode.intValue == 0) && !realtimeGISupported) ? "Baked" : "Realtime"), MessageType.Warning);
                        }
                    }
                    // Show "Baked" if precomputed GI is disabled and "Realtime" if baked GI is disabled (but we don't wanna show the box if the whole mode is not supported.)
                    else if ((m_EnabledBakedGI.boolValue && bakedGISupported) || (m_EnabledRealtimeGI.boolValue && realtimeGISupported))
                    {
                        using (new EditorGUI.DisabledScope(true))
                        {
                            EditorGUILayout.IntPopup(Styles.AmbientLightingMode, m_EnabledBakedGI.boolValue ? 1 : 0, Styles.AmbientLightingModes, modeVals);
                        }
                    }
                }

                EditorGUI.indentLevel--;
                EditorGUILayout.Space();

                EditorGUILayout.LabelField(Styles.env_refl_top);
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(m_DefaultReflectionMode, Styles.env_refl_src);

                DefaultReflectionMode defReflectionMode = (DefaultReflectionMode)m_DefaultReflectionMode.intValue;
                switch (defReflectionMode)
                {
                case DefaultReflectionMode.FromSkybox:
                {
                    int[]        reflectionResolutionValuesArray = null;
                    GUIContent[] reflectionResolutionTextArray   = null;
                    ReflectionProbeEditor.GetResolutionArray(ref reflectionResolutionValuesArray, ref reflectionResolutionTextArray);
                    EditorGUILayout.IntPopup(m_DefaultReflectionResolution, reflectionResolutionTextArray, reflectionResolutionValuesArray, Styles.env_refl_res, GUILayout.MinWidth(40));
                }
                break;

                case DefaultReflectionMode.Custom:
                    EditorGUILayout.PropertyField(m_CustomReflection, Styles.customReflection);
                    break;
                }

                EditorGUILayout.PropertyField(m_ReflectionCompression, Styles.env_refl_cmp);
                EditorGUILayout.Slider(m_ReflectionIntensity, 0.0F, 1.0F, Styles.env_refl_int);
                EditorGUILayout.IntSlider(m_ReflectionBounces, 1, 5, Styles.env_refl_bnc);

                EditorGUI.indentLevel--;

                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }
        }