Пример #1
0
        public void DisplayTso()
        {
            if (fDisplayed)
            {
                return;
            }
            fDisplayed = true;

            // ヘビーセーブとして読み込んでみる.
            pngstream = new PNGHSAVStream();
            savedata.Seek(0, SeekOrigin.Begin);
            pngstream.LoadPNGFile(savedata);

            // ヘビーセーブか?
            if (pngstream.count > 0)
            {
                // ヘビーセーブデータをロードする.
                foreach (PNGTsoData tso in pngstream.get)
                {
                    tsoDataList.Add(tso);
                }
            }
            else
            {
                // tsoロード情報があるならこの時点で組み立てる.
                if (loadtsoinfo.Count != 0)
                {
                    assembleTsoData();
                }
            }

            TDCGExplorer.TDCGExplorer.SetToolTips(TextResource.RenderingNow);

            try
            {
                // TSOビューワをリセットする
                TDCGExplorer.TDCGExplorer.MainFormWindow.makeTSOViwer();
                TDCGExplorer.TDCGExplorer.MainFormWindow.clearTSOViewer();

                TDCG.Viewer viewer = TDCGExplorer.TDCGExplorer.MainFormWindow.Viewer;

                bool firstTmoSet = true;
                foreach (PNGTsoData tso in tsoDataList)
                {
                    using (MemoryStream stream = new MemoryStream(tso.tsodata))
                    {
                        viewer.LoadTSOFile(stream);
                        TDCGExplorer.TDCGExplorer.MainFormWindow.doInitialTmoLoad();
                        if (firstTmoSet)
                        {
                            // スライダーパラメータを設定する.
                            TDCG.Figure figure = viewer.FigureList[0];
                            figure.slide_matrices.BustRatio  = savefile.GetSlider(0);
                            figure.slide_matrices.TallRatio  = savefile.GetSlider(1);
                            figure.slide_matrices.ArmRatio   = savefile.GetSlider(2);
                            figure.slide_matrices.LegRatio   = savefile.GetSlider(3);
                            figure.slide_matrices.WaistRatio = savefile.GetSlider(4);
                            figure.slide_matrices.EyeRatio   = savefile.GetSlider(5);
                            figure.UpdateBoneMatrices(true);
                            firstTmoSet = false;
                        }
                        viewer.FrameMove();
                        viewer.Render();

                        TDCGExplorer.TDCGExplorer.IncBusy();
                        Application.DoEvents();
                        TDCGExplorer.TDCGExplorer.DecBusy();
                    }
                }
            }
            catch (Exception)
            {
            }
            TDCGExplorer.TDCGExplorer.SetToolTips(TextResource.RenderingComplete);
        }
Пример #2
0
        private void HeavySave()
        {
            try
            {
                // ヘビーセーブ形式で保存する.
                if (savefilebitmap == null)
                {
                    return;
                }

                // まずPNG形式のデータを作る.
                MemoryStream basepng = new MemoryStream();
                savefilebitmap.Save(basepng, System.Drawing.Imaging.ImageFormat.Png);
                // PNGFileクラスにデータを取り込む.
                PNGHSAVStream pngstream = new PNGHSAVStream();
                basepng.Seek(0, SeekOrigin.Begin);
                PNGFile png = pngstream.GetPNG(basepng);

                // TSOデータを読み込んで組み立てる.
                if (fDisplayed == false)
                {
                    DisplayTso();
                }

                //TSOデータを設定する.
                foreach (PNGTsoData tsodata in tsoDataList)
                {
                    pngstream.get.Add(tsodata);
                }
                // 保存先を決める.
                string savefile_dir  = TDCGExplorer.TDCGExplorer.SystemDB.savefile_directory;
                string savefile_name = Path.GetFileNameWithoutExtension(filename) + ".png";

                SaveFileDialog dialog = new SaveFileDialog();
                dialog.FileName         = filename;
                dialog.InitialDirectory = TDCGExplorer.TDCGExplorer.SystemDB.savefile_directory;
                dialog.Filter           = TextResource.PNGSaveFileDescription;
                dialog.FilterIndex      = 0;
                dialog.Title            = TextResource.SelectSaveFileName;
                dialog.RestoreDirectory = true;
                dialog.OverwritePrompt  = true;
                dialog.CheckPathExists  = true;

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    string destpath = dialog.FileName;

                    // 保存先をオープン.
                    //File.Delete(destpath);
                    TDCGExplorer.TDCGExplorer.FileDelete(destpath);
                    using (Stream output = File.Create(destpath))
                    {
                        // PNGを出力する.
                        pngstream.SavePNGFile(png, output);
                    }
                    // ファイルを追加する.
                    TDCGExplorer.TDCGExplorer.AddFileTree(destpath);
                }
            }
            catch (Exception ex)
            {
                TDCGExplorer.TDCGExplorer.SetToolTips(TextResource.Error + ":" + ex.Message);
            }
        }