Beispiel #1
0
        private void OnWizardCreate()
        {
            if (this.m_HeightmapResolution >= 4097)
            {
                base.isValid     = false;
                base.errorString = "Heightmaps above 4096x4096 in resolution are not supported";
                Debug.LogError(base.errorString);
                return;
            }
            List <UnityEngine.Object> list = new List <UnityEngine.Object>();

            list.Add(base.terrainData);
            list.AddRange(base.terrainData.alphamapTextures);
            Undo.RegisterCompleteObjectUndo(list.ToArray(), "Set Resolution");
            if (base.terrainData.heightmapResolution != this.m_HeightmapResolution)
            {
                base.terrainData.heightmapResolution = this.m_HeightmapResolution;
            }
            base.terrainData.size = new Vector3(this.m_TerrainWidth, this.m_TerrainHeight, this.m_TerrainLength);
            if (base.terrainData.detailResolution != this.m_DetailResolution || this.m_DetailResolutionPerPatch != base.terrainData.detailResolutionPerPatch)
            {
                SetResolutionWizard.ResizeDetailResolution(base.terrainData, this.m_DetailResolution, this.m_DetailResolutionPerPatch);
            }
            if (base.terrainData.alphamapResolution != this.m_ControlTextureResolution)
            {
                base.terrainData.alphamapResolution = this.m_ControlTextureResolution;
            }
            if (base.terrainData.baseMapResolution != this.m_BaseTextureResolution)
            {
                base.terrainData.baseMapResolution = this.m_BaseTextureResolution;
            }
            base.FlushHeightmapModification();
        }
        internal static void SetHeightmapResolution()
        {
            SetResolutionWizard setResolutionWizard = ScriptableWizard.DisplayWizard <SetResolutionWizard>("Set Heightmap resolution", "Set Resolution");

            setResolutionWizard.InitializeDefaults(TerrainMenus.GetActiveTerrain());
        }