public void OnGUI(Layout layout, bool selected, int num, object parent) { #if VEGETATION_STUDIO_PRO VSProObjectsOutput vsOut = (VSProObjectsOutput)parent; VegetationPackagePro package = vsOut.package; //(VegetationPackagePro)vsOut.serializedPackage; VegetationSystemPro system = GameObject.FindObjectOfType <VegetationSystemPro>(); Layer layer = vsOut.baseLayers[num]; layout.margin = 20; layout.rightMargin = 5; layout.Par(20); input.DrawIcon(layout); if (package != null) { int itemInfoIndex = package.VegetationInfoList.FindIndex(i => i.VegetationItemID == layer.id); VegetationItemInfoPro itemInfo = itemInfoIndex >= 0 ? package.VegetationInfoList[itemInfoIndex] : null; Texture2D icon = null; if (itemInfo != null) { #if UNITY_EDITOR if (itemInfo.PrefabType == VegetationPrefabType.Mesh) { icon = AssetPreviewCache.GetAssetPreview(itemInfo.VegetationPrefab); } else { icon = AssetPreviewCache.GetAssetPreview(itemInfo.VegetationTexture); } #endif } layout.Icon(icon, rect: layout.Inset(20), frame: true, alphaBlend: false); layout.Inset(10); itemInfoIndex = layout.Popup(itemInfoIndex, objectNames, rect: layout.Inset(layout.field.width - 20 - 45)); if (itemInfoIndex >= 0) { layer.id = package.VegetationInfoList[itemInfoIndex].VegetationItemID; } } if (selected) { layout.Toggle(ref relativeHeight, "Relative Height"); layout.Toggle(ref rotate, "Rotate"); layout.Toggle(ref takeTerrainNormal, "Incline by Terrain"); layout.Par(); layout.Toggle(ref scale, "Scale", rect: layout.Inset(60)); layout.disabled = !scale; layout.Toggle(ref scaleY, rect: layout.Inset(18)); layout.Label("Y only", rect: layout.Inset(45)); //if (layout.lastChange) scaleU = false; layout.disabled = false; } #endif }
public static void DrawVegetationItemSelector(VegetationSystemPro vegetationSystemPro, VegetationPackagePro vegetationPackage, ref int selectedGridIndex, ref int vegIndex, ref int selectionCount, VegetationItemTypeSelection vegetationItemTypeSelection, int imageSize) { if (vegetationPackage == null) { return; } //AssetPreview.SetPreviewTextureCacheSize(100 + vegetationPackage.VegetationInfoList.Count); AssetPreview.SetPreviewTextureCacheSize(100 + vegetationSystemPro.GetMaxVegetationPackageItemCount()); List <int> vegetationItemIndexList = new List <int>(); for (int i = 0; i <= vegetationPackage.VegetationInfoList.Count - 1; i++) { VegetationItemInfoPro vegetationItemInfo = vegetationPackage.VegetationInfoList[i]; switch (vegetationItemTypeSelection) { case VegetationItemTypeSelection.AllVegetationItems: vegetationItemIndexList.Add(i); break; case VegetationItemTypeSelection.LargeItems: if (vegetationItemInfo.VegetationType == VegetationType.Objects || vegetationItemInfo.VegetationType == VegetationType.LargeObjects || vegetationItemInfo.VegetationType == VegetationType.Tree) { vegetationItemIndexList.Add(i); } break; case VegetationItemTypeSelection.Grass: if (vegetationItemInfo.VegetationType == VegetationType.Grass) { vegetationItemIndexList.Add(i); } break; case VegetationItemTypeSelection.Plants: if (vegetationItemInfo.VegetationType == VegetationType.Plant) { vegetationItemIndexList.Add(i); } break; case VegetationItemTypeSelection.Trees: if (vegetationItemInfo.VegetationType == VegetationType.Tree) { vegetationItemIndexList.Add(i); } break; case VegetationItemTypeSelection.Objects: if (vegetationItemInfo.VegetationType == VegetationType.Objects) { vegetationItemIndexList.Add(i); } break; case VegetationItemTypeSelection.LargeObjects: if (vegetationItemInfo.VegetationType == VegetationType.LargeObjects) { vegetationItemIndexList.Add(i); } break; } } selectionCount = vegetationItemIndexList.Count; VegetationInfoComparer vIc = new VegetationInfoComparer { VegetationInfoList = vegetationPackage.VegetationInfoList }; vegetationItemIndexList.Sort(vIc.Compare); GUIContent[] imageButtons = new GUIContent[vegetationItemIndexList.Count]; for (int i = 0; i <= vegetationItemIndexList.Count - 1; i++) { if (vegetationPackage.VegetationInfoList[vegetationItemIndexList[i]].PrefabType == VegetationPrefabType.Mesh) { imageButtons[i] = new GUIContent { image = AssetPreviewCache.GetAssetPreview(vegetationPackage.VegetationInfoList[vegetationItemIndexList[i]].VegetationPrefab) }; } else { imageButtons[i] = new GUIContent { image = AssetPreviewCache.GetAssetPreview(vegetationPackage.VegetationInfoList[vegetationItemIndexList[i]].VegetationTexture) }; } } int imageWidth = imageSize; int columns = Mathf.FloorToInt((EditorGUIUtility.currentViewWidth - 50) / imageWidth); int rows = Mathf.CeilToInt((float)imageButtons.Length / columns); int gridHeight = (rows) * imageWidth; if (selectedGridIndex > imageButtons.Length - 1) { selectedGridIndex = 0; } if (imageButtons.Length > 0) { selectedGridIndex = GUILayout.SelectionGrid(selectedGridIndex, imageButtons, columns, GUILayout.MaxWidth(columns * imageWidth), GUILayout.MaxHeight(gridHeight)); } vegIndex = vegetationItemIndexList.Count > selectedGridIndex ? vegetationItemIndexList[selectedGridIndex] : 0; }
//public static void DrawPrefabSelectorGrid(List<GameObject> prefabList, int imageSize, ref int selectedGridIndex) //{ // GUIContent[] imageButtons = new GUIContent[prefabList.Count]; // for (int i = 0; i <= prefabList.Count - 1; i++) // { // imageButtons[i] = new GUIContent // { // image = AssetPreviewCache.GetAssetPreview(prefabList[i]) // }; // } // int imageWidth = imageSize; // int columns = Mathf.FloorToInt((EditorGUIUtility.currentViewWidth - 50) / imageWidth); // int rows = Mathf.CeilToInt((float)imageButtons.Length / columns); // int gridHeight = (rows) * imageWidth; // if (imageButtons.Length > 0) // { // selectedGridIndex = GUILayout.SelectionGrid(selectedGridIndex, imageButtons, columns, GUILayout.MaxWidth(columns * imageWidth), GUILayout.MaxHeight(gridHeight)); // } //} //public static void DrawTextureSelectorGrid(List<Texture2D> textureList, int imageSize, ref int selectedGridIndex) //{ // GUIContent[] imageButtons = new GUIContent[textureList.Count]; // for (int i = 0; i <= textureList.Count - 1; i++) // { // imageButtons[i] = new GUIContent // { // image = AssetPreviewCache.GetAssetPreview(textureList[i]) // }; // } // int imageWidth = imageSize; // int columns = Mathf.FloorToInt((EditorGUIUtility.currentViewWidth - 50) / imageWidth); // int rows = Mathf.CeilToInt((float)imageButtons.Length / columns); // int gridHeight = (rows) * imageWidth; // if (imageButtons.Length > 0) // { // selectedGridIndex = GUILayout.SelectionGrid(selectedGridIndex, imageButtons, columns, GUILayout.MaxWidth(columns * imageWidth), GUILayout.MaxHeight(gridHeight)); // } //} public static void DrawVegetationItemSelector(VegetationPackagePro vegetationPackage, List <string> vegetationInfoIdList, int imageSize, ref string selectedVegetationItemId) { AssetPreview.SetPreviewTextureCacheSize(100 + vegetationPackage.VegetationInfoList.Count); VegetationInfoIDComparer vIc = new VegetationInfoIDComparer { VegetationInfoList = vegetationPackage.VegetationInfoList }; vegetationInfoIdList.Sort(vIc.Compare); GUIContent[] imageButtons = new GUIContent[vegetationInfoIdList.Count]; for (int i = 0; i <= vegetationInfoIdList.Count - 1; i++) { VegetationItemInfoPro vegetationItemInfo = vegetationPackage.GetVegetationInfo(vegetationInfoIdList[i]); if (vegetationItemInfo == null) { imageButtons[i] = new GUIContent { image = AssetPreviewCache.GetAssetPreview(null) }; } else { if (vegetationItemInfo.PrefabType == VegetationPrefabType.Mesh) { imageButtons[i] = new GUIContent { image = AssetPreviewCache.GetAssetPreview(vegetationItemInfo.VegetationPrefab) }; } else { imageButtons[i] = new GUIContent { image = AssetPreviewCache.GetAssetPreview(vegetationItemInfo.VegetationTexture) }; } } } int imageWidth = imageSize; int columns = Mathf.FloorToInt((EditorGUIUtility.currentViewWidth - imageWidth / 2f) / imageWidth); int rows = Mathf.CeilToInt((float)imageButtons.Length / columns); int gridHeight = (rows) * imageWidth; int selectedGridIndex = vegetationInfoIdList.IndexOf(selectedVegetationItemId); if (selectedGridIndex < 0) { selectedGridIndex = 0; } if (imageButtons.Length > 0) { selectedGridIndex = GUILayout.SelectionGrid(selectedGridIndex, imageButtons, columns, GUILayout.MaxWidth(columns * imageWidth), GUILayout.MaxHeight(gridHeight)); } selectedVegetationItemId = vegetationInfoIdList.Count > selectedGridIndex ? vegetationInfoIdList[selectedGridIndex] : ""; DrawSelectedName(selectedVegetationItemId, vegetationPackage); }
private void DrawEditTerrainTexturesInspector() { VegetationSystemPro vegetationSystemPro = _terrainSystemPro.VegetationSystemPro; GUILayout.BeginVertical("box"); if (vegetationSystemPro.VegetationPackageProList.Count == 0) { EditorGUILayout.HelpBox("You need to add a biome/vegetation package in order to edit splatmap rules.", MessageType.Warning); GUILayout.EndVertical(); return; } EditorGUILayout.LabelField("Select biome/vegetation package", LabelStyle); string[] packageNameList = new string[vegetationSystemPro.VegetationPackageProList.Count]; for (int i = 0; i <= vegetationSystemPro.VegetationPackageProList.Count - 1; i++) { if (vegetationSystemPro.VegetationPackageProList[i]) { packageNameList[i] = (i + 1).ToString() + " " + vegetationSystemPro.VegetationPackageProList[i].PackageName; } else { packageNameList[i] = "Not found"; } } _terrainSystemPro.VegetationPackageIndex = EditorGUILayout.Popup("Selected vegetation package", _terrainSystemPro.VegetationPackageIndex, packageNameList); VegetationPackagePro vegetationPackagePro = _terrainSystemPro.VegetationSystemPro.VegetationPackageProList[ _terrainSystemPro.VegetationPackageIndex]; GUILayout.BeginVertical("box"); if (GUILayout.Button("Read textures from terrain")) { _terrainSystemPro.GetSplatPrototypesFromTerrain(vegetationPackagePro); EditorUtility.SetDirty(vegetationPackagePro); } EditorGUILayout.HelpBox("This will replace textures in the VegetationPackage/biome with the textures from an added Unity Terrain", MessageType.Info); GUILayout.EndVertical(); GUILayout.BeginVertical("box"); if (GUILayout.Button("Apply textures to terrain")) { _terrainSystemPro.SetSplatPrototypes(vegetationPackagePro); } EditorGUILayout.HelpBox("This will replace textures on unity terrains with the textures in the selected biome.", MessageType.Info); GUILayout.EndVertical(); if (vegetationPackagePro.TerrainTextureCount > 0) { if (_terrainSystemPro.VegetationPackageTextureIndex > vegetationPackagePro.TerrainTextureCount) { _terrainSystemPro.VegetationPackageTextureIndex = 0; } GUILayout.BeginVertical("box"); EditorGUILayout.LabelField("Select terrain texture", LabelStyle); GUIContent[] textureImageButtons = new GUIContent[vegetationPackagePro.TerrainTextureSettingsList.Count]; for (int i = 0; i <= vegetationPackagePro.TerrainTextureSettingsList.Count - 1; i++) { textureImageButtons[i] = new GUIContent { image = AssetPreviewCache.GetAssetPreview( vegetationPackagePro.TerrainTextureList[i].Texture) }; } int imageWidth = 80; int columns = Mathf.FloorToInt((EditorGUIUtility.currentViewWidth - 50) / imageWidth); int rows = Mathf.CeilToInt((float)textureImageButtons.Length / columns); int gridHeight = (rows) * imageWidth; _terrainSystemPro.VegetationPackageTextureIndex = GUILayout.SelectionGrid( _terrainSystemPro.VegetationPackageTextureIndex, textureImageButtons, columns, GUILayout.MaxWidth(columns * imageWidth), GUILayout.MaxHeight(gridHeight)); GUILayout.EndVertical(); TerrainTextureInfo terrainTextureInfo = vegetationPackagePro.TerrainTextureList[_terrainSystemPro.VegetationPackageTextureIndex]; EditorGUI.BeginChangeCheck(); GUILayout.BeginVertical("box"); EditorGUILayout.LabelField("Terrain texture layer " + (_terrainSystemPro.VegetationPackageTextureIndex + 1), LabelStyle); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(new GUIContent("Texture", ""), LabelStyle, GUILayout.Width(64)); EditorGUILayout.LabelField(new GUIContent("Normal", ""), LabelStyle, GUILayout.Width(64)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); terrainTextureInfo.Texture = (Texture2D)EditorGUILayout.ObjectField(terrainTextureInfo.Texture, typeof(Texture2D), false, GUILayout.Height(64), GUILayout.Width(64)); terrainTextureInfo.TextureNormals = (Texture2D)EditorGUILayout.ObjectField(terrainTextureInfo.TextureNormals, typeof(Texture2D), false, GUILayout.Height(64), GUILayout.Width(64)); EditorGUILayout.EndHorizontal(); Rect space = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.Height(18)); terrainTextureInfo.TileSize = EditorGUI.Vector2Field(space, "Texture tile size", terrainTextureInfo.TileSize); if (terrainTextureInfo.TileSize.x < 1 || terrainTextureInfo.TileSize.y < 1) { EditorGUILayout.HelpBox("Texture tile size should be set for a higher value, normal is around 15.", MessageType.Warning); } GUILayout.EndVertical(); if (EditorGUI.EndChangeCheck()) { AssetUtility.SetTextureReadable(terrainTextureInfo.Texture, false); AssetUtility.SetTextureReadable(terrainTextureInfo.TextureNormals, true); EditorUtility.SetDirty(vegetationPackagePro); } } GUILayout.EndVertical(); }
private void DrawEditBiomeSplatmapsInspector() { VegetationSystemPro vegetationSystemPro = _terrainSystemPro.VegetationSystemPro; GUILayout.BeginVertical("box"); EditorGUILayout.LabelField("Select biome/vegetation package", LabelStyle); if (vegetationSystemPro.VegetationPackageProList.Count == 0) { EditorGUILayout.HelpBox("You need to add a biome/vegetation package in order to edit splatmap rules.", MessageType.Warning); GUILayout.EndVertical(); return; } string[] packageNameList = new string[vegetationSystemPro.VegetationPackageProList.Count]; for (int i = 0; i <= vegetationSystemPro.VegetationPackageProList.Count - 1; i++) { if (vegetationSystemPro.VegetationPackageProList[i]) { packageNameList[i] = (i + 1).ToString() + " " + vegetationSystemPro.VegetationPackageProList[i].PackageName; } else { packageNameList[i] = "Not found"; } } EditorGUI.BeginChangeCheck(); _terrainSystemPro.VegetationPackageIndex = EditorGUILayout.Popup("Selected vegetation package", _terrainSystemPro.VegetationPackageIndex, packageNameList); if (EditorGUI.EndChangeCheck()) { } EditorGUILayout.HelpBox( "Select the biome to edit. Press the Generate Splatmap button to apply settings to the terrains. Only unity terrains are affected by this.", MessageType.Info); GUILayout.EndVertical(); GUILayout.BeginVertical("box"); if (GUILayout.Button("Generate biome splatmaps")) { _terrainSystemPro.GenerateSplatMap(false); _terrainSystemPro.ShowTerrainHeatmap(false); SetAllVegetationPackagesDirty(); SetSceneDirty(); } EditorGUILayout.HelpBox( "You can lock textures. These will not be not be removed when generating the splat.", MessageType.Info); if (GUILayout.Button("Generate biome splatmaps - clear locked textures")) { _terrainSystemPro.GenerateSplatMap(true); _terrainSystemPro.ShowTerrainHeatmap(false); SetAllVegetationPackagesDirty(); SetSceneDirty(); } GUILayout.EndVertical(); GUILayout.BeginVertical("box"); EditorGUI.BeginChangeCheck(); _terrainSystemPro.VegetationSystemPro.ShowHeatMap = EditorGUILayout.Toggle("Show heatmap", _terrainSystemPro.VegetationSystemPro.ShowHeatMap); if (EditorGUI.EndChangeCheck()) { _terrainSystemPro.ShowTerrainHeatmap(_terrainSystemPro.VegetationSystemPro.ShowHeatMap); SceneView.RepaintAll(); } EditorGUILayout.HelpBox( "Enable to show the terrain distribution for the selected texture. Noise is an estimate and will not be the same as when generated.", MessageType.Info); GUILayout.EndVertical(); VegetationPackagePro vegetationPackagePro = _terrainSystemPro.VegetationSystemPro.VegetationPackageProList[ _terrainSystemPro.VegetationPackageIndex]; GUILayout.BeginVertical("box"); EditorGUILayout.HelpBox("Automatic terrain texture distribution is done based on the curve settings for height over water level and steepness(angle) of the terrain", MessageType.Info); GUILayout.EndVertical(); GUILayout.BeginVertical("box"); _terrainSystemPro.VegetationSystemPro.ShowTerrainTextures = EditorGUILayout.Toggle("Show terrain textures", _terrainSystemPro.VegetationSystemPro.ShowTerrainTextures); EditorGUILayout.HelpBox("The textures on the first terrain, not in the package will show in the list below. These are the actual textures used.", MessageType.Info); GUILayout.EndVertical(); //GUILayout.BeginVertical("box"); //EditorGUILayout.LabelField("Terrain height", LabelStyle); //_terrainSystem.GetVegetationPackage().AutomaticMaxCurveHeight = // EditorGUILayout.Toggle("Use max height in terrain", _terrainSystem.GetVegetationPackage().AutomaticMaxCurveHeight); //if (!_terrainSystem.GetVegetationPackage().AutomaticMaxCurveHeight) //{ // _terrainSystem.GetVegetationPackage().MaxCurveHeight = EditorGUILayout.FloatField("Max curve height", _terrainSystem.GetVegetationPackage().MaxCurveHeight); // EditorGUILayout.LabelField("Max possible terrain height: " + _terrainSystem.VegetationSystem.UnityTerrainData.size.y.ToString(CultureInfo.InvariantCulture) + " meters", LabelStyle); // if (GUILayout.Button("Calculate max height in terrain.")) // { // _terrainSystem.GetVegetationPackage().MaxCurveHeight = _terrainSystem.VegetationSystem.UnityTerrainData.MaxTerrainHeight; // EditorUtility.SetDirty(_terrainSystem.GetVegetationPackage()); // } // if (_terrainSystem.GetVegetationPackage().MaxCurveHeight < 1) // { // EditorGUILayout.HelpBox("You need to set or calculate terrain max height in order to set the max height value for the curves.", MessageType.Error); // } //} //EditorGUILayout.HelpBox("Max curve height sets the height at max curve value. For easiest control of the curves it should be set to just above max height in current terrain.", MessageType.Info); //GUILayout.EndVertical(); if (vegetationPackagePro.TerrainTextureCount > 0) { if (_terrainSystemPro.VegetationPackageTextureIndex > vegetationPackagePro.TerrainTextureCount) { _terrainSystemPro.VegetationPackageTextureIndex = 0; } EditorGUI.BeginChangeCheck(); GUILayout.BeginVertical("box"); EditorGUILayout.LabelField("Select terrain texture", LabelStyle); GUIContent[] textureImageButtons = new GUIContent[vegetationPackagePro.TerrainTextureSettingsList.Count]; for (int i = 0; i <= vegetationPackagePro.TerrainTextureSettingsList.Count - 1; i++) { if (_terrainSystemPro.VegetationSystemPro.ShowTerrainTextures) { textureImageButtons[i] = new GUIContent { image = AssetPreviewCache.GetAssetPreview(_terrainSystemPro.GetTerrainTexture(i)) }; } else { textureImageButtons[i] = new GUIContent { image = AssetPreviewCache.GetAssetPreview(vegetationPackagePro.TerrainTextureList[i].Texture) }; } } int imageWidth = 80; int columns = Mathf.FloorToInt((EditorGUIUtility.currentViewWidth - 50) / imageWidth); int rows = Mathf.CeilToInt((float)textureImageButtons.Length / columns); int gridHeight = (rows) * imageWidth; _terrainSystemPro.VegetationPackageTextureIndex = GUILayout.SelectionGrid(_terrainSystemPro.VegetationPackageTextureIndex, textureImageButtons, columns, GUILayout.MaxWidth(columns * imageWidth), GUILayout.MaxHeight(gridHeight)); GUILayout.EndVertical(); if (EditorGUI.EndChangeCheck()) { _terrainSystemPro.UpdateTerrainHeatmap(); } //if (_terrainSystem.VegetationSystem) //{ // GUILayout.BeginVertical("box"); // EditorGUILayout.LabelField("Visualize height/steepness in terrain", LabelStyle); // EditorGUI.BeginChangeCheck(); // bool overrideMaterial = EditorGUILayout.Toggle("Show heatmap", _terrainSystem.VegetationSystem.TerrainMaterialOverridden); // EditorGUILayout.HelpBox("Enabling heatmap will show the spawn area of the selected texture based on the current height and steepness curves.", MessageType.Info); // if (EditorGUI.EndChangeCheck()) // { // if (overrideMaterial) // { // _terrainSystem.UpdateHeatmapMaterial(_currentTextureItem); // _terrainSystem.VegetationSystem.OverrideTerrainMaterial(_terrainSystem.TerrainHeatMapMaterial); // EditorUtility.SetDirty(_terrainSystem.VegetationSystem); // } // else // { // _terrainSystem.VegetationSystem.RestoreTerrainMaterial(); // } // } // GUILayout.EndVertical(); // _terrainSystem.UpdateHeatmapMaterial(_currentTextureItem); //} GUILayout.BeginVertical("box"); TerrainTextureSettings terrainTextureSettings = vegetationPackagePro.TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex]; EditorGUI.BeginChangeCheck(); vegetationPackagePro.TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex].Enabled = EditorGUILayout.Toggle("Use with auto splat generation", vegetationPackagePro.TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex].Enabled); EditorGUI.BeginDisabledGroup( vegetationPackagePro.TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex].Enabled); vegetationPackagePro.TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex].LockTexture = EditorGUILayout.Toggle("Lock texture", vegetationPackagePro.TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex].LockTexture); EditorGUI.EndDisabledGroup(); EditorGUILayout.HelpBox("Locked textures are kept while generating splatmaps", MessageType.Info); _terrainSystemPro.ShowCurvesMenu = VegetationPackageEditorTools.DrawHeader("Height/Steepness rules", _terrainSystemPro.ShowCurvesMenu); if (_terrainSystemPro.ShowCurvesMenu) { EditorGUILayout.LabelField("Texture " + (_terrainSystemPro.VegetationPackageTextureIndex + 1).ToString() + " Height", LabelStyle, GUILayout.Width(150)); float height = vegetationSystemPro.VegetationSystemBounds.size.y - vegetationSystemPro.SeaLevel; _heightCurveEditor.MaxValue = height; if (_heightCurveEditor.EditCurve(vegetationPackagePro.TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex].TextureHeightCurve, this)) { _terrainSystemPro.UpdateTerrainHeatmap(); EditorUtility.SetDirty(vegetationPackagePro); } EditorGUILayout.LabelField("Texture " + (_terrainSystemPro.VegetationPackageTextureIndex + 1).ToString() + " Steepness", LabelStyle, GUILayout.Width(150)); if (_steepnessCurveEditor.EditCurve(vegetationPackagePro.TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex].TextureSteepnessCurve, this)) { _terrainSystemPro.UpdateTerrainHeatmap(); EditorUtility.SetDirty(vegetationPackagePro); } } ; _terrainSystemPro.ShowNoiseMenu = VegetationPackageEditorTools.DrawHeader("Noise/Concave/convex rules", _terrainSystemPro.ShowNoiseMenu); if (_terrainSystemPro.ShowNoiseMenu) { vegetationPackagePro.TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex] .UseNoise = EditorGUILayout.Toggle("Use perlin noise", vegetationPackagePro.TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex] .UseNoise); if (vegetationPackagePro.TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex] .UseNoise) { vegetationPackagePro.TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex] .InverseNoise = EditorGUILayout.Toggle("Inverse noise", vegetationPackagePro .TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex] .InverseNoise); vegetationPackagePro.TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex] .NoiseScale = EditorGUILayout.Slider("Noise scale", vegetationPackagePro .TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex].NoiseScale, 1, 200f); vegetationPackagePro.TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex] .NoiseOffset = EditorGUILayout.Vector2Field("Noise offset", vegetationPackagePro .TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex] .NoiseOffset); } vegetationPackagePro.TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex] .TextureWeight = EditorGUILayout.Slider("Texture weight", vegetationPackagePro.TerrainTextureSettingsList[_terrainSystemPro.VegetationPackageTextureIndex] .TextureWeight, 0, 5f); terrainTextureSettings.ConcaveEnable = EditorGUILayout.Toggle("Use concave rules", terrainTextureSettings.ConcaveEnable); terrainTextureSettings.ConvexEnable = EditorGUILayout.Toggle("Use convex rules", terrainTextureSettings.ConvexEnable); if (terrainTextureSettings.ConcaveEnable || terrainTextureSettings.ConvexEnable) { terrainTextureSettings.ConcaveMode = (ConcaveMode)EditorGUILayout.EnumPopup("Blend mode", terrainTextureSettings.ConcaveMode); EditorGUILayout.HelpBox( "Additive will add convex/concave areas in additon to areas selected by heigh/streepness. Blend will show areas that have all characteristics.", MessageType.Info); terrainTextureSettings.ConcaveAverage = EditorGUILayout.Toggle("Average samples", terrainTextureSettings.ConcaveAverage); terrainTextureSettings.ConcaveMinHeightDifference = EditorGUILayout.Slider( "Min height difference", terrainTextureSettings.ConcaveMinHeightDifference, 0.1f, 10f); terrainTextureSettings.ConcaveDistance = EditorGUILayout.Slider("Distance", terrainTextureSettings.ConcaveDistance, 0f, 20f); } } if (EditorGUI.EndChangeCheck()) { _terrainSystemPro.UpdateTerrainHeatmap(); EditorUtility.SetDirty(vegetationPackagePro); } GUILayout.EndVertical(); } else { GUILayout.BeginVertical("box"); EditorGUILayout.HelpBox( "Vegetation package has no textures", MessageType.Warning); GUILayout.EndVertical(); } }