UnityEditor.TerrainInspector.ShowTrees C# (CSharp) Method

ShowTrees() public method

public ShowTrees ( ) : void
return void
        public void ShowTrees()
        {
            bool flag;
            this.LoadTreeIcons();
            GUI.changed = false;
            this.ShowUpgradeTreePrototypeScaleUI();
            GUILayout.Label(styles.trees, EditorStyles.boldLabel, new GUILayoutOption[0]);
            TreePainter.selectedTree = AspectSelectionGridImageAndText(TreePainter.selectedTree, this.m_TreeContents, 0x40, styles.gridListText, "No trees defined", out flag);
            if (TreePainter.selectedTree >= this.m_TreeContents.Length)
            {
                TreePainter.selectedTree = -1;
            }
            if (flag)
            {
                TerrainTreeContextMenus.EditTree(new MenuCommand(this.m_Terrain, TreePainter.selectedTree));
                GUIUtility.ExitGUI();
            }
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.ShowMassPlaceTrees();
            GUILayout.FlexibleSpace();
            this.MenuButton(styles.editTrees, "CONTEXT/TerrainEngineTrees", TreePainter.selectedTree);
            this.ShowRefreshPrototypes();
            GUILayout.EndHorizontal();
            if (TreePainter.selectedTree != -1)
            {
                GUILayout.Label(styles.settings, EditorStyles.boldLabel, new GUILayoutOption[0]);
                TreePainter.brushSize = EditorGUILayout.Slider(styles.brushSize, TreePainter.brushSize, 1f, 100f, new GUILayoutOption[0]);
                float valueInPercent = (3.3f - TreePainter.spacing) / 3f;
                float num2 = PercentSlider(styles.treeDensity, valueInPercent, 0.1f, 1f);
                if (num2 != valueInPercent)
                {
                    TreePainter.spacing = (1.1f - num2) * 3f;
                }
                GUILayout.Space(5f);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(EditorGUIUtility.labelWidth - 6f) };
                GUILayout.Label(styles.treeHeight, options);
                GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
                GUILayout.Label(styles.treeHeightRandomLabel, optionArray2);
                GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
                TreePainter.allowHeightVar = GUILayout.Toggle(TreePainter.allowHeightVar, styles.treeHeightRandomToggle, optionArray3);
                if (TreePainter.allowHeightVar)
                {
                    EditorGUI.BeginChangeCheck();
                    float minValue = TreePainter.treeHeight * (1f - TreePainter.treeHeightVariation);
                    float maxValue = TreePainter.treeHeight * (1f + TreePainter.treeHeightVariation);
                    EditorGUILayout.MinMaxSlider(ref minValue, ref maxValue, 0.01f, 2f, new GUILayoutOption[0]);
                    if (EditorGUI.EndChangeCheck())
                    {
                        TreePainter.treeHeight = (minValue + maxValue) * 0.5f;
                        TreePainter.treeHeightVariation = (maxValue - minValue) / (minValue + maxValue);
                    }
                }
                else
                {
                    TreePainter.treeHeight = EditorGUILayout.Slider(TreePainter.treeHeight, 0.01f, 2f, new GUILayoutOption[0]);
                    TreePainter.treeHeightVariation = 0f;
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(5f);
                TreePainter.lockWidthToHeight = EditorGUILayout.Toggle(styles.lockWidth, TreePainter.lockWidthToHeight, new GUILayoutOption[0]);
                if (TreePainter.lockWidthToHeight)
                {
                    TreePainter.treeWidth = TreePainter.treeHeight;
                    TreePainter.treeWidthVariation = TreePainter.treeHeightVariation;
                    TreePainter.allowWidthVar = TreePainter.allowHeightVar;
                }
                GUILayout.Space(5f);
                using (new EditorGUI.DisabledScope(TreePainter.lockWidthToHeight))
                {
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    GUILayoutOption[] optionArray4 = new GUILayoutOption[] { GUILayout.Width(EditorGUIUtility.labelWidth - 6f) };
                    GUILayout.Label(styles.treeWidth, optionArray4);
                    GUILayoutOption[] optionArray5 = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
                    GUILayout.Label(styles.treeWidthRandomLabel, optionArray5);
                    GUILayoutOption[] optionArray6 = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
                    TreePainter.allowWidthVar = GUILayout.Toggle(TreePainter.allowWidthVar, styles.treeWidthRandomToggle, optionArray6);
                    if (TreePainter.allowWidthVar)
                    {
                        EditorGUI.BeginChangeCheck();
                        float num5 = TreePainter.treeWidth * (1f - TreePainter.treeWidthVariation);
                        float num6 = TreePainter.treeWidth * (1f + TreePainter.treeWidthVariation);
                        EditorGUILayout.MinMaxSlider(ref num5, ref num6, 0.01f, 2f, new GUILayoutOption[0]);
                        if (EditorGUI.EndChangeCheck())
                        {
                            TreePainter.treeWidth = (num5 + num6) * 0.5f;
                            TreePainter.treeWidthVariation = (num6 - num5) / (num5 + num6);
                        }
                    }
                    else
                    {
                        TreePainter.treeWidth = EditorGUILayout.Slider(TreePainter.treeWidth, 0.01f, 2f, new GUILayoutOption[0]);
                        TreePainter.treeWidthVariation = 0f;
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.Space(5f);
                if (TerrainEditorUtility.IsLODTreePrototype(this.m_Terrain.terrainData.treePrototypes[TreePainter.selectedTree].m_Prefab))
                {
                    TreePainter.randomRotation = EditorGUILayout.Toggle(styles.treeRotation, TreePainter.randomRotation, new GUILayoutOption[0]);
                }
                else
                {
                    TreePainter.treeColorAdjustment = EditorGUILayout.Slider(styles.treeColorVar, TreePainter.treeColorAdjustment, 0f, 1f, new GUILayoutOption[0]);
                }
            }
        }