示例#1
0
 private void chr_13_renderer_DragDrop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
         foreach (string filePath in files)
         {
             if (filePath.ToLower().EndsWith(".dds"))
             {
                 DDS dds = new DDS(new FileData(filePath));
                 if (sender == chr_13_renderer)
                 {
                     chr_13 = ReplaceTexture(dds.ToNutTexture(), 416, 416, chr_13);
                     if (chr_13_loc != null)
                     {
                         chr_13.Save(chr_13_loc);
                     }
                 }
                 if (sender == chr_00_renderer)
                 {
                     chr_00 = ReplaceTexture(dds.ToNutTexture(), 128, 128, chr_00);
                     if (chr_00_loc != null)
                     {
                         chr_00.Save(chr_00_loc);
                     }
                 }
                 if (sender == chr_11_renderer)
                 {
                     chr_11 = ReplaceTexture(dds.ToNutTexture(), 384, 384, chr_13);
                     if (chr_11_loc != null)
                     {
                         chr_11.Save(chr_11_loc);
                     }
                 }
             }
             if (filePath.ToLower().EndsWith(".png"))
             {
                 if (sender == stock_90_renderer)
                 {
                     stock_90 = ReplaceTexture(NUTEditor.fromPNG(filePath, 0), 64, 64, chr_13);
                     if (stock_90_loc != null)
                     {
                         stock_90.Save(stock_90_loc);
                     }
                 }
             }
         }
         ((GLControl)sender).Invalidate();
     }
 }
示例#2
0
        private void saveNUTToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var sfd = new SaveFileDialog())
            {
                sfd.Filter = "Namco Universal Texture (.nut)|*.nut|" +
                             "All Files (*.*)|*.*";

                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    if (sfd.FileName.EndsWith(".nut") && selected != null)
                    {
                        selected.Save(sfd.FileName);
                    }
                }
            }
        }
示例#3
0
        private void LetsDance(object sender, EventArgs e)
        {
            Control c = MainForm.Instance.GetActiveModelViewport();

            if (!(c is ModelViewport))
            {
                return;
            }
            ModelViewport view = (ModelViewport)c;

            view.currentMode = ModelViewport.Mode.Normal;

            NUT n = null;

            if (((MenuItem)sender).GetContextMenu().SourceControl == stock_90_renderer)
            {
                n = stock_90;
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_00_renderer)
            {
                n = chr_00;
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_11_renderer)
            {
                n = chr_11;
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_13_renderer)
            {
                n = chr_13;
            }
            if (n == null)
            {
                return;
            }

            byte[] data = RenderTools.DXT5ScreenShot(view.glViewport, view.shootX, view.shootY, view.shootWidth, view.shootHeight);
            int    id   = n.Nodes.Count > 0 ? ((NutTexture)n.Nodes[0]).HashId : 0x280052B7;

            n.Nodes.Clear();
            n.glTexByHashId.Clear();

            NutTexture tex = new NutTexture();

            tex.Width  = view.shootWidth;
            tex.Height = view.shootHeight;
            tex.surfaces.Add(new TextureSurface());
            tex.surfaces[0].mipmaps.Add(FlipDXT5(data, tex.Width, tex.Height));
            tex.pixelInternalFormat = PixelInternalFormat.CompressedRgbaS3tcDxt5Ext;
            tex.HashId = id;
            n.Nodes.Add(tex);
            n.glTexByHashId.Add(tex.HashId, NUT.CreateTexture2D(tex));
            ((MenuItem)sender).GetContextMenu().SourceControl.Invalidate();

            if (((MenuItem)sender).GetContextMenu().SourceControl == stock_90_renderer)
            {
                if (stock_90_loc != null)
                {
                    stock_90.Save(stock_90_loc);
                }
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_00_renderer)
            {
                if (chr_00_loc != null)
                {
                    chr_00.Save(chr_00_loc);
                }
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_11_renderer)
            {
                if (chr_11_loc != null)
                {
                    chr_11.Save(chr_13_loc);
                }
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_13_renderer)
            {
                if (chr_13_loc != null)
                {
                    chr_13.Save(chr_13_loc);
                }
            }
        }
示例#4
0
        private void LetsDance(object sender, EventArgs e)
        {
            VBNViewport view = MainForm.Instance.viewports[0];

            view.CurrentMode = VBNViewport.Mode.Normal;

            NUT n = null;

            if (((MenuItem)sender).GetContextMenu().SourceControl == stock_90_renderer)
            {
                n = stock_90;
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_00_renderer)
            {
                n = chr_00;
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_11_renderer)
            {
                n = chr_11;
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_13_renderer)
            {
                n = chr_13;
            }
            if (n == null)
            {
                return;
            }

            byte[] data = RenderTools.DXT5ScreenShot(view.glControl1, view.shootX, view.shootY, view.shootWidth, view.shootHeight);
            int    id   = n.textures.Count > 0 ? n.textures[0].id : 0x280052B7;

            n.Destroy();
            n.textures.Clear();
            n.draw.Clear();

            NUT.NUD_Texture tex = new NUT.NUD_Texture();
            tex.width  = view.shootWidth;
            tex.height = view.shootHeight;
            tex.mipmaps.Add(FlipDXT5(data, tex.width, tex.height));
            tex.type = PixelInternalFormat.CompressedRgbaS3tcDxt5Ext;
            tex.id   = id;
            n.textures.Add(tex);
            n.draw.Add(tex.id, NUT.loadImage(tex));
            ((MenuItem)sender).GetContextMenu().SourceControl.Invalidate();

            if (((MenuItem)sender).GetContextMenu().SourceControl == stock_90_renderer)
            {
                if (stock_90_loc != null)
                {
                    stock_90.Save(stock_90_loc);
                }
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_00_renderer)
            {
                if (chr_00_loc != null)
                {
                    chr_00.Save(chr_00_loc);
                }
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_11_renderer)
            {
                if (chr_11_loc != null)
                {
                    chr_11.Save(chr_13_loc);
                }
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_13_renderer)
            {
                if (chr_13_loc != null)
                {
                    chr_13.Save(chr_13_loc);
                }
            }
        }