Exemple #1
0
        private static void ExportTxd(string txdPath, string saveDirectory)
        {
            if (string.IsNullOrEmpty(txdPath) || string.IsNullOrEmpty(saveDirectory))
            {
                return;
            }

            using (new Timing("Exporting Txd"))
                using (new MemoryCounter())
                    using (new AssetEditing())
                        using (var progress = new ProgressBar("Exporting Txd", 0)) {
                            var txd = new TxdFile(txdPath);

                            progress.Count = txd.TextureCount;

                            foreach (var texture in txd)
                            {
                                try {
                                    using (new Timing("Asset writing"))
                                        AssetDatabase.CreateAsset(texture, Path.Combine(saveDirectory, texture.Name + ".asset"));

                                    progress.Increment(texture.Name);

                                    if (progress.Canceled)
                                    {
                                        break;
                                    }
                                }
                                catch (Exception e) {
                                    Log.Error("Failed to write texture: {0}", e);
                                }
                            }
                        }
        }
Exemple #2
0
        public TxdEditorForm(ExplorerForm ef, string fp, byte[] data)
        {
            InitializeComponent();

            Owner    = ef;
            FilePath = fp;
            Data     = data;

            Txd = new TxdFile(fp);
            Txd.Load(data);

            InitForm();
            UpdateSelectionPropertyGrid();
            UpdatePictureBox();
        }
Exemple #3
0
        public static TxdFile[] Deamon_LoadExternalTextures(string drawablePath)
        {
            Console.WriteLine("Loading external textures");

            var txds = new List <TxdFile>();

            var files = Directory.GetFiles(Path.GetDirectoryName(drawablePath), "*.ytd");

            for (int i = 0; i < files.Length; i++)
            {
                Console.WriteLine("  " + files[i]);

                var txd = new TxdFile();

                txd.Load(files[i]);

                txds.Add(txd);
            }

            return(txds.ToArray());
        }