Exemple #1
0
    public override void OnBodyGUI()
    {
        base.OnBodyGUI();
        TextureNode node = target as TextureNode;

        switch (node.landLayer)
        {
        case NodeVariables.Texture.LandLayerEnum.Ground:
            node.groundEnum = (TerrainSplat.Enum)EditorGUILayout.EnumPopup("Texture", node.groundEnum);
            break;

        case NodeVariables.Texture.LandLayerEnum.Biome:
            node.biomeEnum = (TerrainBiome.Enum)EditorGUILayout.EnumPopup("Texture", node.biomeEnum);
            break;

        case NodeVariables.Texture.LandLayerEnum.Alpha:
            node.alphaEnum = (NodeVariables.Texture.AlphaEnum)EditorGUILayout.EnumPopup("Texture", node.alphaEnum);
            break;

        case NodeVariables.Texture.LandLayerEnum.Topology:
            node.topologyLayer = (TerrainTopology.Enum)EditorGUILayout.EnumPopup("Topology", node.topologyLayer);
            node.topologyEnum  = (NodeVariables.Texture.TopologyEnum)EditorGUILayout.EnumPopup("Texture", node.topologyEnum);
            break;
        }
        node.Texture.LandLayer       = (int)node.landLayer;
        node.Texture.TopologyLayer   = TerrainTopology.TypeToIndex((int)node.topologyLayer);
        node.Texture.GroundTexture   = (int)node.groundEnum;
        node.Texture.BiomeTexture    = (int)node.biomeEnum;
        node.Texture.AlphaTexture    = (int)node.alphaEnum;
        node.Texture.TopologyTexture = (int)node.topologyEnum;
    }
Exemple #2
0
    private void OnGUI()
    {
        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false);

        GUIContent[] layersOptionsMenu = new GUIContent[4];
        layersOptionsMenu[0] = new GUIContent("Ground");
        layersOptionsMenu[1] = new GUIContent("Biome");
        layersOptionsMenu[2] = new GUIContent("Alpha");
        layersOptionsMenu[3] = new GUIContent("Topology");

        EditorGUI.BeginChangeCheck();
        layerIndex = GUILayout.Toolbar(layerIndex, layersOptionsMenu, EditorStyles.toolbarButton);
        if (EditorGUI.EndChangeCheck())
            TerrainManager.ChangeLayer((TerrainManager.LayerType)layerIndex, TerrainTopology.TypeToIndex((int)layers.Topologies));

        if (layerIndex != (int)TerrainManager.CurrentLayerType)
            layerIndex = (int)TerrainManager.CurrentLayerType;

        switch ((TerrainManager.LayerType)layerIndex)
        {
            case TerrainManager.LayerType.Ground:
                Functions.TextureSelect(TerrainManager.CurrentLayerType, ref layers);
                Functions.AreaSelect();
                Functions.LayerTools(TerrainManager.CurrentLayerType, TerrainSplat.TypeToIndex((int)layers.Ground));
                Functions.RotateTools(TerrainManager.CurrentLayerType);
                Functions.RiverTools(TerrainManager.CurrentLayerType, TerrainSplat.TypeToIndex((int)layers.Ground), ref aboveTerrain);
                Functions.SlopeTools(TerrainManager.CurrentLayerType, TerrainSplat.TypeToIndex((int)layers.Ground), ref slopesInfo);
                Functions.HeightTools(TerrainManager.CurrentLayerType, TerrainSplat.TypeToIndex((int)layers.Ground), ref heightsInfo);
                break;
            case TerrainManager.LayerType.Biome:
                Functions.TextureSelect(TerrainManager.CurrentLayerType, ref layers);
                Functions.AreaSelect();
                Functions.LayerTools(TerrainManager.CurrentLayerType, TerrainBiome.TypeToIndex((int)layers.Biome));
                Functions.RotateTools(TerrainManager.CurrentLayerType);
                Functions.RiverTools(TerrainManager.CurrentLayerType, TerrainBiome.TypeToIndex((int)layers.Biome), ref aboveTerrain);
                Functions.SlopeTools(TerrainManager.CurrentLayerType, TerrainBiome.TypeToIndex((int)layers.Biome), ref slopesInfo);
                Functions.HeightTools(TerrainManager.CurrentLayerType, TerrainBiome.TypeToIndex((int)layers.Biome), ref heightsInfo);
                break;
            case TerrainManager.LayerType.Alpha:
                Functions.LayerTools((TerrainManager.LayerType)layerIndex, 0, 1);
                Functions.AreaSelect();
                Functions.RotateTools((TerrainManager.LayerType)layerIndex);
                Functions.RiverTools((TerrainManager.LayerType)layerIndex, 0, ref aboveTerrain, 1);
                Functions.SlopeTools((TerrainManager.LayerType)layerIndex, 0, ref slopesInfo, 1);
                Functions.HeightTools((TerrainManager.LayerType)layerIndex, 0, ref heightsInfo, 1);
                break;
            case TerrainManager.LayerType.Topology:
                Functions.TopologyLayerSelect(ref layers);
                Functions.AreaSelect();
                Functions.LayerTools(TerrainManager.CurrentLayerType, 0, TerrainTopology.TypeToIndex((int)layers.Topologies));
                Functions.RotateTools(TerrainManager.CurrentLayerType, TerrainTopology.TypeToIndex((int)layers.Topologies));
                Functions.TopologyTools();
                Functions.RiverTools(TerrainManager.CurrentLayerType, 0, ref aboveTerrain, 1, TerrainTopology.TypeToIndex((int)layers.Topologies));
                Functions.SlopeTools(TerrainManager.CurrentLayerType, 0, ref slopesInfo, 1, TerrainTopology.TypeToIndex((int)layers.Topologies));
                Functions.HeightTools(TerrainManager.CurrentLayerType, 0, ref heightsInfo, 1, TerrainTopology.TypeToIndex((int)layers.Topologies));
                break;
        }
        EditorGUILayout.EndScrollView();
    }
Exemple #3
0
        public static void ConditionalPaintLayerSelect(ref Conditions cnds, ref Layers layers, ref int texture)
        {
            Elements.MiniBoldLabel(ToolTips.textureToPaintLabel);

            Elements.BeginToolbarHorizontal();
            Elements.ToolbarLabel(ToolTips.layerSelect);
            layers.LandLayer = (LandLayers)Elements.ToolbarEnumPopup(layers.LandLayer);
            Elements.EndToolbarHorizontal();

            switch (layers.LandLayer)
            {
            case LandLayers.Ground:
                Elements.BeginToolbarHorizontal();
                Elements.ToolbarLabel(ToolTips.textureSelect);
                layers.Ground = (TerrainSplat.Enum)Elements.ToolbarEnumPopup(layers.Ground);
                texture       = TerrainSplat.TypeToIndex((int)layers.Ground);
                Elements.EndToolbarHorizontal();
                break;

            case LandLayers.Biome:
                Elements.BeginToolbarHorizontal();
                Elements.ToolbarLabel(ToolTips.textureSelect);
                layers.Biome = (TerrainBiome.Enum)Elements.ToolbarEnumPopup(layers.Biome);
                texture      = TerrainBiome.TypeToIndex((int)layers.Biome);
                Elements.EndToolbarHorizontal();
                break;

            case LandLayers.Alpha:
                Elements.BeginToolbarHorizontal();
                Elements.ToolbarLabel(ToolTips.textureSelect);
                layers.AlphaTexture = (AlphaTextures)Elements.ToolbarEnumPopup(layers.AlphaTexture);
                texture             = (int)layers.AlphaTexture;
                Elements.EndToolbarHorizontal();
                break;

            case LandLayers.Topology:
                Elements.BeginToolbarHorizontal();
                Elements.ToolbarLabel(ToolTips.topologyLayerSelect);
                layers.Topologies = (TerrainTopology.Enum)Elements.ToolbarEnumPopup(layers.Topologies);
                Elements.EndToolbarHorizontal();

                Elements.BeginToolbarHorizontal();
                Elements.ToolbarLabel(ToolTips.textureSelect);
                layers.TopologyTexture = (TopologyTextures)Elements.ToolbarEnumPopup(layers.TopologyTexture);
                texture = (int)layers.TopologyTexture;
                Elements.EndToolbarHorizontal();
                break;
            }

            Elements.BeginToolbarHorizontal();
            if (Elements.ToolbarButton(ToolTips.paintConditional))
            {
                MapManager.PaintConditional(layers.LandLayer, texture, cnds, TerrainTopology.TypeToIndex((int)layers.Topologies));
            }
            Elements.EndToolbarHorizontal();
        }
Exemple #4
0
        public static IEnumerator Load(MapInfo mapInfo, string path = "")
        {
            for (int i = 0; i < Progress.GetCount(); i++) // Remove old progress
            {
                var progress = Progress.GetProgressById(Progress.GetId(i));
                if (progress.finished && progress.name.Contains("Load:"))
                {
                    progress.Remove();
                }
            }

            int progressID = Progress.Start("Load: " + path.Split('/').Last(), "Preparing Map", Progress.Options.Sticky);
            int delPrefab  = Progress.Start("Prefabs", null, Progress.Options.Sticky, progressID);
            int spwPrefab  = Progress.Start("Prefabs", null, Progress.Options.Sticky, progressID);
            int delPath    = Progress.Start("Paths", null, Progress.Options.Sticky, progressID);
            int spwPath    = Progress.Start("Paths", null, Progress.Options.Sticky, progressID);
            int terrainID  = Progress.Start("Terrain", null, Progress.Options.Sticky, progressID);

            var splatMapTask = Task.Run(() => SetSplatMaps(mapInfo));

            PrefabManager.DeletePrefabs(PrefabManager.CurrentMapPrefabs, delPrefab);
            PathManager.DeletePaths(PathManager.CurrentMapPaths, delPath);
            CentreSceneObjects(mapInfo);
            SetTerrain(mapInfo, terrainID);
            PrefabManager.SpawnPrefabs(mapInfo.prefabData, spwPrefab);
            PathManager.SpawnPaths(mapInfo.pathData, spwPath);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();
            while (!splatMapTask.IsCompleted)
            {
                if (sw.Elapsed.TotalMilliseconds > 0.05f)
                {
                    sw.Restart();
                    yield return(null);
                }
            }

            SetLayer(LandLayer, TerrainTopology.TypeToIndex((int)TopologyLayer)); // Sets the alphamaps to the currently selected.

            while (Progress.GetProgressById(spwPrefab).running)
            {
                if (sw.Elapsed.TotalMilliseconds > 0.05f)
                {
                    sw.Restart();
                    yield return(null);
                }
            }

            Progress.Report(progressID, 0.99f, "Loaded");
            Progress.Finish(terrainID, Progress.Status.Succeeded);
            Progress.Finish(progressID, Progress.Status.Succeeded);

            EventManager.OnMapLoaded(path);
        }
Exemple #5
0
    /// <summary>Inverts the active and inactive textures. Alpha and Topology only.</summary>
    /// <param name="landLayerToPaint">The LandLayer to invert. (Alpha, Topology)</param>
    /// <param name="topology">The Topology layer, if selected.</param>
    public static void InvertLayer(LandLayers landLayerToPaint, int topology = 0)
    {
        switch (landLayerToPaint)
        {
        case LandLayers.Topology:
            SetData(Invert(GetSplatMap(landLayerToPaint, topology)), landLayerToPaint, topology);
            SetLayer(LandLayer, TerrainTopology.TypeToIndex((int)TopologyLayer));
            break;

        case LandLayers.Alpha:
            SetData(Invert(AlphaArray), landLayerToPaint);
            break;
        }
    }
Exemple #6
0
    /// <summary>Sets whole layer to the inactive texture. Alpha and Topology only.</summary>
    /// <param name="landLayerToPaint">The LandLayer to clear. (Alpha, Topology)</param>
    /// <param name="topology">The Topology layer, if selected.</param>
    public static void ClearLayer(LandLayers landLayerToPaint, int topology = 0)
    {
        switch (landLayerToPaint)
        {
        case LandLayers.Topology:
            SetData(SetValues(GetSplatMap(landLayerToPaint, topology), 1), landLayerToPaint, topology);
            SetLayer(LandLayer, TerrainTopology.TypeToIndex((int)TopologyLayer));
            break;

        case LandLayers.Alpha:
            SetData(SetValues(AlphaArray, false), landLayerToPaint);
            break;
        }
    }
Exemple #7
0
        public static void TopologyLayerSelect(ref Layers layers)
        {
            Elements.MiniBoldLabel(ToolTips.layerSelect);

            Elements.BeginToolbarHorizontal();
            Elements.ToolbarLabel(ToolTips.topologyLayerSelect);
            EditorGUI.BeginChangeCheck();
            layers.Topologies = (TerrainTopology.Enum)Elements.ToolbarEnumPopup(layers.Topologies);
            Elements.EndToolbarHorizontal();

            if (EditorGUI.EndChangeCheck())
            {
                ChangeLandLayer(LandLayers.Topology, TerrainTopology.TypeToIndex((int)layers.Topologies));
            }
        }
Exemple #8
0
    /// <summary>Sets whole layer to the active texture.</summary>
    /// <param name="landLayerToPaint">The LandLayer to paint. (Ground, Biome, Alpha, Topology)</param>
    /// <param name="t">The texture to paint.</param>
    /// <param name="topology">The Topology layer, if selected.</param>
    public static void PaintLayer(LandLayers landLayerToPaint, int t, int topology = 0)
    {
        switch (landLayerToPaint)
        {
        case LandLayers.Ground:
        case LandLayers.Biome:
        case LandLayers.Topology:
            SetData(SetValues(GetSplatMap(landLayerToPaint), t), landLayerToPaint, topology);
            SetLayer(LandLayer, TerrainTopology.TypeToIndex((int)TopologyLayer));
            break;

        case LandLayers.Alpha:
            SetData(SetValues(AlphaArray, true), landLayerToPaint);
            break;
        }
    }
Exemple #9
0
    /// <summary>Rotates the selected layer.</summary>
    /// <param name="landLayerToPaint">The LandLayer to rotate. (Ground, Biome, Alpha, Topology)</param>
    /// <param name="CW">True = 90°, False = 270°</param>
    /// <param name="topology">The Topology layer, if selected.</param>
    public static void RotateLayer(LandLayers landLayerToPaint, bool CW, int topology = 0)
    {
        switch (landLayerToPaint)
        {
        case LandLayers.Ground:
        case LandLayers.Biome:
        case LandLayers.Topology:
            SetData(Rotate(GetSplatMap(landLayerToPaint, topology), CW), landLayerToPaint, topology);
            SetLayer(LandLayer, TerrainTopology.TypeToIndex((int)TopologyLayer));
            break;

        case LandLayers.Alpha:
            SetData(Rotate(AlphaArray, CW), landLayerToPaint);
            break;
        }
    }
Exemple #10
0
    /// <summary>Paints the layer wherever the height conditions are met.</summary>
    /// <param name="landLayerToPaint">The LandLayer to paint. (Ground, Biome, Alpha, Topology)</param>
    /// <param name="heightLow">The minimum height to paint at 100% weight.</param>
    /// <param name="heightHigh">The maximum height to paint at 100% weight.</param>
    /// <param name="t">The texture to paint.</param>
    /// <param name="topology">The Topology layer, if selected.</param>
    public static void PaintHeight(LandLayers landLayerToPaint, float heightLow, float heightHigh, int t, int topology = 0)
    {
        switch (landLayerToPaint)
        {
        case LandLayers.Ground:
        case LandLayers.Biome:
        case LandLayers.Topology:
            SetData(SetRange(GetSplatMap(landLayerToPaint, topology), GetHeights(), t, heightLow, heightHigh), landLayerToPaint, topology);
            SetLayer(LandLayer, TerrainTopology.TypeToIndex((int)TopologyLayer));
            break;

        case LandLayers.Alpha:
            bool value = (t == 0) ? true : false;
            SetData(SetRange(AlphaArray, GetHeights(), value, heightLow, heightHigh), landLayerToPaint);
            break;
        }
    }
Exemple #11
0
    /// <summary>Paints the splats wherever the water is above 500 and is above the terrain.</summary>
    /// <param name="landLayerToPaint">The LandLayer to paint. (Ground, Biome, Alpha, Topology)</param>
    /// <param name="aboveTerrain">Check if the watermap is above the terrain before painting.</param>
    /// <param name="t">The texture to paint.</param>
    /// <param name="topology">The Topology layer, if selected.</param>
    public static void PaintRiver(LandLayers landLayerToPaint, bool aboveTerrain, int t, int topology = 0)
    {
        switch (landLayerToPaint)
        {
        case LandLayers.Ground:
        case LandLayers.Biome:
        case LandLayers.Topology:
            SetData(SetRiver(GetSplatMap(landLayerToPaint, topology), GetHeights(), GetWaterHeights(), aboveTerrain, t), landLayerToPaint, topology);
            SetLayer(LandLayer, TerrainTopology.TypeToIndex((int)TopologyLayer));
            break;

        case LandLayers.Alpha:
            bool value = (t == 0) ? true : false;
            SetData(SetRiver(GetAlphaMap(), GetHeights(), GetWaterHeights(), aboveTerrain, value), landLayerToPaint);
            break;
        }
    }
Exemple #12
0
    /// <summary>Paints the layer wherever the slope conditions are met. Includes option to blend.</summary>
    /// <param name="landLayerToPaint">The LandLayer to paint. (Ground, Biome, Alpha, Topology)</param>
    /// <param name="slopeLow">The minimum slope to paint at 100% weight.</param>
    /// <param name="slopeHigh">The maximum slope to paint at 100% weight.</param>
    /// <param name="t">The texture to paint.</param>
    /// <param name="topology">The Topology layer, if selected.</param>
    public static void PaintSlope(LandLayers landLayerToPaint, float slopeLow, float slopeHigh, int t, int topology = 0) // Paints slope based on the current slope input, the slope range is between 0 - 90
    {
        switch (landLayerToPaint)
        {
        case LandLayers.Ground:
        case LandLayers.Biome:
        case LandLayers.Topology:
            SetData(SetRange(GetSplatMap(landLayerToPaint, topology), GetSlopes(), t, slopeLow, slopeHigh), landLayerToPaint, topology);
            SetLayer(LandLayer, TerrainTopology.TypeToIndex((int)TopologyLayer));
            break;

        case LandLayers.Alpha:
            bool value = (t == 0) ? true : false;
            SetData(SetRange(GetAlphaMap(), GetSlopes(), value, slopeLow, slopeHigh), landLayerToPaint);
            break;
        }
    }
    public void OnGUI()
    {
        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false);
        GUIContent[] mainMenu = new GUIContent[6];
        mainMenu[0] = new GUIContent("File");
        mainMenu[1] = new GUIContent("Settings");
        mainMenu[2] = new GUIContent("Prefabs");
        mainMenu[3] = new GUIContent("Layers");
        mainMenu[4] = new GUIContent("Generator");
        mainMenu[5] = new GUIContent("Advanced");

        mainMenuOptions = GUILayout.Toolbar(mainMenuOptions, mainMenu, EditorStyles.toolbarButton);

        Functions.SaveSettings();

        #region Menu
        switch (mainMenuOptions)
        {
            #region File
        case 0:
            Functions.EditorIO();
            Functions.NewMapOptions(ref mapSize, ref landHeight, ref layers);
            Functions.MapInfo();
            break;

            #endregion
            #region Prefabs
        case 1:
            Functions.EditorSettings();
            Functions.EditorInfo();

            Functions.EditorLinks();
            break;

        case 2:
            Functions.Replacer(ref replacer, ref replacerPresetIndex, ref replacerList);
            break;

            #endregion
        case 3:
            GUIContent[] layersMenu = new GUIContent[4];
            layersMenu[0] = new GUIContent("Ground");
            layersMenu[1] = new GUIContent("Biome");
            layersMenu[2] = new GUIContent("Alpha");
            layersMenu[3] = new GUIContent("Topology");

            EditorGUI.BeginChangeCheck();
            layerIndex = GUILayout.Toolbar(layerIndex, layersMenu, EditorStyles.toolbarButton);

            if (EditorGUI.EndChangeCheck())
            {
                Functions.SetLandLayer((LandLayers)layerIndex, TerrainTopology.TypeToIndex((int)layers.Topologies));
            }

            switch (TerrainManager.LandLayer)
            {
            case LandLayers.Ground:
                Functions.TextureSelect((LandLayers)layerIndex, ref layers);

                Functions.LayerTools(TerrainManager.LandLayer, TerrainSplat.TypeToIndex((int)layers.Ground));



                crazing            = SettingsManager.crazing;
                crazing.splatLayer = TerrainTopology.TypeToIndex((int)layers.Ground);
                Functions.Crazing(ref crazing);

                perlinSplat            = SettingsManager.perlinSplat;
                perlinSplat.splatLayer = TerrainTopology.TypeToIndex((int)layers.Ground);
                Functions.PerlinSplat(ref perlinSplat);

                Functions.HeightTools(TerrainManager.LandLayer, TerrainSplat.TypeToIndex((int)layers.Ground), ref heightsInfo);
                Functions.SlopeTools(TerrainManager.LandLayer, TerrainSplat.TypeToIndex((int)layers.Ground), ref slopesInfo);

                Functions.RiverTools(TerrainManager.LandLayer, TerrainSplat.TypeToIndex((int)layers.Ground), ref aboveTerrain);

                break;

            case LandLayers.Biome:
                Functions.TextureSelect((LandLayers)layerIndex, ref layers);

                Functions.LayerTools(TerrainManager.LandLayer, TerrainBiome.TypeToIndex((int)layers.Biome));


                Functions.HeightTools(TerrainManager.LandLayer, TerrainBiome.TypeToIndex((int)layers.Biome), ref heightsInfo);
                Functions.SlopeTools(TerrainManager.LandLayer, TerrainBiome.TypeToIndex((int)layers.Biome), ref slopesInfo);
                break;

            case LandLayers.Alpha:

                Functions.LayerTools(TerrainManager.LandLayer, 0, 1);

                break;

            case LandLayers.Topology:

                Functions.TopologyTools();

                Functions.TopologyLayerSelect(ref layers);

                Functions.LayerTools(TerrainManager.LandLayer, 0, 1, TerrainTopology.TypeToIndex((int)layers.Topologies));


                Functions.HeightTools(TerrainManager.LandLayer, 0, ref heightsInfo, 1, TerrainTopology.TypeToIndex((int)layers.Topologies));
                Functions.SlopeTools(TerrainManager.LandLayer, 0, ref slopesInfo, 1, TerrainTopology.TypeToIndex((int)layers.Topologies));

                Functions.Combinator(ref layers, ref sourceLayers, ref tttWeight, ref thicc);


                Functions.RiverTools(TerrainManager.LandLayer, 0, ref aboveTerrain, 1, TerrainTopology.TypeToIndex((int)layers.Topologies));
                Functions.LakeOcean(ref layers);
                break;
            }

            switch (mapToolsOptions)
            {
                /*
                 #region HeightMap
                 * case 0:
                 * GUIContent[] heightMapMenu = new GUIContent[2];
                 * heightMapMenu[0] = new GUIContent("Heights");
                 * heightMapMenu[1] = new GUIContent("Filters");
                 * heightMapOptions = GUILayout.Toolbar(heightMapOptions, heightMapMenu, EditorStyles.toolbarButton);
                 *
                 * switch (heightMapOptions)
                 * {
                 * case 0:
                 * Elements.BoldLabel(ToolTips.heightsLabel);
                 * Functions.OffsetMap(ref offset, ref clampOffset);
                 * Functions.SetHeight(ref heightSet);
                 * Functions.ClampHeight(ref heightLow, ref heightHigh);
                 * Elements.BoldLabel(ToolTips.miscLabel);
                 * Functions.InvertMap();
                 * break;
                 * case 1:
                 * Functions.NormaliseMap(ref normaliseLow, ref normaliseHigh, ref autoUpdate);
                 * Functions.SmoothMap(ref filterStrength, ref blurDirection, ref smoothPasses);
                 * Functions.TerraceMap(ref terraceErodeFeatureSize, ref terraceErodeInteriorCornerWeight);
                 * break;
                 * }
                 * break;
                 #endregion
                 *
                 #region Textures
                 * case 0:
                 * Functions.ConditionalPaint(ref conditionalPaintOptions, ref texture, ref conditions, ref layers);
                 * break;
                 #endregion
                 *
                 #region Misc
                 * case 2:
                 * Functions.RotateMap(ref rotateSelection);
                 * break;
                 #endregion
                 */
            }
            break;

        case 4:
            GUIContent[] generatorMenu = new GUIContent[3];
            generatorMenu[0] = new GUIContent("Heightmap");
            generatorMenu[1] = new GUIContent("Geology");
            generatorMenu[2] = new GUIContent("Monuments");

            generatorOptions = GUILayout.Toolbar(generatorOptions, generatorMenu, EditorStyles.toolbarButton);
            switch (generatorOptions)
            {
            case 0:
                Functions.SetHeight(ref heightSet);
                Functions.OffsetMap(ref offset, ref clampOffset);

                perlin = SettingsManager.perlin;
                Functions.PerlinTerrain(ref perlin);

                Functions.NormaliseMap(ref normaliseLow, ref normaliseHigh, ref autoUpdate);

                ocean = SettingsManager.ocean;
                Functions.Ocean(ref ocean);

                ripple = SettingsManager.ripple;
                Functions.Ripple(ref ripple);

                terracing = SettingsManager.terracing;
                Functions.RandomTerracing(ref terracing);

                break;

            case 1:
                Functions.Geology(ref activePreset, ref presetIndex, ref geologyList, ref macroIndex, ref macroList, ref macroTitle, ref macroDisplay, ref layers);
                break;

            case 2:
                city = SettingsManager.city;
                Functions.RustCity(ref city);
                break;
            }
            break;

        case 5:
            Functions.Merger(ref zOffset);
            break;
        }
        #endregion
        EditorGUILayout.EndScrollView();
    }
Exemple #14
0
 public static void InvertLayer()
 {
     MapManager.InvertLayer(TerrainManager.LandLayer, TerrainTopology.TypeToIndex((int)TerrainManager.TopologyLayer));
 }
Exemple #15
0
        public static void ConditionalPaintConditions(ref Conditions cnds, ref int cndsOptions)
        {
            Elements.BoldLabel(ToolTips.conditionalPaintLabel);

            GUIContent[] conditionalPaintMenu = new GUIContent[5];
            conditionalPaintMenu[0] = new GUIContent("Ground");
            conditionalPaintMenu[1] = new GUIContent("Biome");
            conditionalPaintMenu[2] = new GUIContent("Alpha");
            conditionalPaintMenu[3] = new GUIContent("Topology");
            conditionalPaintMenu[4] = new GUIContent("Terrain");
            cndsOptions             = GUILayout.Toolbar(cndsOptions, conditionalPaintMenu, EditorStyles.toolbarButton);

            Elements.MiniBoldLabel(ToolTips.conditionsLabel);

            switch (cndsOptions)
            {
            case 0:     // Ground
                Elements.BeginToolbarHorizontal();
                cnds.GroundConditions.CheckLayer[TerrainSplat.TypeToIndex((int)cnds.GroundConditions.Layer)] = Elements.ToolbarToggle(ToolTips.checkTexture, cnds.GroundConditions.CheckLayer[TerrainSplat.TypeToIndex((int)cnds.GroundConditions.Layer)]);
                cnds.GroundConditions.Layer = (TerrainSplat.Enum)Elements.ToolbarEnumPopup(cnds.GroundConditions.Layer);
                Elements.EndToolbarHorizontal();

                Elements.BeginToolbarHorizontal();
                cnds.GroundConditions.Weight[TerrainSplat.TypeToIndex((int)cnds.GroundConditions.Layer)] = Elements.ToolbarSlider(ToolTips.conditionalTextureWeight, cnds.GroundConditions.Weight[TerrainSplat.TypeToIndex((int)cnds.GroundConditions.Layer)], 0.01f, 1f);
                Elements.EndToolbarHorizontal();
                break;

            case 1:     // Biome
                Elements.BeginToolbarHorizontal();
                cnds.BiomeConditions.CheckLayer[TerrainBiome.TypeToIndex((int)cnds.BiomeConditions.Layer)] = Elements.ToolbarToggle(ToolTips.checkTexture, cnds.BiomeConditions.CheckLayer[TerrainBiome.TypeToIndex((int)cnds.BiomeConditions.Layer)]);
                cnds.BiomeConditions.Layer = (TerrainBiome.Enum)Elements.ToolbarEnumPopup(cnds.BiomeConditions.Layer);
                Elements.EndToolbarHorizontal();

                Elements.BeginToolbarHorizontal();
                cnds.BiomeConditions.Weight[TerrainBiome.TypeToIndex((int)cnds.BiomeConditions.Layer)] = Elements.ToolbarSlider(ToolTips.conditionalTextureWeight, cnds.BiomeConditions.Weight[TerrainBiome.TypeToIndex((int)cnds.BiomeConditions.Layer)], 0.01f, 1f);
                Elements.EndToolbarHorizontal();
                break;

            case 2:     // Alpha
                Elements.BeginToolbarHorizontal();
                cnds.AlphaConditions.CheckAlpha = Elements.ToolbarToggle(ToolTips.checkTexture, cnds.AlphaConditions.CheckAlpha);
                cnds.AlphaConditions.Texture    = (AlphaTextures)Elements.ToolbarEnumPopup(cnds.AlphaConditions.Texture);
                Elements.EndToolbarHorizontal();
                break;

            case 3:     // Topology
                Elements.BeginToolbarHorizontal();
                cnds.TopologyConditions.CheckLayer[TerrainTopology.TypeToIndex((int)cnds.TopologyConditions.Layer)] = Elements.ToolbarToggle(ToolTips.checkTopologyLayer, cnds.TopologyConditions.CheckLayer[TerrainTopology.TypeToIndex((int)cnds.TopologyConditions.Layer)]);
                cnds.TopologyConditions.Layer = (TerrainTopology.Enum)Elements.ToolbarEnumPopup(cnds.TopologyConditions.Layer);
                Elements.EndToolbarHorizontal();

                Elements.BeginToolbarHorizontal();
                Elements.ToolbarLabel(ToolTips.checkTexture);
                cnds.TopologyConditions.Texture[TerrainTopology.TypeToIndex((int)cnds.TopologyConditions.Layer)] = (TopologyTextures)Elements.ToolbarEnumPopup(cnds.TopologyConditions.Texture[TerrainTopology.TypeToIndex((int)cnds.TopologyConditions.Layer)]);
                Elements.EndToolbarHorizontal();
                break;

            case 4:     // Terrain
                float tempSlopeLow = cnds.TerrainConditions.Slopes.SlopeLow, tempSlopeHigh = cnds.TerrainConditions.Slopes.SlopeHigh;
                cnds.TerrainConditions.CheckSlopes     = Elements.ToolbarToggleMinMax(ToolTips.checkSlopes, ToolTips.rangeLow, ToolTips.rangeHigh, cnds.TerrainConditions.CheckSlopes, ref tempSlopeLow, ref tempSlopeHigh, 0f, 90f);
                cnds.TerrainConditions.Slopes.SlopeLow = tempSlopeLow; cnds.TerrainConditions.Slopes.SlopeHigh = tempSlopeHigh;

                float tempHeightLow = cnds.TerrainConditions.Heights.HeightLow, tempHeightHigh = cnds.TerrainConditions.Heights.HeightHigh;
                cnds.TerrainConditions.CheckHeights      = Elements.ToolbarToggleMinMax(ToolTips.checkHeights, ToolTips.rangeLow, ToolTips.rangeHigh, cnds.TerrainConditions.CheckHeights, ref tempHeightLow, ref tempHeightHigh, 0f, 1000f);
                cnds.TerrainConditions.Heights.HeightLow = tempHeightLow; cnds.TerrainConditions.Heights.HeightHigh = tempHeightHigh;
                break;
            }
        }
Exemple #16
0
    public void OnGUI()
    {
        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false);
        GUIContent[] mainMenu = new GUIContent[4];
        mainMenu[0] = new GUIContent("File");
        mainMenu[1] = new GUIContent("Prefabs");
        mainMenu[2] = new GUIContent("Layers");
        mainMenu[3] = new GUIContent("Advanced");

        EditorGUI.BeginChangeCheck();
        mainMenuOptions = GUILayout.Toolbar(mainMenuOptions, mainMenu, EditorStyles.toolbarButton);
        if (EditorGUI.EndChangeCheck() && mainMenuOptions == 2)
        {
            Functions.SetLandLayer((LandLayers)layerIndex);
        }

        #region Menu
        switch (mainMenuOptions)
        {
            #region File
        case 0:
            Functions.EditorIO();
            Functions.EditorInfo();
            Functions.MapInfo();
            Functions.EditorLinks();
            Functions.EditorSettings();
            break;

            #endregion
            #region Prefabs
        case 1:
            GUIContent[] prefabsOptionsMenu = new GUIContent[2];
            prefabsOptionsMenu[0] = new GUIContent("Asset Bundle");
            prefabsOptionsMenu[1] = new GUIContent("Prefab Tools");
            prefabOptions         = GUILayout.Toolbar(prefabOptions, prefabsOptionsMenu, EditorStyles.toolbarButton);

            switch (prefabOptions)
            {
            case 0:
                Functions.AssetBundle();
                break;

            case 1:
                Functions.PrefabTools(ref deletePrefabs, prefabSaveFile, mapPrefabSaveFile);
                break;
            }
            break;

            #endregion
            #region Layers
        case 2:
            GUIContent[] layersOptionsMenu = new GUIContent[4];
            layersOptionsMenu[0] = new GUIContent("Ground");
            layersOptionsMenu[1] = new GUIContent("Biome");
            layersOptionsMenu[2] = new GUIContent("Alpha");
            layersOptionsMenu[3] = new GUIContent("Topology");

            EditorGUI.BeginChangeCheck();
            layerIndex = GUILayout.Toolbar(layerIndex, layersOptionsMenu, EditorStyles.toolbarButton);
            if (EditorGUI.EndChangeCheck())
            {
                Functions.SetLandLayer((LandLayers)layerIndex, TerrainTopology.TypeToIndex((int)layers.Topologies));
            }

            switch (layerIndex)
            {
            case 0:
                Functions.TextureSelect((LandLayers)layerIndex, ref layers);
                Functions.AreaSelect();
                Functions.LayerTools((LandLayers)layerIndex, TerrainSplat.TypeToIndex((int)layers.Ground));
                Functions.RotateTools((LandLayers)layerIndex);
                Functions.RiverTools((LandLayers)layerIndex, TerrainSplat.TypeToIndex((int)layers.Ground), ref aboveTerrain);
                Functions.SlopeTools((LandLayers)layerIndex, TerrainSplat.TypeToIndex((int)layers.Ground), ref slopesInfo);
                Functions.HeightTools((LandLayers)layerIndex, TerrainSplat.TypeToIndex((int)layers.Ground), ref heightsInfo);
                break;

            case 1:
                Functions.TextureSelect((LandLayers)layerIndex, ref layers);
                Functions.AreaSelect();
                Functions.LayerTools((LandLayers)layerIndex, TerrainBiome.TypeToIndex((int)layers.Biome));
                Functions.RotateTools((LandLayers)layerIndex);
                Functions.RiverTools((LandLayers)layerIndex, TerrainBiome.TypeToIndex((int)layers.Biome), ref aboveTerrain);
                Functions.SlopeTools((LandLayers)layerIndex, TerrainBiome.TypeToIndex((int)layers.Biome), ref slopesInfo);
                Functions.HeightTools((LandLayers)layerIndex, TerrainBiome.TypeToIndex((int)layers.Biome), ref heightsInfo);
                break;

            case 2:
                Functions.LayerTools((LandLayers)layerIndex, 0, 1);
                Functions.AreaSelect();
                Functions.RotateTools((LandLayers)layerIndex);
                Functions.RiverTools((LandLayers)layerIndex, 0, ref aboveTerrain, 1);
                Functions.SlopeTools((LandLayers)layerIndex, 0, ref slopesInfo, 1);
                Functions.HeightTools((LandLayers)layerIndex, 0, ref heightsInfo, 1);
                break;

            case 3:
                Functions.TopologyLayerSelect(ref layers);
                Functions.AreaSelect();
                Functions.LayerTools((LandLayers)layerIndex, 0, 1, TerrainTopology.TypeToIndex((int)layers.Topologies));
                Functions.RotateTools((LandLayers)layerIndex, TerrainTopology.TypeToIndex((int)layers.Topologies));
                Functions.TopologyTools();
                Functions.RiverTools((LandLayers)layerIndex, 0, ref aboveTerrain, 1, TerrainTopology.TypeToIndex((int)layers.Topologies));
                Functions.SlopeTools((LandLayers)layerIndex, 0, ref slopesInfo, 1, TerrainTopology.TypeToIndex((int)layers.Topologies));
                Functions.HeightTools((LandLayers)layerIndex, 0, ref heightsInfo, 1, TerrainTopology.TypeToIndex((int)layers.Topologies));
                break;
            }
            break;

            #endregion
            #region Advanced
        case 3:
            GUIContent[] advancedOptionsMenu = new GUIContent[2];
            advancedOptionsMenu[0] = new GUIContent("Generation");
            advancedOptionsMenu[1] = new GUIContent("Map Tools");

            EditorGUI.BeginChangeCheck();
            advancedOptions = GUILayout.Toolbar(advancedOptions, advancedOptionsMenu, EditorStyles.toolbarButton);
            if (EditorGUI.EndChangeCheck() && advancedOptions == 0)
            {
                MapManager.RefreshPresetsList();
            }

            switch (advancedOptions)
            {
                #region Generation
            case 0:
                Functions.NodePresets(presetScrollPos);
                break;

                #endregion
                #region Map Tools
            case 1:
                GUIContent[] mapToolsMenu = new GUIContent[3];
                mapToolsMenu[0] = new GUIContent("HeightMap");
                mapToolsMenu[1] = new GUIContent("Textures");
                mapToolsMenu[2] = new GUIContent("Misc");
                mapToolsOptions = GUILayout.Toolbar(mapToolsOptions, mapToolsMenu, EditorStyles.toolbarButton);

                switch (mapToolsOptions)
                {
                    #region HeightMap
                case 0:
                    GUIContent[] heightMapMenu = new GUIContent[2];
                    heightMapMenu[0] = new GUIContent("Heights");
                    heightMapMenu[1] = new GUIContent("Filters");
                    heightMapOptions = GUILayout.Toolbar(heightMapOptions, heightMapMenu, EditorStyles.toolbarButton);

                    switch (heightMapOptions)
                    {
                    case 0:
                        Elements.BoldLabel(ToolTips.heightsLabel);
                        Functions.OffsetMap(ref offset, ref clampOffset);
                        Functions.SetHeight(ref heightSet);
                        Functions.ClampHeight(ref heightLow, ref heightHigh);
                        Elements.BoldLabel(ToolTips.miscLabel);
                        Functions.InvertMap();
                        break;

                    case 1:
                        Functions.NormaliseMap(ref normaliseLow, ref normaliseHigh, ref autoUpdate);
                        Functions.SmoothMap(ref filterStrength, ref blurDirection, ref smoothPasses);
                        Functions.TerraceMap(ref terraceErodeFeatureSize, ref terraceErodeInteriorCornerWeight);
                        break;
                    }
                    break;

                    #endregion
                    #region Textures
                case 1:
                    Functions.ConditionalPaint(ref conditionalPaintOptions, ref texture, ref conditions, ref layers);
                    break;

                    #endregion
                    #region Misc
                case 2:
                    Functions.RotateMap(ref rotateSelection);
                    break;
                    #endregion
                }
                break;
                #endregion
            }
            break;
            #endregion
        }
        #endregion
        EditorGUILayout.EndScrollView();
    }