public TMOFile CreateTmo(TMOAnimItem item) { TMOFile tmo = new TMOFile(); if (item == null) { return(tmo); } string png_file = item.GetPngPath(); string tmo_file = item.GetTmoPath(); if (File.Exists(png_file)) { Console.WriteLine("Load File: " + png_file); tmo = LoadPNGFile(png_file); } else if (File.Exists(tmo_file)) { Console.WriteLine("Load File: " + tmo_file); tmo.Load(tmo_file); } tmo.TruncateFrame(0); // forced pose return(tmo); }
private void btnFlip_Click(object sender, EventArgs e) { int pngsave_row = pngSaveItemBindingSource.Position; int tmoanim_row = tmoAnimItemBindingSource.Position; if (pngsave_row == -1) { return; } if (pngsave_row >= viewer.FigureList.Count) { return; } TMOAnim tmoanim = pngsave.items[pngsave_row].tmoanim; if (tmoanim_row == -1) { return; } TMOAnimItem item = tmoanim.items[tmoanim_row]; TDCG.TMOFlip.TMOFlipProcessor processor = new TDCG.TMOFlip.TMOFlipProcessor(); Figure fig = viewer.FigureList[pngsave_row]; { TMOFile tmo = tmoanim.GetTmo(item); viewer.Solver.Solved = true; processor.Process(fig.Tmo); fig.UpdateNodeMapAndBoneMatrices(); } }
private void gvTMOAnimItems_SelectionChanged(object sender, EventArgs e) { int pngsave_row = pngSaveItemBindingSource.Position; int tmoanim_row = tmoAnimItemBindingSource.Position; if (pngsave_row == -1) { return; } if (pngsave_row >= viewer.FigureList.Count) { return; } TMOAnim tmoanim = pngsave.items[pngsave_row].tmoanim; if (tmoanim_row == -1) { return; } TMOAnimItem item = tmoanim.items[tmoanim_row]; viewer.MotionEnabled = false; Figure fig = viewer.FigureList[pngsave_row]; { TMOFile tmo = tmoanim.GetTmo(item); viewer.Solver.Solved = true; fig.Tmo = tmo; fig.UpdateNodeMapAndBoneMatrices(); } }
private void btnDown_Click(object sender, EventArgs e) { int pngsave_row = pngSaveItemBindingSource.Position; int tmoanim_row = tmoAnimItemBindingSource.Position; if (pngsave_row == -1) { return; } TMOAnim tmoanim = pngsave.items[pngsave_row].tmoanim; if (tmoanim_row == -1) { return; } if (tmoanim_row >= tmoAnimItemBindingSource.Count - 1) { return; } TMOAnimItem item = tmoanim.items[tmoanim_row]; tmoAnimItemBindingSource.Remove(item); tmoAnimItemBindingSource.Insert(tmoanim_row + 1, item); tmoAnimItemBindingSource.Position = tmoanim_row + 1; pngsave.UpdateID(); }
public void SetTmoAnimItem(TMOAnimItem item) { this.item = item; tbPoseFile.Text = ""; tbLength.Text = item.Length.ToString(); tbFaceFile.Text = ""; accelSlider1.Accel = item.Accel; }
private void lvPoses_DoubleClick(object sender, EventArgs e) { if (lvPoses.SelectedItems.Count == 0) { return; } TMOAnimItem item = new TMOAnimItem(); item.LoadPoseFile(lvPoses.SelectedItems[0].Text); tmoAnimItemBindingSource.Add(item); pngsave.UpdateID(); }
public TMOAnimItem Dup() { TMOAnimItem item = new TMOAnimItem(); item.Length = Length; item.Accel = Accel; if (Tmo != null) { item.Tmo = Tmo.Dup(); item.Tmo.LoadTransformationMatrixFromFrame(0); } return(item); }
public TMOFile GetTmo(TMOAnimItem item) { TMOFile tmo; if (item.Tmo != null) { tmo = item.Tmo; tmo.SaveTransformationMatrixToFrame(0); } else { tmo = CreateTmo(item); tmo.LoadTransformationMatrixFromFrame(0); item.Tmo = tmo; } return(tmo); }
public PNGFile CreatePNGFile(TMOAnimItem item) { MemoryStream ms = new MemoryStream(); using (Bitmap bmp = new Bitmap(180, 180, System.Drawing.Imaging.PixelFormat.Format24bppRgb)) { Graphics g = Graphics.FromImage(bmp); Brush brush = new SolidBrush(Color.FromArgb(0xfb, 0xc6, 0xc6)); g.FillRectangle(brush, 0, 0, 180, 180); Font font = new Font(FontFamily.GenericSerif, 36, FontStyle.Bold); g.DrawString(string.Format("{0:D1}-{1:D3}", item.SaveID, item.ID), font, Brushes.Black, 0, 0); bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png); } ms.Seek(0, SeekOrigin.Begin); PNGFile png = new PNGFile(); png.Load(ms); return(png); }
private void gvTMOAnimItems_DoubleClick(object sender, EventArgs e) { int pngsave_row = pngSaveItemBindingSource.Position; int tmoanim_row = tmoAnimItemBindingSource.Position; if (pngsave_row == -1) { return; } if (pngsave_row >= viewer.FigureList.Count) { return; } TMOAnim tmoanim = pngsave.items[pngsave_row].tmoanim; if (tmoanim_row == -1) { return; } TMOAnimItem item = tmoanim.items[tmoanim_row]; tmoAnimItemForm.SetTmoAnimItem(item); Figure fig = viewer.FigureList[pngsave_row]; if (tmoAnimItemForm.ShowDialog(this) == DialogResult.OK) { tmoAnimItemBindingSource.ResetBindings(false); TMOFile tmo = tmoanim.GetTmo(item); viewer.Solver.Solved = true; fig.Tmo = tmo; fig.UpdateNodeMapAndBoneMatrices(); } }