private void listViewCustom1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewCustom1.SelectedItems.Count > 0)
            {
                SelectedIndex = listViewCustom1.SelectedIndices[0];

                SelectedTexSettings         = settings[listViewCustom1.SelectedIndices[0]];
                formatComboBox.SelectedItem = SelectedTexSettings.Format;

                SetupSettings();

                MipmapNum.Maximum = SelectedTexSettings.GetTotalMipCount() + 1;

                //Force the mip counter to be the selected mip counter
                //Some textures like bflim (used for UI) only have 1
                if (OverrideMipCounter)
                {
                    MipmapNum.Maximum = SelectedTexSettings.MipCount;
                    MipmapNum.Minimum = SelectedTexSettings.MipCount;
                }

                MipmapNum.Value = SelectedTexSettings.MipCount;

                SwizzleNum.Value = (SelectedTexSettings.Swizzle >> 8) & 7;
            }
        }
예제 #2
0
        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();
            }
        }
        public void LoadSetting(CTR_3DSImporterSettings setting)
        {
            settings.Add(setting);

            listViewCustom1.Items.Add(setting.TexName).SubItems.Add(setting.Format.ToString());
            listViewCustom1.Items[0].Selected = true;
            listViewCustom1.Select();
        }
예제 #4
0
 private void ApplySettings(CTR_3DSImporterSettings settings)
 {
     this.ImageData  = settings.DataBlockOutput[0];
     this.Width      = settings.TexWidth;
     this.Height     = settings.TexHeight;
     this.Format     = settings.GenericFormat;
     this.MipCount   = settings.MipCount;
     this.Depth      = settings.Depth;
     this.ArrayCount = (uint)settings.DataBlockOutput.Count;
 }
예제 #5
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();
                    }
                }
            }
예제 #6
0
        private void ApplySettings(CTR_3DSImporterSettings settings)
        {
            if (this.Width != settings.TexWidth)
            {
                throw new Exception("The image should be the same width as the original!");
            }
            if (this.Height != settings.TexHeight)
            {
                throw new Exception("The image should be the same height as the original!");
            }

            this.TextureTGLP.SheetDataList[SheetIndex] = settings.DataBlockOutput[0];
            this.TextureTGLP.Format = (ushort)CTR_3DS.ConvertToPICAFormat(settings.GenericFormat);
            this.Format             = settings.GenericFormat;
            this.MipCount           = settings.MipCount;
            this.Depth      = settings.Depth;
            this.ArrayCount = (uint)settings.DataBlockOutput.Count;
        }
예제 #7
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);
                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();
                }
            }
        }