예제 #1
0
파일: Unity3d.cs 프로젝트: kkdevs/sb3u
        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);
                }
            }
        }
예제 #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);
            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);
                }
            }
        }
예제 #3
0
        public static void ReplaceTexture(UnityParser parser, ImportedTexture texture)
        {
            Texture2D tex = parser.GetTexture(Path.GetFileNameWithoutExtension(texture.Name));

            if (tex == null)
            {
                parser.AddTexture(texture);
                return;
            }
            ReplaceTexture(tex, texture);
        }