Example #1
0
        public object Clone()
        {
            Strip stpNew = new Strip(m_strName);

            for (int i = 0; i < this.Count; i++)
            {
                stpNew.Add((Frame)this[i].Clone());
            }
            stpNew.m_ifrActive = m_ifrActive;
            stpNew.m_cfrActive = m_cfrActive;
            stpNew.m_cHold     = m_cHold;
            return(stpNew);
        }
Example #2
0
        private void lstv_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
        {
            string[] astrFiles = e.Data.GetData(DataFormats.FileDrop) as string[];
            if (astrFiles != null)
            {
                if (astrFiles.Length == 1)
                {
                    ((MainForm)Globals.MainForm).CloseAndOpenDocument(astrFiles[0]);
                }
                else
                {
                    MessageBox.Show(this, "Please, only drop one animation file.", "Too many files dropped", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
#if false
            XBitmap[] axbm = e.Data.GetData(typeof(XBitmap[])) as XBitmap[];
            if (axbm == null)
            {
                return;
            }

            // Use the standard file naming convention to break the bitmaps down into
            // animations (e.g., *_fire_*_*), a single track (e.g., track 1), and a set
            // of TSprite keys (e.g., *_*_d_n)

            foreach (XBitmap xbm in axbm)
            {
                string   strFile = xbm.FileName;
                string[] astr    = strFile.Substring(strFile.LastIndexOf('\\') + 1).Split('_', '.');
                if (astr.Length != 5)
                {
                    MessageBox.Show(this, String.Format("Warning: file {0} does not match the requisite naming pattern", strFile),
                                    "AniMax");
                    continue;
                }

                // Find the appropriate animation

                Strip  stp     = null;
                Frame  fr      = null;
                string strName = astr[1] + " " + astr[2];
                foreach (Strip stpT in m_stps)
                {
                    if (stpT.Name == strName)
                    {
                        stp = stpT;
                        fr  = stp[0];
                        break;
                    }
                }

                // If one isn't found, create a new stpmation and empty track

                if (stp == null)
                {
                    stp = new Strip(strName);
                    m_stps.Add(stp);
                    tspr = new TSprite("track 1");
                    stp.Add(tspr);
                }

                Sprite spr = new Sprite(xbm, 0, 0);
                Time   t   = 0;
                if (tspr.End != Time.tUndefined)
                {
                    t = tspr.End + m_doc.FrameRate;
                }
                tspr.SetValue(t, spr);
            }

            m_doc.Dirty = true;
            RefreshView();
#endif
        }
Example #3
0
 public object Clone()
 {
     Strip stpNew = new Strip(m_strName);
     for (int i = 0; i < this.Count; i++) {
         stpNew.Add((Frame)this[i].Clone());
     }
     stpNew.m_ifrActive = m_ifrActive;
     stpNew.m_cfrActive = m_cfrActive;
     stpNew.m_cHold = m_cHold;
     return stpNew;
 }
        private void lstv_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
        {
            string[] astrFiles = e.Data.GetData(DataFormats.FileDrop) as string[];
            if (astrFiles != null) {
                if (astrFiles.Length == 1)
                    ((MainForm)Globals.MainForm).CloseAndOpenDocument(astrFiles[0]);
                else
                    MessageBox.Show(this, "Please, only drop one animation file.", "Too many files dropped", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            #if false
            XBitmap[] axbm = e.Data.GetData(typeof(XBitmap[])) as XBitmap[];
            if (axbm == null)
                return;

            // Use the standard file naming convention to break the bitmaps down into
            // animations (e.g., *_fire_*_*), a single track (e.g., track 1), and a set
            // of TSprite keys (e.g., *_*_d_n)

            foreach (XBitmap xbm in axbm) {
                string strFile = xbm.FileName;
                string[] astr = strFile.Substring(strFile.LastIndexOf('\\') + 1).Split('_', '.');
                if (astr.Length != 5) {
                    MessageBox.Show(this, String.Format("Warning: file {0} does not match the requisite naming pattern", strFile),
                            "AniMax");
                    continue;
                }

                // Find the appropriate animation

                Strip stp = null;
                Frame fr = null;
                string strName = astr[1] + " " + astr[2];
                foreach (Strip stpT in m_stps) {
                    if (stpT.Name == strName) {
                        stp = stpT;
                        fr = stp[0];
                        break;
                    }
                }

                // If one isn't found, create a new stpmation and empty track

                if (stp == null) {
                    stp = new Strip(strName);
                    m_stps.Add(stp);
                    tspr = new TSprite("track 1");
                    stp.Add(tspr);
                }

                Sprite spr = new Sprite(xbm, 0, 0);
                Time t = 0;
                if (tspr.End != Time.tUndefined)
                    t = tspr.End + m_doc.FrameRate;
                tspr.SetValue(t, spr);
            }

            m_doc.Dirty = true;
            RefreshView();
            #endif
        }