Exemple #1
0
            public void BatchExport(object sender, EventArgs args)
            {
                OpenFileDialog ofd = new OpenFileDialog();

                ofd.Multiselect = true;
                ofd.Filter      = "Supported Formats|*.bin";
                if (ofd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                FolderSelectDialog folderDlg = new FolderSelectDialog();

                if (folderDlg.ShowDialog() == DialogResult.OK)
                {
                    foreach (var file in ofd.FileNames)
                    {
                        LM2_ARCADE_Model model = new LM2_ARCADE_Model();
                        var stream             = File.Open(file, FileMode.Open);
                        model.Load(stream);
                        stream.Dispose();

                        string Path = System.IO.Path.Combine(folderDlg.SelectedPath,
                                                             System.IO.Path.GetFileNameWithoutExtension(file) + ".dae");

                        model.ExportModel(Path, new DAE.ExportSettings());
                        model.Unload();
                    }
                }
            }
Exemple #2
0
            public void BatchExportCombined(object sender, EventArgs args)
            {
                OpenFileDialog ofd = new OpenFileDialog();

                ofd.Multiselect = true;
                ofd.Filter      = "Supported Formats|*.bin";
                if (ofd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                SaveFileDialog sfd = new SaveFileDialog();

                sfd.Filter = "Supported Formats|*.dae";
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    List <STGenericObject>   Objects   = new List <STGenericObject>();
                    STSkeleton               Skeleton  = new STSkeleton();
                    List <STGenericMaterial> Materials = new List <STGenericMaterial>();

                    int MatIndex = 0;
                    foreach (var file in ofd.FileNames)
                    {
                        LM2_ARCADE_Model model = new LM2_ARCADE_Model();
                        var stream             = File.Open(file, FileMode.Open);
                        model.Load(stream);
                        stream.Dispose();

                        foreach (STGenericMaterial mat in model.Nodes[0].Nodes)
                        {
                            mat.Text = $"Material {MatIndex++}";
                            Materials.Add(mat);
                        }

                        Skeleton.bones.AddRange(((STSkeleton)model.DrawableContainer.Drawables[0]).bones);
                        Objects.AddRange(((GenericModelRenderer)model.DrawableContainer.Drawables[1]).Meshes);

                        model.Unload();
                    }

                    ExportModelSettings settings = new ExportModelSettings();
                    if (settings.ShowDialog() == DialogResult.OK)
                    {
                        DAE.Export(sfd.FileName, settings.Settings, Objects, Materials, new List <STGenericTexture>(), Skeleton);
                    }
                }
            }