예제 #1
0
        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();
            }
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
        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();
        }
예제 #4
0
        private void Animate(PngSaveItem item)
        {
            int pngsave_row = pngSaveItemBindingSource.Position;

            if (pngsave_row == -1)
            {
                return;
            }

            if (pngsave_row >= viewer.FigureList.Count)
            {
                return;
            }

            TMOAnim tmoanim = item.tmoanim;

            tmoanim.SavePoseToFile();
            tmoanim.LoadSource();
            if (tmoanim.SourceTmo.frames != null)
            {
                tmoanim.Process();
                tmoanim.SaveSourceToFile();

                Figure fig = viewer.FigureList[pngsave_row];
                fig.Tmo = tmoanim.SourceTmo;
                fig.TransformTpo();
                fig.UpdateNodeMapAndBoneMatrices();
            }
        }
예제 #5
0
        public static TMOAnim Load(string source_file)
        {
            XmlReader     reader     = XmlReader.Create(source_file);
            XmlSerializer serializer = new XmlSerializer(typeof(TMOAnim));
            TMOAnim       program    = serializer.Deserialize(reader) as TMOAnim;

            reader.Close();
            return(program);
        }
예제 #6
0
 public void LoadPoseFile(string pose_file)
 {
     if (!string.IsNullOrEmpty(pose_file))
     {
         Console.WriteLine("Load File: " + pose_file);
         Tmo = TMOAnim.LoadPNGFile(Path.Combine(PoseRoot, pose_file));
         Tmo.LoadTransformationMatrixFromFrame(0);
     }
     Tmo.TruncateFrame(0); // forced pose
 }
예제 #7
0
        private void gvFigures_SelectionChanged(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;

            tmoAnimItemBindingSource.DataSource = tmoanim.items;
            viewer.SetFigureIndex(pngsave_row);
        }
예제 #8
0
        public void CopyFaceFile(string face_file)
        {
            if (Tmo.frames == null)
            {
                return;
            }

            List <string> except_snames = new List <string>();

            except_snames.Add("Kami_Oya");

            if (!string.IsNullOrEmpty(face_file))
            {
                Console.WriteLine("Load File: " + face_file);
                TMOFile face_tmo = TMOAnim.LoadPNGFile(Path.Combine(FaceRoot, face_file));
                if (face_tmo.frames != null)
                {
                    Tmo.SaveTransformationMatrixToFrame(0);
                    Tmo.CopyChildrenNodeFrom(face_tmo, "face_oya", except_snames);
                    Tmo.LoadTransformationMatrixFromFrame(0);
                }
            }
        }
예제 #9
0
        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();
            }
        }
예제 #10
0
 public PngSaveItem()
 {
     tmoanim = new TMOAnim();
 }