示例#1
0
        private void RenderTexture(GLControl glControl1, NUT nut)
        {
            if (nut == null)
            {
                return;
            }
            glControl1.MakeCurrent();
            GL.Viewport(glControl1.ClientRectangle);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            GL.ClearColor(Color.White);
            GL.Enable(EnableCap.Texture2D);
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);

            GL.MatrixMode(MatrixMode.Modelview);
            GL.LoadIdentity();
            GL.MatrixMode(MatrixMode.Projection);

            foreach (NUT.NUD_Texture tex in nut.textures)
            {
                RenderTools.DrawTexturedQuad(nut.draw[tex.id], tex.width, tex.height, true, true, true, true, false, true);
            }

            glControl1.SwapBuffers();
        }
示例#2
0
        private void importBack(string filename)
        {
            if (dontModify)
            {
                return;
            }

            NutTexture tex = textureFromFile[filename];

            try
            {
                DDS        dds  = new DDS(new FileData(filename));
                NutTexture ntex = dds.ToNutTexture();

                tex.Height = ntex.Height;
                tex.Width  = ntex.Width;
                tex.pixelInternalFormat = ntex.pixelInternalFormat;
                tex.surfaces            = ntex.surfaces;
                tex.pixelFormat         = ntex.pixelFormat;

                //GL.DeleteTexture(NUT.glTexByHashId[tex.HASHID]);
                currentNut.glTexByHashId.Remove(tex.HashId);
                currentNut.glTexByHashId.Add(tex.HashId, NUT.CreateTexture2D(tex));

                FillForm();
                textureListBox.SelectedItem = tex;
                glControl1.Invalidate();
            }
            catch
            {
                Console.WriteLine("Could not be open for editing");
            }
        }
示例#3
0
 public static void Setup()
 {
     cubeTex    = LoadCubeMap();
     defaultTex = NUT.loadImage(Smash_Forge.Resources.Resources.DefaultTexture);
     GL.GenVertexArrays(1, out cubeVAO);
     GL.GenBuffers(1, out cubeVBO);
 }
示例#4
0
        private void RenderTexture(GLControl glControl1, NUT nut)
        {
            if (nut == null)
            {
                return;
            }
            glControl1.MakeCurrent();
            GL.Viewport(glControl1.ClientRectangle);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            GL.ClearColor(Color.Black);
            GL.Enable(EnableCap.Texture2D);
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);

            GL.MatrixMode(MatrixMode.Modelview);
            GL.LoadIdentity();
            GL.MatrixMode(MatrixMode.Projection);

            foreach (NutTexture tex in nut.Nodes)
            {
                ScreenDrawing.DrawTexturedQuad(nut.glTexByHashId[tex.HashId].Id, tex.Width, tex.Height, screenVao, true, true, true, true, true);
            }

            glControl1.SwapBuffers();
        }
示例#5
0
        private void newNUTToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NUT n = new NUT();

            Runtime.TextureContainers.Add(n);
            FillForm();
        }
        public void Set(NUT n)
        {
            this.nut = n;
            if (n.Nodes.Count == 0)
            {
                return;
            }
            int hash = ((NUT_Texture)n.Nodes[0]).HASHID;
            int type = hash >> 24;
            int chr  = (hash >> 16) & 0xFF;
            int slot = (hash >> 8) & 0xFF;

            Console.WriteLine(hash.ToString("x"));

            foreach (KeyValuePair <string, int> p in types)
            {
                if (p.Value == type)
                {
                    typeCB.SelectedItem = p.Key;
                    break;
                }
            }

            foreach (KeyValuePair <string, int> p in characters)
            {
                if (p.Value == chr)
                {
                    characterCB.SelectedItem = p.Key;
                    break;
                }
            }

            slotUD.Value = slot;
        }
示例#7
0
        private void importBack(string filename)
        {
            if (dontModify)
            {
                return;
            }

            NUT.NUD_Texture tex = textureFromFile[filename];

            try
            {
                DDS             dds  = new DDS(new FileData(filename));
                NUT.NUD_Texture ntex = dds.toNUT_Texture();

                tex.height  = ntex.height;
                tex.width   = ntex.width;
                tex.type    = ntex.type;
                tex.mipmaps = ntex.mipmaps;
                tex.utype   = ntex.utype;

                GL.DeleteTexture(selected.draw[tex.id]);
                selected.draw.Remove(tex.id);
                selected.draw.Add(tex.id, NUT.loadImage(tex));

                FillForm();
                listBox1.SelectedItem = selected;
                listBox2.SelectedItem = tex;
                RenderTexture();
            }
            catch
            {
                Console.WriteLine("Could not be open for editing");
            }
        }
示例#8
0
        private void replaceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var ofd = new OpenFileDialog())
            {
                ofd.Filter = "Direct Draw Surface (.dds)|*.dds|" +
                             "All files(*.*)|*.*";

                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    if (ofd.FileName.EndsWith(".dds") && selected != null)
                    {
                        NUT.NUD_Texture tex = (NUT.NUD_Texture)(listBox2.SelectedItem);

                        DDS             dds  = new DDS(new FileData(ofd.FileName));
                        NUT.NUD_Texture ntex = dds.toNUT_Texture();

                        tex.height  = ntex.height;
                        tex.width   = ntex.width;
                        tex.type    = ntex.type;
                        tex.mipmaps = ntex.mipmaps;
                        tex.utype   = ntex.utype;

                        GL.DeleteTexture(selected.draw[tex.id]);
                        selected.draw.Remove(tex.id);
                        selected.draw.Add(tex.id, NUT.loadImage(tex));

                        FillForm();
                        listBox1.SelectedItem = selected;
                    }
                }
            }
        }
示例#9
0
 private NUT ReplaceTexture(NUT.NUD_Texture tex, int width, int height, NUT nut)
 {
     if (tex.width == width && tex.height == height)
     {
         tex.id = 0x280052B7;
         if (nut != null && nut.textures.Count > 0)
         {
             tex.id = nut.textures[0].id;
             nut.Destroy();
         }
         if (nut == null)
         {
             nut = new NUT();
         }
         nut.textures.Clear();
         nut.draw.Clear();
         nut.textures.Add(tex);
         nut.draw.Add(tex.id, NUT.loadImage(tex));
     }
     else
     {
         MessageBox.Show("Dimensions must be " + width + "x" + height);
     }
     return(nut);
 }
        public void ReadParameters(FileData f, int count)
        {
            for (int i = 0; i < count; i++)
            {
                BCH_TextureParameter p = new BCH_TextureParameter()
                {
                    Value = f.readInt()
                };
                p.ParseParameter(f.readInt());

                Nodes.Add(p);

                if (p.Id == BCH_TextureParameter.Parameter.texUnit0Size)
                {
                    Width  = p.GetHalf1();
                    Height = p.GetHalf2();
                }
                if (p.Id == BCH_TextureParameter.Parameter.texUnit0Type)
                {
                    type = p.Value;
                }
                if (p.Id == BCH_TextureParameter.Parameter.texUnit0Address)
                {
                    data = f.getSection(p.Value, f.size() - p.Value);
                }
            }
            if (Width > 0 && Height > 0)
            {
                texture = _3DS.DecodeImage(data, Width, Height, (_3DS.Tex_Formats)type);
                display = NUT.loadImage(texture);
            }
        }
示例#11
0
        public void Set(NUT n)
        {
            this.nut = n;
            int hash = n.textures[0].id;
            int type = hash >> 24;
            int chr  = (hash >> 16) & 0xFF;
            int slot = (hash >> 8) & 0xFF;

            Console.WriteLine(hash.ToString("x"));

            foreach (KeyValuePair <string, int> p in types)
            {
                if (p.Value == type)
                {
                    typeCB.SelectedItem = p.Key;
                    break;
                }
            }

            foreach (KeyValuePair <string, int> p in characters)
            {
                if (p.Value == chr)
                {
                    characterCB.SelectedItem = p.Key;
                    break;
                }
            }

            slotUD.Value = slot;
        }
示例#12
0
        // I'm completely totally serious

        public static NUD Create(VBN vbn)
        {
            NUD nud = new NUD();

            NUD.Mesh head = new NUD.Mesh();
            nud.mesh.Add(head);
            head.Text = "Skapon";

            NUT nut = new NUT();

            NUT.NUD_Texture tex = new DDS(new FileData("Skapon//tex.dds")).toNUT_Texture();
            nut.textures.Add(tex);
            Random random       = new Random();
            int    randomNumber = random.Next(0, 0xFFFFFF);

            tex.id = 0x40000000 + randomNumber;
            nut.draw.Add(tex.id, NUT.loadImage(tex));

            head.polygons.Add(setToBone(scale(readPoly(File.ReadAllText("Skapon//head.obj")), 1, 1, 1), vbn.bones[vbn.boneIndex("HeadN")], vbn));
            head.polygons.Add(setToBone(scale(readPoly(File.ReadAllText("Skapon//body.obj")), 1, 1, 1), vbn.bones[vbn.boneIndex("BustN")], vbn));
            head.polygons.Add(setToBone(scale(readPoly(File.ReadAllText("Skapon//hand.obj")), 1, 1, 1), vbn.bones[vbn.boneIndex("RHandN")], vbn));
            head.polygons.Add(setToBone(scale(readPoly(File.ReadAllText("Skapon//hand.obj")), -1, -1, 1), vbn.bones[vbn.boneIndex("LHandN")], vbn));
            head.polygons.Add(setToBone(scale(readPoly(File.ReadAllText("Skapon//foot.obj")), 1, 1, 1), vbn.bones[vbn.boneIndex("RFootJ")], vbn));
            head.polygons.Add(setToBone(scale(readPoly(File.ReadAllText("Skapon//foot.obj")), -1, -1, -1), vbn.bones[vbn.boneIndex("LFootJ")], vbn));

            foreach (NUD.Polygon p in head.polygons)
            {
                p.materials[0].textures[0].hash = tex.id;
            }

            return(nud);
        }
示例#13
0
 public static void ShowGtxMipmapWarning(NUT nut)
 {
     if (nut.ContainsGtxTextures())
     {
         MessageBox.Show("Mipmaps will not be exported correctly for some textures.", "GTX textures detected");
     }
 }
示例#14
0
 private NUT ReplaceTexture(NutTexture tex, int width, int height, NUT nut)
 {
     if (tex.Width == width && tex.Height == height)
     {
         tex.HASHID = 0x280052B7;
         if (nut != null && nut.Nodes.Count > 0)
         {
             tex.HASHID = ((NutTexture)nut.Nodes[0]).HASHID;
             nut.Destroy();
         }
         if (nut == null)
         {
             nut = new NUT();
         }
         nut.Nodes.Clear();
         nut.glTexByHashId.Clear();
         nut.Nodes.Add(tex);
         nut.glTexByHashId.Add(tex.HASHID, NUT.CreateGlTexture(tex));
     }
     else
     {
         MessageBox.Show("Dimensions must be " + width + "x" + height);
     }
     return(nut);
 }
示例#15
0
        private void importToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (selected != null)
            {
                using (var ofd = new OpenFileDialog())
                {
                    ofd.Filter = "Supported Formats|*.dds;*.png|" +
                                 "Direct Draw Surface (.dds)|*.dds|" +
                                 "Portable Networks Graphic (.png)|*.png|" +
                                 "All files(*.*)|*.*";

                    if (ofd.ShowDialog() == DialogResult.OK)
                    {
                        int  texId;
                        bool isTex = int.TryParse(Path.GetFileNameWithoutExtension(ofd.FileName), NumberStyles.HexNumber,
                                                  new CultureInfo("en-US"), out texId);

                        if (isTex)
                        {
                            foreach (NUT.NUD_Texture te in selected.textures)
                            {
                                if (texId == te.id)
                                {
                                    isTex = false;
                                }
                            }
                        }

                        NUT.NUD_Texture tex = null;

                        if (ofd.FileName.EndsWith(".dds") && selected != null)
                        {
                            DDS dds = new DDS(new FileData(ofd.FileName));
                            tex = dds.toNUT_Texture();
                        }
                        if (ofd.FileName.EndsWith(".png") && selected != null)
                        {
                            tex = fromPNG(ofd.FileName, 1);
                        }

                        if (tex != null)
                        {
                            if (isTex)
                            {
                                tex.id = texId;
                            }
                            else
                            {
                                tex.id = 0x40FFFF00 | (selected.textures.Count);
                            }
                            selected.textures.Add(tex);
                            selected.draw.Add(tex.id, NUT.loadImage(tex));
                            FillForm();
                            listBox1.SelectedItem = selected;
                        }
                    }
                }
            }
        }
示例#16
0
 public UIPreview(NUT chr_00, NUT chr_11, NUT chr_13, NUT stock_90)
 {
     InitializeComponent();
     this.chr_00   = chr_00;
     this.chr_11   = chr_11;
     this.chr_13   = chr_13;
     this.stock_90 = stock_90;
 }
示例#17
0
        public NUTEditor(string filePath) : this()
        {
            NUT nut = new NUT(filePath);

            FilePath = filePath;
            Edited   = false;
            SelectNUT(nut);
        }
示例#18
0
        private void SelectNUT(NUT n)
        {
            selected = n;

            listBox2.Items.Clear();
            foreach (NUT.NUD_Texture tex in n.textures)
            {
                listBox2.Items.Add(tex);
            }
        }
示例#19
0
 public void OpenNut(string pathNUT)
 {
     if (string.IsNullOrEmpty(pathNUT))
     {
         return;
     }
     NUT = new NUT(pathNUT);
     Runtime.TextureContainers.Add(NUT);
     Runtime.glTexturesNeedRefreshing = true;
 }
示例#20
0
        private void RegenerateAllMipMaps_Click(object sender, EventArgs e)
        {
            foreach (NutTexture texture in currentNut.Nodes)
            {
                NUT.RegenerateMipmapsFromTexture2D(texture);
            }

            // Refresh the textures.
            currentNut.RefreshGlTexturesByHashId();
            glControl1.Invalidate();
        }
示例#21
0
 /*
  * This method is for clearing all the GL stuff
  * Don't want wasted buffers :>
  * */
 public void Destroy()
 {
     if (NUD != null)
     {
         NUD.Destroy();
     }
     if (NUT != null)
     {
         NUT.Destroy();
     }
 }
示例#22
0
        // I'm completely totally serious

        public static NUD Create(VBN vbn)
        {
            Dictionary <string, string> files = new Dictionary <string, string>();
            ZipArchive zip = ZipFile.OpenRead("lib\\Skapon.zip");

            Random random       = new Random();
            int    randomNumber = random.Next(0, 0xFFFFFF);

            NUT nut = new NUT();

            foreach (ZipArchiveEntry e in zip.Entries)
            {
                byte[] b;
                using (BinaryReader br = new BinaryReader(e.Open()))
                {
                    b = br.ReadBytes((int)e.Length);
                }
                var    stream = new StreamReader(new MemoryStream(b));
                string s      = stream.ReadToEnd();
                files.Add(e.Name, s);

                if (e.Name.EndsWith(".dds"))
                {
                    NutTexture tex = new DDS(new FileData(b)).ToNutTexture();
                    nut.Nodes.Add(tex);
                    tex.HashId = 0x40000000 + randomNumber;
                    nut.glTexByHashId.Add(tex.HashId, NUT.CreateTexture2D(tex));
                }
            }

            NUD nud = new NUD();

            NUD.Mesh head = new NUD.Mesh();
            nud.Nodes.Add(head);
            head.Text = "Skapon";

            head.Nodes.Add(setToBone(scale(readPoly(files["head.obj"]), 1, 1, 1), vbn.bones[vbn.boneIndex("HeadN")], vbn));
            head.Nodes.Add(setToBone(scale(readPoly(files["body.obj"]), 1, 1, 1), vbn.bones[vbn.boneIndex("BustN")], vbn));
            head.Nodes.Add(setToBone(scale(readPoly(files["hand.obj"]), 1, 1, 1), vbn.bones[vbn.boneIndex("RHandN")], vbn));
            head.Nodes.Add(setToBone(scale(readPoly(files["hand.obj"]), -1, -1, 1), vbn.bones[vbn.boneIndex("LHandN")], vbn));
            head.Nodes.Add(setToBone(scale(readPoly(files["foot.obj"]), 1, 1, 1), vbn.bones[vbn.boneIndex("RFootJ")], vbn));
            head.Nodes.Add(setToBone(scale(readPoly(files["foot.obj"]), -1, -1, -1), vbn.bones[vbn.boneIndex("LFootJ")], vbn));

            foreach (NUD.Polygon p in head.Nodes)
            {
                p.materials[0].textures[0].hash = 0x40000000 + randomNumber;
            }

            nud.UpdateRenderMeshes();

            return(nud);
        }
示例#23
0
 public ModelContainer()
 {
     ImageKey         = "folder";
     SelectedImageKey = "folder";
     nud     = new NUD();
     nut     = new NUT();
     mta     = new MTA();
     MOI     = new MOI();
     jtb     = new JTB();
     XMB     = new XMBFile();
     Checked = true;
     Refresh();
 }
示例#24
0
        private void replaceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var ofd = new OpenFileDialog())
            {
                NUT.NUD_Texture tex = (NUT.NUD_Texture)(listBox2.SelectedItem);

                if (tex.type == PixelInternalFormat.Rgba)
                {
                    ofd.Filter = "Portable Networks Graphic (.png)|*.png|" +
                                 "All files(*.*)|*.*";
                }
                else
                {
                    ofd.Filter = "Direct Draw Surface (.dds)|*.dds|" +
                                 "All files(*.*)|*.*";
                }

                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    NUT.NUD_Texture ntex = null;
                    if (ofd.FileName.EndsWith(".dds") && selected != null)
                    {
                        DDS dds = new DDS(new FileData(ofd.FileName));
                        ntex = dds.toNUT_Texture();
                    }

                    if (ofd.FileName.EndsWith(".png") && selected != null)
                    {
                        ntex = fromPNG(ofd.FileName, 1);
                    }

                    tex.height  = ntex.height;
                    tex.width   = ntex.width;
                    tex.type    = ntex.type;
                    tex.mipmaps = ntex.mipmaps;
                    tex.utype   = ntex.utype;

                    if (ntex == null)
                    {
                        return;
                    }

                    GL.DeleteTexture(selected.draw[tex.id]);
                    selected.draw.Remove(tex.id);
                    selected.draw.Add(tex.id, NUT.loadImage(tex));

                    FillForm();
                    listBox1.SelectedItem = selected;
                }
            }
        }
示例#25
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();
     }
 }
示例#26
0
        private void replaceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (currentNut == null || textureListBox.SelectedItem == null)
            {
                return;
            }
            using (var ofd = new OpenFileDialog())
            {
                NutTexture texture = (NutTexture)(textureListBox.SelectedItem);

                ofd.Filter = "Supported Formats|*.dds;*.png|" +
                             "DirectDraw Surface (.dds)|*.dds|" +
                             "Portable Network Graphics (.png)|*.png|" +
                             "All files(*.*)|*.*";

                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    NutTexture newTexture = null;
                    string     extension  = Path.GetExtension(ofd.FileName).ToLowerInvariant();
                    if (extension == ".dds")
                    {
                        DDS dds = new DDS(new FileData(ofd.FileName));
                        newTexture = dds.ToNutTexture();
                    }
                    else if (extension == ".png")
                    {
                        newTexture = fromPNG(ofd.FileName, 1);
                    }
                    else
                    {
                        return;
                    }

                    texture.Height = newTexture.Height;
                    texture.Width  = newTexture.Width;
                    texture.pixelInternalFormat = newTexture.pixelInternalFormat;
                    texture.surfaces            = newTexture.surfaces;
                    texture.pixelFormat         = newTexture.pixelFormat;

                    Edited = true;

                    //GL.DeleteTexture(NUT.glTexByHashId[texture.HASHID]);
                    currentNut.glTexByHashId.Remove(texture.HashId);
                    currentNut.glTexByHashId.Add(texture.HashId, NUT.CreateTexture2D(texture));

                    FillForm();
                }
            }
        }
示例#27
0
        public static void PromptUserToConfirmMipRegenIfGtx(NUT nut)
        {
            if (nut.ContainsGtxTextures())
            {
                MessageBox.Show("Mipmaps will not be exported correctly for some textures.", "GTX textures detected");

                // TODO: Doesn't work properly in game.
                //DialogResult result = MessageBox.Show("Mipmaps will not be exported correctly for some textures. " +
                //    "Would you like to regenerate all mipmaps? Note: this will modify the existing textures.",
                //    "GTX textures detected", MessageBoxButtons.YesNo);
                //if (result == DialogResult.Yes)
                //{
                //    foreach (NutTexture texture in nut.Nodes)
                //    {
                //        NUT.RegenerateMipmapsFromTexture2D(texture);
                //    }
                //}
            }
        }
示例#28
0
        private void mipLevelTrackBar_Scroll(object sender, EventArgs e)
        {
            NutTexture tex = ((NutTexture)textureListBox.SelectedItem);

            if (tex.surfaces.Count == 6)
            {
                // Create a new texture for the selected surface at the first mip level.
                currentMipLevel = 0;
                SetCurrentCubeMapFaceLabel(mipLevelTrackBar.Value);
                textureToRender = NUT.CreateTexture2D(tex, mipLevelTrackBar.Value);
            }
            else
            {
                // Regular texture.
                currentMipLevel = mipLevelTrackBar.Value;
            }

            glControl1.Invalidate();
        }
示例#29
0
        public UIPreview(NUT chr_00, NUT chr_11, NUT chr_13, NUT stock_90)
        {
            InitializeComponent();
            if (chr_00 == null)
            {
                chr_00 = new NUT();
            }
            if (chr_11 == null)
            {
                chr_11 = new NUT();
            }
            if (chr_13 == null)
            {
                chr_13 = new NUT();
            }
            if (stock_90 == null)
            {
                stock_90 = new NUT();
            }
            this.chr_00   = chr_00;
            this.chr_11   = chr_11;
            this.chr_13   = chr_13;
            this.stock_90 = stock_90;

            ContextMenu cm       = new ContextMenu();
            MenuItem    snapShot = new MenuItem("Begin Snapshot");

            snapShot.Click += SnapShotMode;
            cm.MenuItems.Add(snapShot);
            MenuItem snapShot2 = new MenuItem("Snapshot");

            snapShot2.Click += LetsDance;
            cm.MenuItems.Add(snapShot2);
            chr_00_renderer.ContextMenu = cm;
            chr_11_renderer.ContextMenu = cm;
            chr_13_renderer.ContextMenu = cm;

            stock_90_renderer.AllowDrop = true;
            chr_00_renderer.AllowDrop   = true;
            chr_11_renderer.AllowDrop   = true;
            chr_13_renderer.AllowDrop   = true;
            //stock_90_renderer.ContextMenu = cm;
        }
示例#30
0
        private void importToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var ofd = new OpenFileDialog())
            {
                ofd.Filter = "Direct Draw Surface (.dds)|*.dds|" +
                             "All files(*.*)|*.*";

                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    if (ofd.FileName.EndsWith(".dds") && selected != null)
                    {
                        DDS             dds = new DDS(new FileData(ofd.FileName));
                        NUT.NUD_Texture tex = dds.toNUT_Texture();
                        tex.id = 0x40FFFF00 | (selected.textures.Count);
                        selected.textures.Add(tex);
                        selected.draw.Add(tex.id, NUT.loadImage(tex));
                        FillForm();
                        listBox1.SelectedItem = selected;
                    }
                }
            }
        }