public override void DoRedo()
        {
            Undo.Current.EditMenu.SetState(Editing.EditStates.TexturesStat);

            ScmapEditor.Current.Textures[i].Albedo      = Textures.Albedo;
            ScmapEditor.Current.Textures[i].AlbedoPath  = Textures.AlbedoPath;
            ScmapEditor.Current.Textures[i].AlbedoScale = Textures.AlbedoScale;

            ScmapEditor.Current.Textures[i].Normal      = Textures.Normal;
            ScmapEditor.Current.Textures[i].NormalPath  = Textures.NormalPath;
            ScmapEditor.Current.Textures[i].NormalScale = Textures.NormalScale;

            ScmapEditor.Current.map.Layers[i].PathTexture   = Textures.AlbedoPath;
            ScmapEditor.Current.map.Layers[i].PathNormalmap = Textures.NormalPath;

            ScmapEditor.Current.Textures[i].Tilling = Textures.Tilling;

            if (ScmapEditor.Current.Textures[i].Albedo == null)
            {
                GetGamedataFile.LoadTextureFromGamedata(Textures.AlbedoPath, i, false);
            }

            if (ScmapEditor.Current.Textures[i].Normal == null)
            {
                GetGamedataFile.LoadTextureFromGamedata(Textures.NormalPath, i, true);
            }

            ScmapEditor.Current.SetTextures(i);

            Undo.Current.EditMenu.EditStratum.ReloadStratums();
            Undo.Current.EditMenu.EditStratum.SelectStratum(i);
        }
Exemplo n.º 2
0
    public void LoadStratumScdTextures(bool Loading = true)
    {
        // Load Stratum Textures Paths

        for (int i = 0; i < Textures.Length; i++)
        {
            if (Loading)
            {
                MapLuaParser.Current.InfoPopup.Show(true, "Loading map...\n( Stratum textures " + (i + 1) + " )");

                if (i >= map.Layers.Count)
                {
                    map.Layers.Add(new Layer());
                }

                Textures[i].AlbedoPath = GetGamedataFile.FixMapsPath(map.Layers[i].PathTexture);
                Textures[i].NormalPath = GetGamedataFile.FixMapsPath(map.Layers[i].PathNormalmap);
                if (Textures[i].AlbedoPath.StartsWith("/"))
                {
                    Textures[i].AlbedoPath = Textures[i].AlbedoPath.Remove(0, 1);
                }
                if (Textures[i].NormalPath.StartsWith("/"))
                {
                    Textures[i].NormalPath = Textures[i].NormalPath.Remove(0, 1);
                }

                Textures[i].AlbedoScale = map.Layers[i].ScaleTexture;
                Textures[i].NormalScale = map.Layers[i].ScaleNormalmap;
            }

            string Env = GetGamedataFile.EnvScd;
            if (Textures[i].AlbedoPath.ToLower().StartsWith("maps"))
            {
                Env = GetGamedataFile.MapScd;
            }

            try
            {
                Textures[i].AlbedoPath = GetGamedataFile.FindFile(Env, Textures[i].AlbedoPath);
                //Debug.Log("Found: " + Textures[i].AlbedoPath);
                GetGamedataFile.LoadTextureFromGamedata(GetGamedataFile.EnvScd, Textures[i].AlbedoPath, i, false);
            }
            catch (System.Exception e)
            {
                Debug.LogError(i + ", Albedo tex: " + Textures[i].AlbedoPath);
                Debug.LogError(e);
            }

            Env = GetGamedataFile.EnvScd;
            if (Textures[i].NormalPath.ToLower().StartsWith("maps"))
            {
                Env = GetGamedataFile.MapScd;
            }

            try
            {
                Textures[i].NormalPath = GetGamedataFile.FindFile(Env, Textures[i].NormalPath);
                //Debug.Log("Found: " + Textures[i].NormalPath);
                GetGamedataFile.LoadTextureFromGamedata(GetGamedataFile.EnvScd, Textures[i].NormalPath, i, true);
            }
            catch (System.Exception e)
            {
                Debug.LogError(i + ", Normal tex: " + Textures[i].NormalPath);
                Debug.LogError(e);
            }
        }
    }
Exemplo n.º 3
0
    public void LoadStratumScdTextures(bool Loading = true)
    {
        // Load Stratum Textures Paths


        bool NormalMapFix = false;

        for (int i = 0; i < Textures.Length; i++)
        {
            if (Loading)
            {
                MapLuaParser.Current.InfoPopup.Show(true, "Loading map...\n( Stratum textures " + (i + 1) + " )");

                if (i >= map.Layers.Count)
                {
                    map.Layers.Add(new Layer());
                }

                Textures[i].AlbedoPath = GetGamedataFile.FixMapsPath(map.Layers[i].PathTexture);
                if (Textures[i].AlbedoPath.StartsWith("/"))
                {
                    Textures[i].AlbedoPath = Textures[i].AlbedoPath.Remove(0, 1);
                }
                Textures[i].AlbedoScale = map.Layers[i].ScaleTexture;


                if (string.IsNullOrEmpty(map.Layers[i].PathNormalmap))
                {
                    if (i == 9)
                    {
                        // Upper stratum normal should be empty!
                        Textures[i].NormalPath = "";
                        Debug.Log("Clear Upper stratum normal map");
                    }
                    else
                    {
                        Textures[i].NormalPath = "env/tundra/layers/tund_sandlight_normal.dds";
                        Debug.Log("Add missing normalmap on stratum " + i);
                        NormalMapFix = true;
                    }
                }
                else
                {
                    if (i == 9)
                    {
                        // Upper stratum normal should be empty!
                        Textures[i].NormalPath = "";
                        NormalMapFix           = true;
                    }
                    else
                    {
                        Textures[i].NormalPath = GetGamedataFile.FixMapsPath(map.Layers[i].PathNormalmap);
                        if (Textures[i].NormalPath.StartsWith("/"))
                        {
                            Textures[i].NormalPath = Textures[i].NormalPath.Remove(0, 1);
                        }
                    }
                }
                Textures[i].NormalScale = map.Layers[i].ScaleNormalmap;
            }


            /*string Env = GetGamedataFile.EnvScd;
             * if (GetGamedataFile.IsMapPath(Textures[i].AlbedoPath))
             *      Env = GetGamedataFile.MapScd;*/

            try
            {
                Textures[i].AlbedoPath = GetGamedataFile.FindFile(Textures[i].AlbedoPath);
                //Debug.Log("Found: " + Textures[i].AlbedoPath);
                GetGamedataFile.LoadTextureFromGamedata(Textures[i].AlbedoPath, i, false);
            }
            catch (System.Exception e)
            {
                Debug.LogError(i + ", Albedo tex: " + Textures[i].AlbedoPath);
                Debug.LogError(e);
            }

            /*Env = GetGamedataFile.EnvScd;
            *  if (GetGamedataFile.IsMapPath(Textures[i].NormalPath))
            *       Env = GetGamedataFile.MapScd;*/

            try
            {
                Textures[i].NormalPath = GetGamedataFile.FindFile(Textures[i].NormalPath);
                //Debug.Log("Found: " + Textures[i].NormalPath);
                GetGamedataFile.LoadTextureFromGamedata(Textures[i].NormalPath, i, true);
            }
            catch (System.Exception e)
            {
                Debug.LogError(i + ", Normal tex: " + Textures[i].NormalPath);
                Debug.LogError(e);
            }
        }


        if (NormalMapFix)
        {
            GenericInfoPopup.ShowInfo("Fixed wrong or missing normalmap textures on stratum layers");
        }
    }