コード例 #1
0
ファイル: CtrImageBlock.cs プロジェクト: week9/Switch-Toolbox
        public override void Replace(string FileName)
        {
            CTR_3DSTextureImporter  importer = new CTR_3DSTextureImporter();
            CTR_3DSImporterSettings settings = new CTR_3DSImporterSettings();

            settings.LoadBitMap(FileName);
            importer.LoadSettings(new List <CTR_3DSImporterSettings>()
            {
                settings,
            });
            settings.MipCount = 1;
            settings.Format   = CTR_3DS.ConvertToPICAFormat(Format);

            if (importer.ShowDialog() == DialogResult.OK)
            {
                if (settings.GenerateMipmaps && !settings.IsFinishedCompressing)
                {
                    settings.DataBlockOutput.Clear();
                    settings.DataBlockOutput.Add(settings.GenerateMips());
                }

                ApplySettings(settings);
                UpdateEditor();
            }
        }
コード例 #2
0
            public override void Replace(string FileName)
            {
                CTR_3DSTextureImporter  importer = new CTR_3DSTextureImporter();
                CTR_3DSImporterSettings settings = new CTR_3DSImporterSettings();

                if (Utils.GetExtension(FileName) == ".dds" ||
                    Utils.GetExtension(FileName) == ".dds2")
                {
                    settings.LoadDDS(FileName);
                    importer.LoadSettings(new List <CTR_3DSImporterSettings>()
                    {
                        settings,
                    });

                    ApplySettings(settings);
                    UpdateEditor();
                }
                else
                {
                    settings.LoadBitMap(FileName);
                    settings.Format = CTR_3DS.ConvertToPICAFormat(Format);
                    if (MipCount == 1)
                    {
                        settings.MipCount = 1;
                    }
                    importer.LoadSettings(new List <CTR_3DSImporterSettings>()
                    {
                        settings,
                    });

                    if (importer.ShowDialog() == DialogResult.OK)
                    {
                        if (settings.GenerateMipmaps && !settings.IsFinishedCompressing)
                        {
                            settings.DataBlockOutput.Clear();
                            settings.DataBlockOutput.Add(settings.GenerateMips());
                        }

                        Console.WriteLine($"ImageSize {this.ImageData.Length} {settings.DataBlockOutput[0]}");

                        ApplySettings(settings);
                        UpdateEditor();
                    }
                }
            }
コード例 #3
0
ファイル: TEX3DS.cs プロジェクト: week9/Switch-Toolbox
        public override void Replace(string FileName)
        {
            CTR_3DSTextureImporter  importer = new CTR_3DSTextureImporter();
            CTR_3DSImporterSettings settings = new CTR_3DSImporterSettings();

            if (Utils.GetExtension(FileName) == ".dds" ||
                Utils.GetExtension(FileName) == ".dds2")
            {
                settings.LoadDDS(FileName);
                importer.LoadSettings(new List <CTR_3DSImporterSettings>()
                {
                    settings,
                });

                ApplySettings(settings);
                UpdateEditor();
            }
            else
            {
                settings.LoadBitMap(FileName);
                importer.LoadSettings(new List <CTR_3DSImporterSettings>()
                {
                    settings,
                });

                if (importer.ShowDialog() == DialogResult.OK)
                {
                    if (settings.GenerateMipmaps && !settings.IsFinishedCompressing)
                    {
                        settings.DataBlockOutput.Clear();
                        settings.DataBlockOutput.Add(settings.GenerateMips());
                    }

                    ApplySettings(settings);
                    UpdateEditor();
                }
            }
        }