public static void ExportAllMaterialsFromFolder()
        {
            // Get the source model folder and then the output folder.
            using (var folderSelect = new FolderSelectDialog())
            {
                if (folderSelect.ShowDialog() == DialogResult.OK)
                {
                    string[] files = Directory.GetFiles(folderSelect.SelectedPath, "*.nud", SearchOption.AllDirectories);

                    using (var outputFolderSelect = new FolderSelectDialog())
                    {
                        if (outputFolderSelect.ShowDialog() == DialogResult.OK)
                        {
                            for (int i = 0; i < files.Length; i++)
                            {
                                string xmlName        = ModelViewport.ConvertDirSeparatorsToUnderscore(files[i], folderSelect.SelectedPath);
                                NUD    nud            = new NUD(files[i]);
                                string outputFileName = outputFolderSelect.SelectedPath + "\\" + xmlName + ".xml";
                                MaterialXML.ExportMaterialAsXml(nud, outputFileName);
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
 public ATKD_Editor(string atkdPath, ModelViewport mvp)
 {
     InitializeComponent();
     filePath = atkdPath;
     atkd     = new ATKD().Read(filePath);
     InitDataGridTable();
     this.mvp = mvp;
 }
Exemple #3
0
        private void loadViewportButton_Click(object sender, EventArgs e)
        {
            // Compile the MTA just in case and load into the active viewport.
            mta = new MTA();
            mta.Compile(new List <string>(richTextBox1.Text.Split('\n')));
            ModelViewport modelViewport = (ModelViewport)MainForm.Instance.GetActiveModelViewport();

            if (modelViewport != null)
            {
                modelViewport.CurrentMaterialAnimation = mta;
            }
        }
Exemple #4
0
 private void openEditToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (treeView1.SelectedNode.Tag is NUD)
     {
         NUD org = (NUD)treeView1.SelectedNode.Tag;
         foreach (ModelContainer con in Runtime.ModelContainers)
         {
             if (con.nud == org)
             {
                 ModelViewport v = new ModelViewport();
                 v.draw.Add(con);
                 MainForm.Instance.AddDockedControl(v);
                 break;
             }
         }
     }
 }
Exemple #5
0
 private void openEditToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (treeView1.SelectedNode is NUD)
     {
         NUD org = (NUD)treeView1.SelectedNode;
         foreach (TreeNode node in treeView1.Nodes)
         {
             if (node is ModelContainer)
             {
                 ModelContainer con = (ModelContainer)node;
                 if (con.NUD == org)
                 {
                     ModelViewport v = new ModelViewport();
                     v.draw.Add(con);
                     MainForm.Instance.AddDockedControl(v);
                     break;
                 }
             }
         }
     }
 }
Exemple #6
0
        private void SnapShotMode(object sender, EventArgs e)
        {
            Control c = MainForm.Instance.GetActiveModelViewport();

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

            view.currentMode = ModelViewport.Mode.Photoshoot;
            //view.HideAll();

            if (((MenuItem)sender).GetContextMenu().SourceControl == stock_90_renderer)
            {
                view.shootWidth  = 64;
                view.shootHeight = 64;
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_00_renderer)
            {
                view.shootWidth  = 128;
                view.shootHeight = 128;
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_11_renderer)
            {
                view.shootWidth  = 384;
                view.shootHeight = 384;
            }
            if (((MenuItem)sender).GetContextMenu().SourceControl == chr_13_renderer)
            {
                view.shootWidth  = 416;
                view.shootHeight = 416;
            }
            Runtime.renderFloor      = false;
            Runtime.renderBackGround = false;
            Runtime.renderBones      = false;
        }
Exemple #7
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);
                }
            }
        }