Ejemplo n.º 1
0
        public void DrawList(BiomeData biomeData, Rect position)
        {
            listFoldout = EditorGUILayout.Foldout(listFoldout, "Biome blending list");

            int length      = blendEnabled.GetLength(0);
            int foldoutSize = 16;
            int leftPadding = 10;

            if (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 < 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;
                        blendEnabled[i] = GUI.Toggle(toggleRect, blendEnabled[i], GUIContent.none);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void LoadStyles()
        {
            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");
        }
Ejemplo n.º 3
0
        public override void OnNodeGUI()
        {
            GUILayout.Space(GUI.skin.label.lineHeight * 3);

            EditorGUI.BeginChangeCheck();
            {
                terrainHeightMultiplier = PWGUI.Slider("height multiplier: ", terrainHeightMultiplier, -1, 1);
                waterMultiplier         = PWGUI.Slider("water multiplier: ", waterMultiplier, -1, 1);

                EditorGUILayout.LabelField("temperature limits:");
                EditorGUILayout.BeginHorizontal();
                {
                    EditorGUIUtility.labelWidth = 30;
                    minTemperature = EditorGUILayout.FloatField("from", minTemperature);
                    maxTemperature = EditorGUILayout.FloatField("to", maxTemperature);
                }
                EditorGUILayout.EndHorizontal();
                EditorGUIUtility.labelWidth = 120;
                if (internalTemperatureMap)
                {
                    averageTemperature = EditorGUILayout.FloatField("average temperature", averageTemperature);
                }
                else
                {
                    EditorGUILayout.LabelField("Input temperature map range");
                    using (DefaultGUISkin.Get())
                        EditorGUILayout.MinMaxSlider(ref minTemperatureMapInput, ref maxTemperatureMapInput, minTemperature, maxTemperature);
                }
            }
            if (EditorGUI.EndChangeCheck())
            {
                UpdateTemperatureMap();
            }

            if (localTemperatureMap != null)
            {
                PWGUI.Sampler2DPreview(localTemperatureMap as Sampler2D, false, FilterMode.Point);
                PWGUI.SetGradientForField(2, temperatureGradient);
                PWGUI.SetDebugForField(2, true);
            }

            if (updateTemperatureMap)
            {
                PWGUI.SetUpdateForField(2, true);
                updateTemperatureMap = false;
            }
        }
Ejemplo n.º 4
0
    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();
    }
Ejemplo n.º 5
0
    void DrawBiomeSettingsBar(Rect rect)
    {
        settingsBar.DrawTerrainPreview(rect);

        GUI.SetNextControlName("PWName");
        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);
    }
Ejemplo n.º 6
0
        public void OnGUI(BiomeData biomeData)
        {
            PWGUI.StartFrame(new Rect(0, 0, 0, 0));

            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(-1, ScaleMode.StretchToFill);
        }