public void OnGUI(BiomeData biomeData) { bbList.listFoldout = EditorGUILayout.Foldout(bbList.listFoldout, "Biome blending list"); int length = bbList.blendEnabled.GetLength(0); int foldoutSize = 16; int leftPadding = 10; base.OnGUI(new Rect()); if (bbList.listFoldout) { float biomeSamplerNameWidth = BiomeSamplerName.GetNames().Max(n => EditorStyles.label.CalcSize(new GUIContent(n)).x); Rect r = GUILayoutUtility.GetRect(length * foldoutSize + biomeSamplerNameWidth, length * foldoutSize); using (DefaultGUISkin.Get()) { GUIStyle coloredLabel = new GUIStyle(EditorStyles.label); for (int i = 0; i < bbList.blendEnabled.GetLength(0); i++) { Rect labelRect = r; labelRect.y += i * foldoutSize; labelRect.x += leftPadding; GUI.Label(labelRect, biomeData.GetBiomeKey(i), coloredLabel); Rect toggleRect = r; toggleRect.size = new Vector2(foldoutSize, foldoutSize); toggleRect.y += i * foldoutSize; toggleRect.x += leftPadding + biomeSamplerNameWidth; bbList.blendEnabled[i] = GUI.Toggle(toggleRect, bbList.blendEnabled[i], GUIContent.none); } } } }
public static DefaultGUISkin Get() { if (defaultGUISkin == null) { defaultGUISkin = new DefaultGUISkin(); } defaultGUISkin.Init(); return(defaultGUISkin); }
protected void LoadStyle() { using (DefaultGUISkin.Get()) { buttonStyle = new GUIStyle("LargeButton"); buttonStyle.imagePosition = ImagePosition.ImageAbove; buttonStyle.alignment = TextAnchor.MiddleCenter; buttonStyle.fontSize = 12; selectedButtonStyle = new GUIStyle(buttonStyle); selectedButtonStyle.normal.background = selectedButtonStyle.focused.background; } }
public override void OnNodeGUI() { PWGUI.SpaceSkipAnchors(); EditorGUI.BeginChangeCheck(); { node.terrainHeightMultiplier = PWGUI.Slider("height multiplier: ", node.terrainHeightMultiplier, -1, 1); node.waterMultiplier = PWGUI.Slider("water multiplier: ", node.waterMultiplier, -1, 1); EditorGUILayout.LabelField("temperature limits:"); EditorGUILayout.BeginHorizontal(); { EditorGUIUtility.labelWidth = 25; node.minTemperature = EditorGUILayout.FloatField("from", node.minTemperature); node.maxTemperature = EditorGUILayout.FloatField("to", node.maxTemperature); } EditorGUILayout.EndHorizontal(); EditorGUIUtility.labelWidth = 120; if (node.internalTemperatureMap) { node.averageTemperature = EditorGUILayout.FloatField("average temperature", node.averageTemperature); } else { EditorGUILayout.LabelField("Input temperature map range"); using (DefaultGUISkin.Get()) EditorGUILayout.MinMaxSlider(ref node.minTemperatureMapInput, ref node.maxTemperatureMapInput, node.minTemperature, node.maxTemperature); EditorGUILayout.BeginHorizontal(); EditorGUIUtility.labelWidth = 25; node.minTemperatureMapInput = EditorGUILayout.FloatField("Min", node.minTemperatureMapInput); node.maxTemperatureMapInput = EditorGUILayout.FloatField("Max", node.maxTemperatureMapInput); EditorGUILayout.EndHorizontal(); } } if (EditorGUI.EndChangeCheck()) { node.UpdateTemperatureMap(); PWGUI.SetUpdateForField(PWGUIFieldType.Sampler2DPreview, 0, true); delayedChanges.UpdateValue(graphReloadKey); } if (node.localTemperatureMap != null) { PWGUI.Sampler2DPreview(node.localTemperatureMap as Sampler2D, false, FilterMode.Point); } if (!guiInitialized) { PWGUI.SetGradientForField(PWGUIFieldType.Sampler2DPreview, 0, temperatureGradient); PWGUI.SetDebugForField(PWGUIFieldType.Sampler2DPreview, 0, true); guiInitialized = true; } }
public override void OnLoadStyle() { using (DefaultGUISkin.Get()) { toolbarStyle = new GUIStyle("Toolbar"); toolbarSearchTextStyle = new GUIStyle("ToolbarSeachTextField"); toolbarSearchCancelButtonStyle = new GUIStyle("ToolbarSeachCancelButton"); } nodeSelectorTitleStyle = new GUIStyle("NodeSelectorTitle"); nodeSelectorCaseStyle = new GUIStyle("NodeSelectorCase"); panelBackgroundStyle = new GUIStyle("PanelBackground"); }
public override void OnInspectorGUI() { maps.name = EditorGUILayout.TextField("Name", maps.name); maps.type = (SurfaceMapsType)EditorGUILayout.EnumPopup("Surface complexity", maps.type); showNormalMaps.target = maps.type != SurfaceMapsType.Basic; showComplexMaps.target = maps.type == SurfaceMapsType.Complex; using (DefaultGUISkin.Get()) EditorGUILayout.BeginVertical(new GUIStyle("box")); { EditorGUILayout.LabelField("Surface Maps", EditorStyles.boldLabel); EditorGUI.BeginChangeCheck(); maps.albedo = EditorGUILayout.ObjectField("Albedo", maps.albedo, typeof(Texture2D), false) as Texture2D; if (EditorGUI.EndChangeCheck()) { TryCompleteOtherMaps(); } maps.normal = EditorGUILayout.ObjectField("Normal", maps.normal, typeof(Texture2D), false) as Texture2D; if (EditorGUILayout.BeginFadeGroup(showNormalMaps.faded)) { maps.opacity = EditorGUILayout.ObjectField("Opacity", maps.opacity, typeof(Texture2D), false) as Texture2D; maps.smoothness = EditorGUILayout.ObjectField("Smoothness", maps.smoothness, typeof(Texture2D), false) as Texture2D; maps.metallic = EditorGUILayout.ObjectField("Metallic", maps.metallic, typeof(Texture2D), false) as Texture2D; maps.roughness = EditorGUILayout.ObjectField("Roughness", maps.roughness, typeof(Texture2D), false) as Texture2D; } EditorGUILayout.EndFadeGroup(); if (EditorGUILayout.BeginFadeGroup(showComplexMaps.faded)) { maps.height = EditorGUILayout.ObjectField("Height", maps.height, typeof(Texture2D), false) as Texture2D; maps.emissive = EditorGUILayout.ObjectField("Emissive", maps.emissive, typeof(Texture2D), false) as Texture2D; maps.ambiantOcculison = EditorGUILayout.ObjectField("Ambiant Occlusion", maps.ambiantOcculison, typeof(Texture2D), false) as Texture2D; maps.secondAlbedo = EditorGUILayout.ObjectField("Second Albedo", maps.secondAlbedo, typeof(Texture2D), false) as Texture2D; maps.secondNormal = EditorGUILayout.ObjectField("Second Normal", maps.secondNormal, typeof(Texture2D), false) as Texture2D; maps.detailMask = EditorGUILayout.ObjectField("DetailMask", maps.detailMask, typeof(Texture2D), false) as Texture2D; maps.displacement = EditorGUILayout.ObjectField("Displacement", maps.displacement, typeof(Texture2D), false) as Texture2D; } EditorGUILayout.EndFadeGroup(); } EditorGUILayout.EndVertical(); }
void DrawBiomeSettingsBar(Rect rect) { GUI.SetNextControlName("Graph Name"); graph.name = EditorGUILayout.TextField("Biome name: ", graph.name); EditorGUILayout.Space(); using (DefaultGUISkin.Get()) biomeGraphList.DoLayoutList(); if (GUILayout.Button("Refresh")) { LoadGraphList(); } EditorGUILayout.Space(); biomeGraph.surfaceType = (BiomeSurfaceType)EditorGUILayout.EnumPopup("Biome surface type", biomeGraph.surfaceType); }
public void OnGUI(BiomeData biomeData) { base.OnGUI(new Rect()); if (biomeRepartitionPreview == null) { biomeRepartitionPreview = new Texture2D(previewTextureWidth, 1); UpdateBiomeRepartitionPreview(biomeData); } using (DefaultGUISkin.Get()) { reorderableSwitchDataList.DoLayoutList(); } EditorGUILayout.LabelField("repartition map: (" + localCoveragePercent.ToString("F1") + "%)"); Rect previewRect = EditorGUILayout.GetControlRect(GUILayout.ExpandWidth(true), GUILayout.Height(0)); previewRect.height = previewTextureHeight; GUILayout.Space(previewTextureHeight); PWGUI.TexturePreview(previewRect, biomeRepartitionPreview, false); PWGUI.SetScaleModeForField(PWGUIFieldType.Sampler2DPreview, -1, ScaleMode.StretchToFill); }