Example #1
0
        public static void ExportTexture([DefaultVar] UnityParser parser, string name, string path)
        {
            string folder = Path.GetDirectoryName(path);

            if (folder.Length > 0)
            {
                folder += "\\";
            }
            folder += Path.GetFileNameWithoutExtension(path);
            if (name != "*")
            {
                Texture2D tex = parser.GetTexture(name);
                if (tex != null)
                {
                    tex.Export(folder);
                }
            }
            else
            {
                for (int i = 0; i < parser.Textures.Count; i++)
                {
                    Texture2D tex = parser.GetTexture(i);
                    tex.Export(folder);
                }
            }
        }
Example #2
0
        public static void ExportTexture([DefaultVar] UnityParser parser, string name, string path)
        {
            string folder = Path.GetDirectoryName(path);

            if (folder.Length > 0)
            {
                folder += "\\";
            }
            folder += Path.GetFileNameWithoutExtension(path);
            ImageFileFormat preferredUncompressedFormat = (string)Properties.Settings.Default["ExportUncompressedAs"] == "BMP"
                                ? ImageFileFormat.Bmp : (ImageFileFormat)(-1);

            if (name != "*")
            {
                Texture2D tex = parser.GetTexture(name);
                if (tex != null)
                {
                    tex.Export(folder, preferredUncompressedFormat);
                }
            }
            else
            {
                for (int i = 0; i < parser.Textures.Count; i++)
                {
                    Texture2D tex = parser.GetTexture(i);
                    tex.Export(folder, preferredUncompressedFormat);
                }
            }
        }
Example #3
0
            private void ConvertTexture2D(Texture2D tex2D, string name)
            {
                ImportedTexture iTex = ImportedHelpers.FindTexture(name, TextureList);

                if (iTex != null)
                {
                    return;
                }

                using (MemoryStream memStream = new MemoryStream())
                {
                    tex2D.Export(memStream);

                    memStream.Position = 0;
                    iTex = new ImportedTexture(memStream, name);
                }
                TextureList.Add(iTex);
            }
Example #4
0
        public void ExportTexture2D(Component asset, string path)
        {
            Texture2D tex = LoadWhenNeeded(asset);

            tex.Export(path);
        }
Example #5
0
            private void ConvertTexture2D(Texture2D tex2D, string name)
            {
                ImportedTexture iTex = ImportedHelpers.FindTexture(name, TextureList);
                if (iTex != null)
                {
                    return;
                }

                using (MemoryStream memStream = new MemoryStream())
                {
                    tex2D.Export(memStream);

                    memStream.Position = 0;
                    iTex = new ImportedTexture(memStream, name);
                }
                TextureList.Add(iTex);
            }