public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            if (m_HardnessNoiseSettings == null)
            {
                m_HardnessNoiseSettings = ScriptableObject.CreateInstance <NoiseSettings>();
                m_HardnessNoiseSettings.Reset();
            }



            Erosion.HydraulicErosionSettings erosionSettings = ((Erosion.HydraulicEroder)m_Eroder).m_ErosionSettings;

            EditorGUI.BeginChangeCheck();

            commonUI.OnInspectorGUI(terrain, editContext);

            m_Eroder.OnInspectorGUI(terrain, editContext);

            commonUI.validationMessage = TerrainToolGUIHelper.ValidateAndGenerateSceneGUIMessage(terrain);

            if (EditorGUI.EndChangeCheck())
            {
                Save(true);
                TerrainToolsAnalytics.OnParameterChange();
            }
        }
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            EditorGUI.BeginChangeCheck();

            commonUI.OnInspectorGUI(terrain, editContext);

            m_ShowControls = TerrainToolGUIHelper.DrawHeaderFoldoutForBrush(Styles.controls, m_ShowControls, terraceToolProperties.SetDefaults);
            if (m_ShowControls)
            {
                EditorGUILayout.BeginVertical("GroupBox");
                {
                    terraceToolProperties.m_FeatureSize         = EditorGUILayout.Slider(Styles.terraceCount, terraceToolProperties.m_FeatureSize, 2.0f, 1000.0f);
                    terraceToolProperties.m_JitterTerraceCount  = EditorGUILayout.Slider(Styles.jitter, terraceToolProperties.m_JitterTerraceCount, 0.0f, 1.0f);
                    terraceToolProperties.m_BevelAmountInterior = EditorGUILayout.Slider(Styles.cornerWeight, terraceToolProperties.m_BevelAmountInterior, 0.0f, 1.0f);
                }
                EditorGUILayout.EndVertical();
            }

            if (EditorGUI.EndChangeCheck())
            {
                SaveSetting();
                Save(true);
                TerrainToolsAnalytics.OnParameterChange();
            }
        }
Exemplo n.º 3
0
        override public void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext, BrushSettings brushSettings)
        {
            EditorGUILayout.LabelField("Height", EditorStyles.boldLabel);

            heightBrushSize     = EditorGUILayout.Slider(new GUIContent("Brush Size [% of Main Brush]", ""), heightBrushSize, 0.0f, 200.0f);
            heightBrushStrength = EditorGUILayout.Slider(new GUIContent("Brush Strength", ""), heightBrushStrength, 0, 200);
        }
Exemplo n.º 4
0
        override public void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            EditorGUILayout.LabelField("Smooth", EditorStyles.boldLabel);

            smoothBrushSize     = EditorGUILayout.Slider(new GUIContent("Brush Size [% of Main Brush]", ""), smoothBrushSize, 0.0f, 300.0f);
            smoothBrushStrength = EditorGUILayout.Slider(new GUIContent("Brush Strength", ""), smoothBrushStrength, 0.0f, 100.0f);
        }
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            m_FlattenAll = EditorGUILayout.Toggle(new GUIContent("Flatten all", "If selected, it will traverse all neighbors and flatten them too"), m_FlattenAll);

            EditorGUI.BeginChangeCheck();
            GUILayout.BeginHorizontal();
            m_Height = EditorGUILayout.Slider(new GUIContent("Height", "You can set the Height property manually or you can shift-click on the terrain to sample the height at the mouse position (rather like the 'eyedropper' tool in an image editor)."), m_Height * terrain.terrainData.size.y, 0, terrain.terrainData.size.y) / terrain.terrainData.size.y;
            if (GUILayout.Button(new GUIContent("Flatten", "The Flatten button levels the whole terrain to the chosen height."), GUILayout.ExpandWidth(false)))
            {
                if (m_FlattenAll)
                {
                    FlattenAll();
                }
                else
                {
                    Flatten(terrain);
                }
            }
            GUILayout.EndHorizontal();
            if (EditorGUI.EndChangeCheck())
            {
                Save(true);
            }

            // show built-in brushes
            editContext.ShowBrushesGUI(5);
        }
Exemplo n.º 6
0
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            Styles styles = GetStyles();

            EditorGUI.BeginChangeCheck();
            {
                EditorGUI.BeginChangeCheck();
                float height    = Mathf.Abs(m_StampHeightTerrainSpace);
                bool  stampDown = (m_StampHeightTerrainSpace < 0.0f);
                height    = EditorGUILayout.PowerSlider(styles.height, height, 0, terrain.terrainData.size.y, 2.0f);
                stampDown = EditorGUILayout.Toggle(styles.down, stampDown);
                if (EditorGUI.EndChangeCheck())
                {
                    m_StampHeightTerrainSpace = (stampDown ? -height : height);
                }
            }
            m_MaxBlendAdd = EditorGUILayout.Slider(styles.maxadd, m_MaxBlendAdd, 0.0f, 1.0f);
            if (EditorGUI.EndChangeCheck())
            {
                Save(true);
            }

            // show built-in brushes
            int textureRez = terrain.terrainData.heightmapResolution;

            editContext.ShowBrushesGUI(5, BrushGUIEditFlags.All, textureRez);
            base.OnInspectorGUI(terrain, editContext);
        }
Exemplo n.º 7
0
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            base.OnInspectorGUI(terrain, editContext);

            // If size randomization is on, we use the min-max slider, otherwise, just a normal one.
            m_BrushSize.DrawInspectorGUI();
            m_JitterHandler.OnGuiLayout("Allow random variation of brush size");
        }
Exemplo n.º 8
0
        override public void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            EditorGUILayout.LabelField("Ridge Erode", EditorStyles.boldLabel);

            ridgeErodeBrushSize     = EditorGUILayout.Slider(new GUIContent("Brush Size [% of Main Brush]", ""), ridgeErodeBrushSize, 0.0f, 300.0f);
            ridgeErodeBrushStrength = EditorGUILayout.Slider(new GUIContent("Brush Strength", ""), ridgeErodeBrushStrength, 0.0f, 100.0f);
            erosionStrength         = EditorGUILayout.Slider(new GUIContent("Erosion Strength", ""), erosionStrength, 0.0f, 128.0f);
            mixStrength             = EditorGUILayout.Slider(new GUIContent("Sharpness", ""), mixStrength, 0.0f, 1.0f);
        }
Exemplo n.º 9
0
        override public void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            EditorGUILayout.LabelField("Bridge", EditorStyles.boldLabel);

            //"Controls the width of the bridge over the length of the stroke"
            widthProfile    = EditorGUILayout.CurveField(PathPaintStyles.widthProfileContent, widthProfile);
            heightProfile   = EditorGUILayout.CurveField(PathPaintStyles.heightProfileContent, heightProfile);
            strengthProfile = EditorGUILayout.CurveField(PathPaintStyles.strengthProfileContent, strengthProfile);
        }
        public void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            TerrainData terrainData  = terrain.terrainData;
            float       maxBrushSize = Mathf.Min(terrainData.size.x, terrainData.size.z) - 1;

            m_BrushSize.maxValue = Mathf.Min(maxBrushSize, m_BrushSize.maxValue);
            m_BrushSize.DrawInspectorGUI();
            //m_BrushSize = Mathf.RoundToInt(EditorGUILayout.Slider(styles.brushSize, m_BrushSize, 2, maxBrushSize));
        }
Exemplo n.º 11
0
 public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
 {
     EditorGUI.BeginChangeCheck();
     editContext.ShowBrushesGUI(0);
     if (EditorGUI.EndChangeCheck())
     {
         Save(true);
     }
 }
Exemplo n.º 12
0
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            EditorGUI.BeginChangeCheck();

            commonUI.OnInspectorGUI(terrain, editContext);

            s_showToolControls = TerrainToolGUIHelper.DrawHeaderFoldoutForBrush(Styles.controlHeader, s_showToolControls, () => { m_TargetHeight = 0; });

            if (s_showToolControls)
            {
                EditorGUILayout.BeginVertical("GroupBox");
                {
#if UNITY_2019_3_OR_NEWER
                    EditorGUI.BeginChangeCheck();
                    m_HeightSpace = (HeightSpace)EditorGUILayout.EnumPopup(Styles.space, m_HeightSpace);
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (m_HeightSpace == HeightSpace.Local)
                        {
                            m_TargetHeight = Mathf.Clamp(m_TargetHeight, terrain.GetPosition().y, terrain.terrainData.size.y + terrain.GetPosition().y);
                        }
                    }

                    if (m_HeightSpace == HeightSpace.Local)
                    {
                        m_TargetHeight = EditorGUILayout.Slider(Styles.height, m_TargetHeight - terrain.GetPosition().y, 0, terrain.terrainData.size.y) + terrain.GetPosition().y;
                    }
                    else
                    {
                        m_TargetHeight = EditorGUILayout.FloatField(Styles.height, m_TargetHeight);
                    }
#else
                    m_TargetHeight = EditorGUILayout.Slider(Styles.height, m_TargetHeight, 0, terrain.terrainData.size.y);
#endif
                    GUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button(Styles.flatten, GUILayout.ExpandWidth(false)))
                    {
                        Flatten(terrain);
                    }
                    if (GUILayout.Button(Styles.flattenAll, GUILayout.ExpandWidth(false)))
                    {
                        FlattenAll(terrain);
                    }
                    GUILayout.EndHorizontal();

                    if (EditorGUI.EndChangeCheck())
                    {
                        Save(true);
                        SaveSetting();
                        TerrainToolsAnalytics.OnParameterChange();
                    }
                }
                EditorGUILayout.EndVertical();
            }
        }
Exemplo n.º 13
0
 public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
 {
     EditorGUI.BeginChangeCheck();
     mode = (SmoothingDirections)EditorGUILayout.EnumPopup("Mode", mode);
     editContext.ShowBrushesGUI(0);
     if (EditorGUI.EndChangeCheck())
     {
         Save(true);
     }
 }
Exemplo n.º 14
0
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            Init();

            // brush GUI
            commonUI.OnInspectorGUI(terrain, editContext);

            EditorGUI.BeginChangeCheck();
            {
                toolSettings.showToolSettings = TerrainToolGUIHelper.DrawHeaderFoldoutForBrush(Styles.settings, toolSettings.showToolSettings, toolSettings.SetDefaults);
                if (toolSettings.showToolSettings)
                {
                    if (activeMesh == null)
                    {
                        EditorGUILayout.HelpBox(Styles.nullMeshString, MessageType.Warning);
                    }

                    activeMesh = EditorGUILayout.ObjectField(Styles.meshContent, activeMesh, typeof(Mesh), false) as Mesh;

                    GUILayout.Space(8f);

                    toolSettings.blendAmount = EditorGUILayout.Slider(Styles.blendAmount, toolSettings.blendAmount, 0, 1);

                    GUILayout.Space(8f);

                    EditorGUILayout.BeginHorizontal();
                    {
                        EditorGUILayout.PrefixLabel(Styles.transformSettings);

                        GUILayout.FlexibleSpace();

                        if (GUILayout.Button(Styles.resetTransformContent, GUILayout.ExpandWidth(false)))
                        {
                            toolSettings.rotation    = Quaternion.identity;
                            toolSettings.stampHeight = 0;
                            toolSettings.scale       = Vector3.one;
                        }
                    }
                    EditorGUILayout.EndHorizontal();

                    toolSettings.stampHeight = EditorGUILayout.FloatField(Styles.stampHeightContent, toolSettings.stampHeight);

                    toolSettings.scale = EditorGUILayout.Vector3Field(Styles.stampScaleContent, toolSettings.scale);

                    toolSettings.rotation = Quaternion.Euler(EditorGUILayout.Vector3Field(Styles.stampRotationContent, toolSettings.rotation.eulerAngles));
                }
            }

            if (EditorGUI.EndChangeCheck())
            {
                SaveSettings();
                Save(true);
                TerrainToolsAnalytics.OnParameterChange();
            }
        }
Exemplo n.º 15
0
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            EditorGUI.BeginChangeCheck();

            m_PinchAmount = EditorGUILayout.Slider(new GUIContent("Pinch Amount", "Negative values bulge, positive values pinch"), m_PinchAmount, -100.0f, 100.0f);
            editContext.ShowBrushesGUI(0);
            if (EditorGUI.EndChangeCheck())
            {
                Save(true);
            }
        }
Exemplo n.º 16
0
 public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
 {
     EditorGUI.BeginChangeCheck();
     height = EditorGUILayout.FloatField(new GUIContent("Target Height", "Shift to set"), height);
     mode   = (FlattenModes)EditorGUILayout.EnumPopup("Mode", mode);
     editContext.ShowBrushesGUI(0);
     if (EditorGUI.EndChangeCheck())
     {
         Save(true);
     }
 }
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            EditorGUI.BeginChangeCheck();

            commonUI.OnInspectorGUI(terrain, editContext);

            if (EditorGUI.EndChangeCheck())
            {
                Save(true);
            }
        }
Exemplo n.º 18
0
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            base.OnInspectorGUI(terrain, editContext);

            m_BrushStrength.DrawInspectorGUI();
            if (m_BrushStrength.expanded)
            {
                EditorGUI.indentLevel++;
                m_JitterHandler.OnGuiLayout("Allow random variation of brush intensity");
                EditorGUI.indentLevel--;
            }
        }
Exemplo n.º 19
0
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            EditorGUI.BeginChangeCheck();
            m_StampHeight = EditorGUILayout.Slider(new GUIContent("Stamp Height", "You can set the Stamp Height property manually or you can shift-click on the terrain to sample the height at the mouse position (rather like the “eyedropper” tool in an image editor)."), m_StampHeight * terrain.terrainData.size.y, 0, terrain.terrainData.size.y) / terrain.terrainData.size.y;
            if (EditorGUI.EndChangeCheck())
            {
                Save(true);
            }

            // show built-in brushes
            base.OnInspectorGUI(terrain, editContext);
        }
Exemplo n.º 20
0
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            EditorGUI.BeginChangeCheck();
            m_FeatureSize = EditorGUILayout.Slider(new GUIContent("Detail Size", "Larger value will affect larger features, smaller values will affect smaller features"), m_FeatureSize, 1.0f, 100.0f);

            editContext.ShowBrushesGUI(0);

            if (EditorGUI.EndChangeCheck())
            {
                Save(true);
            }
        }
Exemplo n.º 21
0
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            EditorGUI.BeginChangeCheck();

            commonUI.OnInspectorGUI(terrain, editContext);

            m_TargetStrength = EditorGUILayout.Slider(Styles.targetStrengthTxt, m_TargetStrength, 0.0f, 1.0f);

            if (m_TemplateMaterialEditor == null)
            {
                m_TemplateMaterialEditor = Editor.CreateEditor(terrain.materialTemplate);                                   // fix - 1306604
            }
#if UNITY_2019_2_OR_NEWER
            // Material GUI
            m_ShowMaterialEditor = TerrainToolGUIHelper.DrawHeaderFoldout(Styles.materialControls, m_ShowMaterialEditor);
            if (m_ShowMaterialEditor)
            {
                Editor.DrawFoldoutInspector(terrain.materialTemplate, ref m_TemplateMaterialEditor);
#if UNITY_2021_2_OR_NEWER
                TerrainInspectorUtility.TerrainShaderValidationGUI(terrain.materialTemplate);
#endif
                EditorGUILayout.Space();
            }
#endif
            // Layers GUI
            m_ShowLayerInspector = TerrainToolGUIHelper.DrawHeaderFoldout(Styles.layerControls, m_ShowLayerInspector);
            if (m_ShowLayerInspector)
            {
                LayersGUI(terrain, editContext);

#if UNITY_2019_2_OR_NEWER
                m_ShowLayerProperties = TerrainToolGUIHelper.DrawHeaderFoldout(Styles.layerProperties, m_ShowLayerProperties);
                if (m_ShowLayerProperties)
                {
                    if (!m_LayerRepaintFlag)
                    {
                        TerrainLayerUtility.ShowTerrainLayerGUI(terrain, m_SelectedTerrainLayer, ref m_SelectedTerrainLayerInspector,
                                                                (m_TemplateMaterialEditor as MaterialEditor)?.customShaderGUI as ITerrainLayerCustomUI);
                    }
                    else
                    {
                        m_LayerRepaintFlag = false; // flag to skip layer property repaint when layer list modified
                    }
                }
#endif
            }

            if (EditorGUI.EndChangeCheck())
            {
                TerrainToolsAnalytics.OnParameterChange();
            }
        }
Exemplo n.º 22
0
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            EditorGUI.BeginChangeCheck();
            m_StampHeight = EditorGUILayout.Slider(new GUIContent("Stamp Height", "You can set the Stamp Height manually or you can hold shift and mouse wheel on the terrain to adjust it."), m_StampHeight * terrain.terrainData.size.y, 0, terrain.terrainData.size.y) / terrain.terrainData.size.y;
            if (EditorGUI.EndChangeCheck())
            {
                Save(true);
            }

            // show built-in brushes
            editContext.ShowBrushesGUI(5);
            base.OnInspectorGUI(terrain, editContext);
        }
Exemplo n.º 23
0
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            EditorGUI.BeginChangeCheck();
            m_FeatureSize         = EditorGUILayout.Slider(new GUIContent("Terrace Count", "Larger value will result in more terraces"), m_FeatureSize, 2.0f, 1000.0f);
            m_BevelAmountInterior = EditorGUILayout.Slider(new GUIContent("Interior Corner Weight", "Amount to retain the original height in each interior corner of the terrace steps"), m_BevelAmountInterior, 0.0f, 1.0f);

            editContext.ShowBrushesGUI(0);

            if (EditorGUI.EndChangeCheck())
            {
                Save(true);
            }
        }
Exemplo n.º 24
0
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            editContext.ShowBrushesGUI(0);

            EditorGUI.BeginChangeCheck();

            m_TwistAmount = EditorGUILayout.Slider(new GUIContent("Twist Amount", "Negative values twist clockwise, Positive values twist counter clockwise"), m_TwistAmount, 0.0f, 100.0f);

            if (EditorGUI.EndChangeCheck())
            {
                Save(true);
            }
        }
Exemplo n.º 25
0
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            EditorGUI.BeginChangeCheck();
//			m_ErosionStrength = EditorGUILayout.Slider(new GUIContent("Erosion strength"), m_ErosionStrength, 1, 128.0f);
            m_MixStrength = EditorGUILayout.Slider(new GUIContent("Feature Sharpness"), m_MixStrength, 0, 1);

            editContext.ShowBrushesGUI(0);

            if (EditorGUI.EndChangeCheck())
            {
                Save(true);
            }
        }
Exemplo n.º 26
0
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            editContext.ShowBrushesGUI(0);

            EditorGUI.BeginChangeCheck();

            m_FeatureSize = EditorGUILayout.Slider(new GUIContent("Terrace Count", "Larger value will result in more terraces"), m_FeatureSize, 1.0f, 300.0f);

            if (EditorGUI.EndChangeCheck())
            {
                Save(true);
            }
        }
Exemplo n.º 27
0
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            Styles styles = GetStyles();

            EditorGUI.BeginChangeCheck();
            m_direction = EditorGUILayout.Slider(styles.direction, m_direction, -1.0f, 1.0f);
            if (EditorGUI.EndChangeCheck())
            {
                Save(true);
            }

            editContext.ShowBrushesGUI(5);
        }
Exemplo n.º 28
0
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            EditorGUI.BeginChangeCheck();

            //m_SmudgeAmount = EditorGUILayout.Slider(new GUIContent("Smudge Amount", ""), m_SmudgeAmount, 0.0f, 100.0f);

            editContext.ShowBrushesGUI(0);

            if (EditorGUI.EndChangeCheck())
            {
                Save(true);
            }
        }
Exemplo n.º 29
0
        private void AddPreviewMeshFromHeightmap(Terrain terrain, IOnInspectorGUI editContext)
        {
            if (!brushPreview3d.IsValid())
            {
                return;
            }

            int previewSize = 256;

            Texture2D heightmap = brushPreview3d.meshPreviewTexture;
            Mesh      mesh      = brushPreview3d.mesh;
            Material  material  = brushPreview3d.material;

            Bounds bounds = mesh.bounds;

            /* center view:
             * m_PreviewUtility.camera.clearFlags = CameraClearFlags.Color;
             *
             * float halfSize = bounds.extents.magnitude;
             * float distance = 2.0f * halfSize;
             *
             * m_PreviewUtility.camera.transform.position = -Vector3.forward * distance;
             * m_PreviewUtility.camera.transform.rotation = Quaternion.identity;
             * m_PreviewUtility.camera.nearClipPlane = distance - halfSize * 1.1f;
             * m_PreviewUtility.camera.farClipPlane = distance + halfSize * 1.1f;
             *
             * m_PreviewUtility.lights[0].intensity = 1.4f;
             * m_PreviewUtility.lights[0].transform.rotation = Quaternion.Euler(40f, 60f, 0);
             * m_PreviewUtility.lights[1].intensity = 1.4f;
             *
             * //m_PreviewUtility.camera.transform.position += Vector3.up * distance;
             * //m_PreviewUtility.camera.transform.LookAt(bounds.center);
             */

            Rect previewRect = new Rect(0, 0, previewSize, previewSize);

            this.m_PreviewUtility.BeginStaticPreview(previewRect);

            float      angle      = m_BrushRotation;
            Quaternion quaternion = Quaternion.Euler(0f, angle, 0f);
            Vector3    pos        = quaternion * -bounds.center;

            m_PreviewUtility.DrawMesh(mesh, pos, quaternion, material, 0);

            m_PreviewUtility.camera.Render();

            Texture previewImage = this.m_PreviewUtility.EndStaticPreview();

            // draw image as label
            GUILayout.Label(previewImage);
        }
        public override void OnInspectorGUI(Terrain terrain, IOnInspectorGUI editContext)
        {
            EditorGUI.BeginChangeCheck();

            commonUI.OnInspectorGUI(terrain, editContext);
            m_Eroder.OnInspectorGUI();

            commonUI.validationMessage = ValidateAndGenerateUserMessage(terrain);

            if (EditorGUI.EndChangeCheck())
            {
                Save(true);
            }
        }