public override void OnNodeGUI() { var biomes = inputBiomes.GetValues <Biome>(); BiomeData biomeData = null; if (biomes.Count == 0 || biomes.First() == null) { EditorGUILayout.LabelField("biomes not connected !"); } else { biomeData = biomes.First().biomeDataReference; EditorGUIUtility.labelWidth = 120; maxBiomeBlendCount = EditorGUILayout.IntField("max blended biomes", maxBiomeBlendCount); } if (biomeData != null) { if ((biomePreviewFoldout = EditorGUILayout.Foldout(biomePreviewFoldout, "Biome id map"))) { if (biomeData.biomeIds != null) { PWGUI.BiomeMap2DPreview(biomeData, needUpdate || forceReload || biomeReloadRequested); } //TODO: biome 3D preview } } else { EditorGUILayout.LabelField("no biome data"); } if (biomeCoverageRecap = EditorGUILayout.Foldout(biomeCoverageRecap, "Biome coverage recap")) { foreach (var biomeCoverageKP in biomeData.biomeTree.GetBiomeCoverage()) { if (biomeCoverageKP.Value > 0) { EditorGUILayout.LabelField(biomeCoverageKP.Key.ToString(), (biomeCoverageKP.Value * 100).ToString("F2") + "%"); } } //TODO: exloit the biome switch tree datas } if (outputBlendedBiomeTerrain.terrainTextureArray == null || forceReload || GetReloadRequestType() == typeof(PWNodeBiomeSurface)) { LoadBiomeTexture2DArray(biomeData, false); } }
public override void OnNodeGUI() { BiomeData biomeData = GetBiomeData(); if (biomeData == null) { EditorGUILayout.LabelField("biomes not connected !"); return; } else { EditorGUIUtility.labelWidth = 120; EditorGUI.BeginChangeCheck(); biomeBlendPercent = PWGUI.Slider("Biome blend ratio: ", biomeBlendPercent, 0f, .5f); if (EditorGUI.EndChangeCheck()) { delayedChanges.UpdateValue(updateBiomeMapKey); } blendList.UpdateIfNeeded(biomeData); EditorGUI.BeginChangeCheck(); blendList.DrawList(biomeData, visualRect); if (EditorGUI.EndChangeCheck()) { delayedChanges.UpdateValue(updateBiomeMapKey); } } if (biomeData != null) { if (biomeData.biomeMap != null) { PWGUI.BiomeMap2DPreview(biomeData); } //TODO: biome 3D preview } else { EditorGUILayout.LabelField("no biome data"); } if (updateBiomeMap) { PWGUI.SetUpdateForField(1, true); updateBiomeMap = false; } var biomeCoverage = biomeData.biomeSwitchGraph.GetBiomeCoverage(); bool biomeCoverageError = biomeCoverage.Any(b => b.Value > 0 && b.Value < 1); GUIStyle biomeCoverageFoloutStyle = (biomeCoverageError) ? PWStyles.errorFoldout : EditorStyles.foldout; if (biomeCoverageRecap = EditorGUILayout.Foldout(biomeCoverageRecap, "Biome coverage recap", biomeCoverageFoloutStyle)) { if (biomeData != null && biomeData.biomeSwitchGraph != null) { foreach (var biomeCoverageKP in biomeCoverage) { if (biomeCoverageKP.Value > 0) { string paramName = biomeData.GetBiomeKey(biomeCoverageKP.Key); EditorGUILayout.LabelField(paramName, (biomeCoverageKP.Value * 100).ToString("F2") + "%"); } } } else { EditorGUILayout.LabelField("Null biome data/biome tree"); } } }